OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_INCLUDE_FXCRT_FX_XML_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_XML_H_ |
8 #define CORE_INCLUDE_FXCRT_FX_XML_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_XML_H_ |
9 | 9 |
10 #include "fx_basic.h" | 10 #include "fx_basic.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 void SetAt(const CFX_ByteStringC& spa
ce, const CFX_ByteStringC& name, const CFX_WideStringC& value); | 31 void SetAt(const CFX_ByteStringC& spa
ce, const CFX_ByteStringC& name, const CFX_WideStringC& value); |
32 void RemoveAt(const CFX_ByteStringC&
space, const CFX_ByteStringC& name); | 32 void RemoveAt(const CFX_ByteStringC&
space, const CFX_ByteStringC& name); |
33 void RemoveAll(); | 33 void RemoveAll(); |
34 int GetSize() const; | 34 int GetSize() const; |
35 CXML_AttrItem& GetAt(int index) const; | 35 CXML_AttrItem& GetAt(int index) const; |
36 CFX_ObjectArray<CXML_AttrItem>* m_pMap; | 36 CFX_ObjectArray<CXML_AttrItem>* m_pMap; |
37 }; | 37 }; |
38 class CXML_Content | 38 class CXML_Content |
39 { | 39 { |
40 public: | 40 public: |
41 CXML_Content() : m_bCDATA(FALSE), m_Content() {} | 41 CXML_Content() : m_bCDATA(false), m_Content() {} |
42 void» Set(FX_BOOL bCDATA, const CFX_WideStringC& content) | 42 void» Set(bool bCDATA, const CFX_WideStringC& content) |
43 { | 43 { |
44 m_bCDATA = bCDATA; | 44 m_bCDATA = bCDATA; |
45 m_Content = content; | 45 m_Content = content; |
46 } | 46 } |
47 FX_BOOL» » » m_bCDATA; | 47 bool» » » m_bCDATA; |
48 CFX_WideString m_Content; | 48 CFX_WideString m_Content; |
49 }; | 49 }; |
50 class CXML_Element | 50 class CXML_Element |
51 { | 51 { |
52 public: | 52 public: |
53 static CXML_Element*» Parse(const void* pBuffer, size_t size, FX_BOOL
bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); | 53 static CXML_Element*» Parse(const void* pBuffer, size_t size, bool bSa
veSpaceChars = false, FX_FILESIZE* pParsedSize = NULL); |
54 static CXML_Element*» Parse(IFX_FileRead *pFile, FX_BOOL bSaveSpaceCha
rs = FALSE, FX_FILESIZE* pParsedSize = NULL); | 54 static CXML_Element*» Parse(IFX_FileRead *pFile, bool bSaveSpaceChars
= false, FX_FILESIZE* pParsedSize = NULL); |
55 static CXML_Element*» Parse(IFX_BufferRead *pBuffer, FX_BOOL bSaveSpac
eChars = FALSE, FX_FILESIZE* pParsedSize = NULL); | 55 static CXML_Element*» Parse(IFX_BufferRead *pBuffer, bool bSaveSpaceCh
ars = false, FX_FILESIZE* pParsedSize = NULL); |
56 CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); | 56 CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); |
57 CXML_Element(const CFX_ByteStringC& qTagName); | 57 CXML_Element(const CFX_ByteStringC& qTagName); |
58 CXML_Element(); | 58 CXML_Element(); |
59 | 59 |
60 ~CXML_Element(); | 60 ~CXML_Element(); |
61 | 61 |
62 void Empty(); | 62 void Empty(); |
63 | 63 |
64 | 64 |
65 | 65 |
66 CFX_ByteString» » » GetTagName(FX_BOOL bQualified = FALSE) c
onst; | 66 CFX_ByteString» » » GetTagName(bool bQualified = false) cons
t; |
67 | 67 |
68 CFX_ByteString» » » GetNamespace(FX_BOOL bQualified = FALSE)
const; | 68 CFX_ByteString» » » GetNamespace(bool bQualified = false) co
nst; |
69 | 69 |
70 CFX_ByteString GetNamespaceURI(const CFX_ByteStringC& q
Name) const; | 70 CFX_ByteString GetNamespaceURI(const CFX_ByteStringC& q
Name) const; |
71 | 71 |
72 CXML_Element* GetParent() const | 72 CXML_Element* GetParent() const |
73 { | 73 { |
74 return m_pParent; | 74 return m_pParent; |
75 } | 75 } |
76 | 76 |
77 FX_DWORD CountAttrs() const | 77 FX_DWORD CountAttrs() const |
78 { | 78 { |
79 return m_AttrMap.GetSize(); | 79 return m_AttrMap.GetSize(); |
80 } | 80 } |
81 | 81 |
82 void GetAttrByIndex(int index, CFX_By
teString &space, CFX_ByteString &name, CFX_WideString &value) const; | 82 void GetAttrByIndex(int index, CFX_By
teString &space, CFX_ByteString &name, CFX_WideString &value) const; |
83 | 83 |
84 FX_BOOL» » » » » HasAttr(const CFX_ByteStringC& q
Name) const; | 84 bool» » » » » HasAttr(const CFX_ByteStringC& q
Name) const; |
85 | 85 |
86 FX_BOOL» » » » » GetAttrValue(const CFX_ByteStrin
gC& name, CFX_WideString& attribute) const; | 86 bool» » » » » GetAttrValue(const CFX_ByteStrin
gC& name, CFX_WideString& attribute) const; |
87 CFX_WideString GetAttrValue(const CFX_ByteStringC& name
) const | 87 CFX_WideString GetAttrValue(const CFX_ByteStringC& name
) const |
88 { | 88 { |
89 CFX_WideString attr; | 89 CFX_WideString attr; |
90 GetAttrValue(name, attr); | 90 GetAttrValue(name, attr); |
91 return attr; | 91 return attr; |
92 } | 92 } |
93 | 93 |
94 FX_BOOL» » » » » GetAttrValue(const CFX_ByteStrin
gC& space, const CFX_ByteStringC& name, CFX_WideString& attribute) const; | 94 bool» » » » » GetAttrValue(const CFX_ByteStrin
gC& space, const CFX_ByteStringC& name, CFX_WideString& attribute) const; |
95 CFX_WideString GetAttrValue(const CFX_ByteStringC& spac
e, const CFX_ByteStringC& name) const | 95 CFX_WideString GetAttrValue(const CFX_ByteStringC& spac
e, const CFX_ByteStringC& name) const |
96 { | 96 { |
97 CFX_WideString attr; | 97 CFX_WideString attr; |
98 GetAttrValue(space, name, attr); | 98 GetAttrValue(space, name, attr); |
99 return attr; | 99 return attr; |
100 } | 100 } |
101 | 101 |
102 FX_BOOL» » » » » GetAttrInteger(const CFX_ByteStr
ingC& name, int& attribute) const; | 102 bool» » » » » GetAttrInteger(const CFX_ByteStr
ingC& name, int& attribute) const; |
103 int GetAttrInteger(const CFX_ByteStr
ingC& name) const | 103 int GetAttrInteger(const CFX_ByteStr
ingC& name) const |
104 { | 104 { |
105 int attr = 0; | 105 int attr = 0; |
106 GetAttrInteger(name, attr); | 106 GetAttrInteger(name, attr); |
107 return attr; | 107 return attr; |
108 } | 108 } |
109 | 109 |
110 FX_BOOL» » » » » GetAttrInteger(const CFX_ByteStr
ingC& space, const CFX_ByteStringC& name, int& attribute) const; | 110 bool» » » » » GetAttrInteger(const CFX_ByteStr
ingC& space, const CFX_ByteStringC& name, int& attribute) const; |
111 int GetAttrInteger(const CFX_ByteStr
ingC& space, const CFX_ByteStringC& name) const | 111 int GetAttrInteger(const CFX_ByteStr
ingC& space, const CFX_ByteStringC& name) const |
112 { | 112 { |
113 int attr = 0; | 113 int attr = 0; |
114 GetAttrInteger(space, name, attr); | 114 GetAttrInteger(space, name, attr); |
115 return attr; | 115 return attr; |
116 } | 116 } |
117 | 117 |
118 FX_BOOL» » » » » GetAttrFloat(const CFX_ByteStrin
gC& name, FX_FLOAT& attribute) const; | 118 bool» » » » » GetAttrFloat(const CFX_ByteStrin
gC& name, FX_FLOAT& attribute) const; |
119 FX_FLOAT GetAttrFloat(const CFX_ByteStringC& name
) const | 119 FX_FLOAT GetAttrFloat(const CFX_ByteStringC& name
) const |
120 { | 120 { |
121 FX_FLOAT attr = 0; | 121 FX_FLOAT attr = 0; |
122 GetAttrFloat(name, attr); | 122 GetAttrFloat(name, attr); |
123 return attr; | 123 return attr; |
124 } | 124 } |
125 | 125 |
126 FX_BOOL» » » » » GetAttrFloat(const CFX_ByteStrin
gC& space, const CFX_ByteStringC& name, FX_FLOAT& attribute) const; | 126 bool» » » » » GetAttrFloat(const CFX_ByteStrin
gC& space, const CFX_ByteStringC& name, FX_FLOAT& attribute) const; |
127 FX_FLOAT GetAttrFloat(const CFX_ByteStringC& spac
e, const CFX_ByteStringC& name) const | 127 FX_FLOAT GetAttrFloat(const CFX_ByteStringC& spac
e, const CFX_ByteStringC& name) const |
128 { | 128 { |
129 FX_FLOAT attr = 0; | 129 FX_FLOAT attr = 0; |
130 GetAttrFloat(space, name, attr); | 130 GetAttrFloat(space, name, attr); |
131 return attr; | 131 return attr; |
132 } | 132 } |
133 | 133 |
134 FX_DWORD CountChildren() const; | 134 FX_DWORD CountChildren() const; |
135 | 135 |
136 enum ChildType { Invalid, Element, Content}; | 136 enum ChildType { Invalid, Element, Content}; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 CFX_ByteString m_TagName; | 171 CFX_ByteString m_TagName; |
172 | 172 |
173 CXML_AttrMap m_AttrMap; | 173 CXML_AttrMap m_AttrMap; |
174 | 174 |
175 CFX_PtrArray m_Children; | 175 CFX_PtrArray m_Children; |
176 friend class CXML_Parser; | 176 friend class CXML_Parser; |
177 friend class CXML_Composer; | 177 friend class CXML_Composer; |
178 }; | 178 }; |
179 | 179 |
180 #endif // CORE_INCLUDE_FXCRT_FX_XML_H_ | 180 #endif // CORE_INCLUDE_FXCRT_FX_XML_H_ |
OLD | NEW |