🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
BKVParser.hpp
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstUtil/StringView.hpp"
25#include "AstUtil/BKVItemView.hpp"
26#include "AstUtil/BaseParser.hpp"
27#include <cstdio>
28#include <vector>
29
30#include <fstream>
31
32AST_NAMESPACE_BEGIN
33
34class BKVSax;
35class BKVItemView;
36class ValueView;
37
44class AST_UTIL_API BKVParser: public BaseParser
45{
46public:
54
55 BKVParser();
56 BKVParser(StringView filepath);
57 ~BKVParser();
58
62 void setAllowComment(bool allow){ allowComment_ = allow; }
63
67 bool allowComment() const { return allowComment_; }
68
74 EToken getNext(StringView& key, ValueView& value);
75
80 EToken getNext(BKVItemView& item);
81
86
92 errc_t parseFile(StringView filepath, BKVSax& sax);
93
98 errc_t parse(BKVSax& sax);
99
100protected:
102 std::vector<char> keyBuffer_;
103 std::vector<char> valueBuffer_;
104};
105
106
107AST_NAMESPACE_END
键值对项视图类(BlockKeyValueItemView)
定义 BKVItemView.hpp:32
键值对解析器(BlockKeyValueParser)
定义 BKVParser.hpp:45
std::vector< char > keyBuffer_
内存缓冲区 for key
定义 BKVParser.hpp:102
bool allowComment() const
是否允许注释
定义 BKVParser.hpp:67
bool allowComment_
是否允许注释行
定义 BKVParser.hpp:101
EToken
定义 BKVParser.hpp:47
@ eBlockEnd
块结束
定义 BKVParser.hpp:49
@ eBlockBegin
块开始
定义 BKVParser.hpp:48
@ eError
错误
定义 BKVParser.hpp:51
@ eKeyValue
键值对
定义 BKVParser.hpp:50
std::vector< char > valueBuffer_
内存缓冲区 for value
定义 BKVParser.hpp:103
void setAllowComment(bool allow)
设置是否允许注释
定义 BKVParser.hpp:62
StringView getLineSkipComment()
获取当前行(跳过注释行)
定义 BKVParser.hpp:85
键值对解析器SAX接口(BlockKeyValueSax)
定义 BKVSax.hpp:36
解析器基类
定义 BaseParser.hpp:56
StringView getLineSkipHashComment()
获取当前非#注释行(跳过#注释行)
定义 BaseParser.cpp:176
值视图类
定义 ValueView.hpp:40