NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
yaml_string类 参考final

YAML字符串值类型 更多...

#include <yaml_value.hpp>

类 yaml_string 继承关系图:
[图例]

Public 类型

enum  string_style {
  Plain , SingleQuoted , DoubleQuoted , Literal ,
  Folded
}
 字符串标量样式枚举 更多...
Public 类型 继承自 yaml_value
enum  types {
  Null , Boolean , Integer , Float ,
  String , Timestamp , Sequence , Mapping
}
 YAML值类型枚举 更多...

Public 成员函数

 yaml_string (string v, const string_style s=Plain)
 构造字符串值
types type () const noexcept override
 获取值的具体类型
const stringget_value () const noexcept
 获取字符串内容
string_style get_style () const noexcept
 获取标量样式
Public 成员函数 继承自 yaml_value
void set_anchor (const string &a)
 设置锚点名
void set_tag (const string &t)
 设置类型标签
string to_string () const
 紧凑单行序列化
string to_document () const
 格式化文档序列化
Public 成员函数 继承自 istringify< yaml_value >
constexpr string to_string () const
 转换为字符串

额外继承的成员函数

Public 属性 继承自 yaml_value
string anchor
 锚点名(YAML &anchor 语法),空字符串表示无锚点
string tag
 类型标签(YAML !tag 语法),空字符串表示无标签

详细描述

YAML字符串值类型

表示YAML中的字符串值。支持YAML 1.2定义的五种标量样式:

样式 枚举值 语法示例 说明
Plain Plain hello world 无引号纯文本
SingleQuoted SingleQuoted 'hello world' 单引号,'' 表示字面引号
DoubleQuoted DoubleQuoted "hello\\nworld" 双引号,支持转义序列
Literal Literal \|\n line1\n line2 块字面量,保留换行
Folded Folded >\n line1\n line2 块折叠,换行转空格

在文件 yaml_value.hpp455 行定义.

成员枚举类型说明

◆ string_style

字符串标量样式枚举

枚举值
Plain 

纯文本样式(无引号)

SingleQuoted 

单引号样式('string')

DoubleQuoted 

双引号样式("string",支持转义)

Literal 

块字面量样式(|,保留换行)

Folded 

块折叠样式(>,换行转空格)

在文件 yaml_value.hpp461 行定义.

构造及析构函数说明

◆ yaml_string()

yaml_string::yaml_string ( string v,
const string_style s = Plain )
inlineexplicit

构造字符串值

参数
v字符串内容
s标量样式,默认为纯文本

在文件 yaml_value.hpp486 行定义.

引用了 move() , 以及 Plain.

成员函数说明

◆ get_style()

string_style yaml_string::get_style ( ) const
inlinenodiscardnoexcept

获取标量样式

返回
字符串样式枚举值

在文件 yaml_value.hpp503 行定义.

◆ get_value()

const string & yaml_string::get_value ( ) const
inlinenodiscardnoexcept

获取字符串内容

返回
字符串常量引用

在文件 yaml_value.hpp497 行定义.

◆ type()

types yaml_string::type ( ) const
inlinenodiscardoverridevirtualnoexcept

获取值的具体类型

返回
类型枚举值

实现了 yaml_value.

在文件 yaml_value.hpp490 行定义.

引用了 yaml_value::String.


该类的文档由以下文件生成: