fastdo  0.6.8
elem_parser.hpp
浏览该文件的文档.
1 #ifndef __ELEMPARSER_HPP__
2 #define __ELEMPARSER_HPP__
3 
4 namespace eienml
5 {
6 
11 {
12 public:
13  ElemParser( ElemPackage const & package );
14 
16  Element * parseEx( winux::AnsiString s, Element * container ) const;
17 
19  Document * parseEx( winux::AnsiString s, DocumentCreator docCreator = NULL ) const;
20 
26  int findDelimPair(
27  winux::AnsiString const & str,
28  int offset,
29  int * length,
30  winux::AnsiString * internalData,
31  winux::AnsiString * lDelim,
32  winux::AnsiString * rDelim
33  ) const;
34 
42  int search( winux::AnsiString const & str, int * length, winux::AnsiString * data, bool * isBlock, bool * isHead, winux::AnsiString * tagName ) const;
43 
45  void readElement( winux::AnsiString data, winux::AnsiString * tagName, winux::AnsiString * defAttr, Attributes * attrs ) const;
46 
48  void readBlock( winux::AnsiString const & data, winux::AnsiString * blockTag, winux::AnsiString * blockContent ) const;
49 private:
50 
51 public:
55  Element * parse( winux::AnsiString s, Element * container ) const;
56 
58  Document * parse( winux::AnsiString s, DocumentCreator docCreator = NULL ) const;
59 
61  int searchElement( winux::AnsiString const & str, int * length = NULL ) const;
62 
64  int searchDelim( winux::AnsiString const & str, int offset, int * length = NULL ) const;
65 
67  bool isHeader( winux::AnsiString const & str, winux::AnsiString * data = NULL ) const;
68  /* 读取字符到键名,遇到=号键名结束,开始读值
69  * 如果第一个字符不是引号,则读到空格为止值结束
70  * 如果是引号,则继续读到另一个引号为止值结束
71  * 读到\时应对下一字符进行判断,如果是引号,则不结束值,继续读取. */
72 
74  void read( winux::AnsiString const & str, winux::AnsiString * tagName = NULL, winux::AnsiString * defAttr = NULL, Attributes * attrs = NULL ) const;
75 private:
76  void _key( winux::AnsiString const & str, int len, int start, winux::AnsiString * key, int * pos ) const;
77  void _val( winux::AnsiString const & str, int len, int start, winux::AnsiString * val, int * pos ) const;
78  ElemPackage const * package;
79 
80 };
81 
82 }
83 
84 #endif // __ELEMPARSER_HPP__
XString< char > AnsiString
Definition: utilities.hpp:212
#define EIENML_DLL
Definition: eienml.hpp:19
Document *(* DocumentCreator)(void)
Definition: elem_package.hpp:9
元素节点类
Definition: elem_utils.hpp:114
元素解析处理器
Definition: elem_parser.hpp:10
标签式语言支持库
Definition: elem_package.hpp:5
std::map< winux::AnsiString, winux::AnsiString > Attributes
Definition: elem_utils.hpp:108