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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); | 64 CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); |
65 CXML_Element(const CFX_ByteStringC& qTagName); | 65 CXML_Element(const CFX_ByteStringC& qTagName); |
66 CXML_Element(); | 66 CXML_Element(); |
67 ~CXML_Element(); | 67 ~CXML_Element(); |
68 | 68 |
69 void Empty(); | 69 void Empty(); |
70 CFX_ByteString GetTagName(FX_BOOL bQualified = FALSE) const; | 70 CFX_ByteString GetTagName(FX_BOOL bQualified = FALSE) const; |
71 CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; | 71 CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; |
72 CFX_ByteString GetNamespaceURI(const CFX_ByteStringC& qName) const; | 72 CFX_ByteString GetNamespaceURI(const CFX_ByteStringC& qName) const; |
73 CXML_Element* GetParent() const { return m_pParent; } | 73 CXML_Element* GetParent() const { return m_pParent; } |
74 FX_DWORD CountAttrs() const { return m_AttrMap.GetSize(); } | 74 uint32_t CountAttrs() const { return m_AttrMap.GetSize(); } |
75 void GetAttrByIndex(int index, | 75 void GetAttrByIndex(int index, |
76 CFX_ByteString& space, | 76 CFX_ByteString& space, |
77 CFX_ByteString& name, | 77 CFX_ByteString& name, |
78 CFX_WideString& value) const; | 78 CFX_WideString& value) const; |
79 FX_BOOL HasAttr(const CFX_ByteStringC& qName) const; | 79 FX_BOOL HasAttr(const CFX_ByteStringC& qName) const; |
80 FX_BOOL GetAttrValue(const CFX_ByteStringC& name, | 80 FX_BOOL GetAttrValue(const CFX_ByteStringC& name, |
81 CFX_WideString& attribute) const; | 81 CFX_WideString& attribute) const; |
82 CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const { | 82 CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const { |
83 CFX_WideString attr; | 83 CFX_WideString attr; |
84 GetAttrValue(name, attr); | 84 GetAttrValue(name, attr); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 FX_BOOL GetAttrFloat(const CFX_ByteStringC& space, | 122 FX_BOOL GetAttrFloat(const CFX_ByteStringC& space, |
123 const CFX_ByteStringC& name, | 123 const CFX_ByteStringC& name, |
124 FX_FLOAT& attribute) const; | 124 FX_FLOAT& attribute) const; |
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 FX_DWORD CountChildren() const { return m_Children.size(); } | 132 uint32_t CountChildren() const { return m_Children.size(); } |
133 ChildType GetChildType(FX_DWORD index) const; | 133 ChildType GetChildType(uint32_t index) const; |
134 CFX_WideString GetContent(FX_DWORD index) const; | 134 CFX_WideString GetContent(uint32_t index) const; |
135 CXML_Element* GetElement(FX_DWORD index) const; | 135 CXML_Element* GetElement(uint32_t index) const; |
136 CXML_Element* GetElement(const CFX_ByteStringC& space, | 136 CXML_Element* GetElement(const CFX_ByteStringC& space, |
137 const CFX_ByteStringC& tag) const { | 137 const CFX_ByteStringC& tag) const { |
138 return GetElement(space, tag, 0); | 138 return GetElement(space, tag, 0); |
139 } | 139 } |
140 | 140 |
141 FX_DWORD 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* GetElement(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 FX_DWORD 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(FX_DWORD 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 |