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_FXCRT_INCLUDE_FX_XML_H_ | 7 #ifndef CORE_FXCRT_INCLUDE_FX_XML_H_ |
8 #define CORE_FXCRT_INCLUDE_FX_XML_H_ | 8 #define CORE_FXCRT_INCLUDE_FX_XML_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 FX_FLOAT GetAttrFloat(const CFX_ByteStringC& space, | 125 FX_FLOAT GetAttrFloat(const CFX_ByteStringC& space, |
126 const CFX_ByteStringC& name) const { | 126 const CFX_ByteStringC& name) const { |
127 FX_FLOAT attr = 0; | 127 FX_FLOAT attr = 0; |
128 GetAttrFloat(space, name, attr); | 128 GetAttrFloat(space, name, attr); |
129 return attr; | 129 return attr; |
130 } | 130 } |
131 | 131 |
132 uint32_t CountChildren() const { return m_Children.size(); } | 132 uint32_t CountChildren() const { return m_Children.size(); } |
133 ChildType GetChildType(uint32_t index) const; | 133 ChildType GetChildType(uint32_t index) const; |
134 CFX_WideString GetContent(uint32_t index) const; | 134 CFX_WideString GetContent(uint32_t index) const; |
135 CXML_Element* GetElement(uint32_t index) const; | 135 CXML_Element* GetObjectBy(uint32_t index) const; |
136 CXML_Element* GetElement(const CFX_ByteStringC& space, | 136 CXML_Element* GetObjectBy(const CFX_ByteStringC& space, |
137 const CFX_ByteStringC& tag) const { | 137 const CFX_ByteStringC& tag) const { |
138 return GetElement(space, tag, 0); | 138 return GetObjectBy(space, tag, 0); |
139 } | 139 } |
140 | 140 |
141 uint32_t CountElements(const CFX_ByteStringC& space, | 141 uint32_t CountElements(const CFX_ByteStringC& space, |
142 const CFX_ByteStringC& tag) const; | 142 const CFX_ByteStringC& tag) const; |
143 CXML_Element* GetElement(const CFX_ByteStringC& space, | 143 CXML_Element* GetObjectBy(const CFX_ByteStringC& space, |
144 const CFX_ByteStringC& tag, | 144 const CFX_ByteStringC& tag, |
145 int index) const; | 145 int index) const; |
146 | 146 |
147 uint32_t FindElement(CXML_Element* pChild) const; | 147 uint32_t FindElement(CXML_Element* pChild) const; |
148 void SetTag(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagname); | 148 void SetTag(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagname); |
149 void SetTag(const CFX_ByteStringC& qTagName); | 149 void SetTag(const CFX_ByteStringC& qTagName); |
150 void RemoveChildren(); | 150 void RemoveChildren(); |
151 void RemoveChild(uint32_t index); | 151 void RemoveChild(uint32_t index); |
152 | 152 |
153 protected: | 153 protected: |
154 struct ChildRecord { | 154 struct ChildRecord { |
155 ChildType type; | 155 ChildType type; |
156 void* child; // CXML_Element and CXML_Content lack a common ancestor. | 156 void* child; // CXML_Element and CXML_Content lack a common ancestor. |
157 }; | 157 }; |
158 | 158 |
159 CXML_Element* m_pParent; | 159 CXML_Element* m_pParent; |
160 CFX_ByteString m_QSpaceName; | 160 CFX_ByteString m_QSpaceName; |
161 CFX_ByteString m_TagName; | 161 CFX_ByteString m_TagName; |
162 CXML_AttrMap m_AttrMap; | 162 CXML_AttrMap m_AttrMap; |
163 std::vector<ChildRecord> m_Children; | 163 std::vector<ChildRecord> m_Children; |
164 | 164 |
165 friend class CXML_Parser; | 165 friend class CXML_Parser; |
166 friend class CXML_Composer; | 166 friend class CXML_Composer; |
167 }; | 167 }; |
168 | 168 |
169 #endif // CORE_FXCRT_INCLUDE_FX_XML_H_ | 169 #endif // CORE_FXCRT_INCLUDE_FX_XML_H_ |
OLD | NEW |