NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
ini_parser.hpp
浏览该文件的文档.
1#ifndef NEFORCE_CORE_FILE_INI_INI_PARSER_HPP__
2#define NEFORCE_CORE_FILE_INI_INI_PARSER_HPP__
3
12
15NEFORCE_BEGIN_NAMESPACE__
16
22
28
43class NEFORCE_API ini_parser {
44private:
45 string text_;
46 size_t len_;
47 size_t pos_ = 0;
48 size_t line_ = 1;
49 size_t column_ = 1;
50
52 ini_section* current_section_ = nullptr;
53
59 void skip_whitespace() noexcept;
60
66 void skip_line() noexcept;
67
72 char current() const noexcept;
73
79 char peek(size_t offset = 1) const noexcept;
80
85 bool eof() const noexcept;
86
92 void advance() noexcept;
93
99 bool is_comment_line(const string& line) const;
100
110 bool is_section_line(const string& line, string& section_name) const;
111
123 bool parse_key_value(const string& line, string& key, string& value) const;
124
134 void parse_line(const string& line);
135
136public:
143 explicit ini_parser(string text) :
144 text_(_NEFORCE move(text)),
145 len_(text_.size()) {
147 current_section_ = root_->get_global_section();
148 }
149
159
168};
169 // IniConfig
171 // ConfigFormat
173
174NEFORCE_END_NAMESPACE__
175#endif // NEFORCE_CORE_FILE_INI_INI_PARSER_HPP__
optional< unique_ptr< ini_document > > try_parse()
尝试执行解析
ini_parser(string text)
构造函数
unique_ptr< ini_document > parse()
执行解析
可选值类
独占智能指针
constexpr void advance(Iterator &i, Distance n)
将迭代器前进指定距离
constexpr Iterator2 move(Iterator1 first, Iterator1 last, Iterator2 result) noexcept(noexcept(inner::__move_aux(first, last, result)))
移动范围元素
NEFORCE_NODISCARD NEFORCE_ALWAYS_INLINE constexpr decltype(auto) size(const Container &cont) noexcept(noexcept(cont.size()))
获取容器的大小
NEFORCE_CONSTEXPR20 unique_ptr< T > make_unique(Args &&... args)
创建unique_ptr
ini配置变量
可选值类型