1#ifndef NEFORCE_CORE_FILE_TOML_BUILDER_HPP__
2#define NEFORCE_CORE_FILE_TOML_BUILDER_HPP__
15NEFORCE_BEGIN_NAMESPACE__
59 range_type type = table;
73 frame(
const frame&) =
default;
74 frame& operator=(
const frame&) =
default;
75 frame(frame&&) =
default;
76 frame& operator=(frame&&) =
default;
98 if (contexts_.empty()) {
99 NEFORCE_THROW_EXCEPTION(
toml_exception(
"Cannot add value to root (root must be a table)"));
102 const auto& top = contexts_.top();
103 if (top.type == array) {
104 top.array_ptr->add_element(_NEFORCE
move(
value));
105 }
else if (top.type == table || top.type == inline_table) {
106 if (current_key_.empty()) {
107 NEFORCE_THROW_EXCEPTION(
toml_exception(
"No key set for value in table"));
109 if (top.table_ptr->has_member(current_key_)) {
112 top.table_ptr->add_member(current_key_, _NEFORCE
move(
value));
113 current_key_.clear();
124 template <
typename Iterable>
126 return this->value_iterable_impl(iterable);
135 template <
typename Map>
138 for (
const auto&
pair: maplike) {
151 template <
typename Iterable>
154 for (
const auto& element: iterable) {
155 this->value(element);
404 template <
typename Iterable>
406 return this->value_iterable_dispatch(iterable);
452NEFORCE_END_NAMESPACE__
toml_builder & end_table()
结束当前标准表格
toml_builder & value(const char *value)
设置C字符串值
toml_builder & value(nullptr_t np)
设置null值
toml_builder & value_table(const function< void(toml_builder &)> &build_func)
使用函数式方式构建表格值
toml_builder & value(const int value)
设置整数值
toml_builder & end_array_table()
结束当前表格数组
unique_ptr< toml_table > build()
构建toml文档
toml_builder & value(unique_ptr< toml_value > value)
设置已构建的toml值
toml_builder & begin_inline_table()
开始一个内联表格
toml_builder & value(const bool value)
设置布尔值
toml_builder & begin_array()
开始一个数组
toml_builder & end_inline_table()
结束当前内联表格
toml_builder & end_array()
结束当前数组
toml_builder & begin_table(const string &name)
开始一个标准表格(单键版本)
toml_builder & value(const int64_t value)
设置64位整数值
toml_builder & value(const Iterable &iterable)
设置可迭代对象的值
toml_builder & operator=(toml_builder &&other)=default
移动赋值运算符
toml_builder & value_array(const function< void(toml_builder &)> &build_func)
使用函数式方式构建数组值
toml_builder & begin_array_table(const string &name)
开始一个表格数组(单键版本)
toml_builder & value_datetime(const string_view value, toml_datetime::datetime_type type)
设置指定类型的日期时间值
toml_builder & value_string(string value, toml_string::string_type type)
设置指定类型的字符串值
toml_builder(toml_builder &&other)=default
移动构造函数
toml_builder & value(const double value)
设置双精度浮点数值
toml_builder & value_inline_table(const function< void(toml_builder &)> &build_func)
使用函数式方式构建内联表格值
toml_builder & value(const string_view value)
设置字符串视图值
toml_builder & begin_array_table(const vector< string > &path)
开始一个表格数组(路径版本)
toml_builder & key(string key)
设置当前键名
toml_builder & value(string value)
设置字符串值(基本字符串类型)
toml_builder & begin_table(const vector< string > &path)
开始一个标准表格(路径版本)
long long int64_t
64位有符号整数类型
decltype(nullptr) nullptr_t
空指针类型
constexpr Iterator2 move(Iterator1 first, Iterator1 last, Iterator2 result) noexcept(noexcept(inner::__move_aux(first, last, result)))
移动范围元素
basic_string_view< char > string_view
字符字符串视图
NEFORCE_ALWAYS_INLINE_INLINE bool name(char *buffer, size_t size)
获取当前线程名称
NEFORCE_NODISCARD NEFORCE_ALWAYS_INLINE constexpr decltype(auto) data(Container &cont) noexcept(noexcept(cont.data()))
获取容器的底层数据指针
typename enable_if< Test, T >::type enable_if_t
enable_if的便捷别名
NEFORCE_CONSTEXPR20 unique_ptr< T > make_unique(Args &&... args)
创建unique_ptr