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 XFA_FDE_XML_FDE_XML_IMP_H_ | 7 #ifndef XFA_FDE_XML_FDE_XML_IMP_H_ |
8 #define XFA_FDE_XML_FDE_XML_IMP_H_ | 8 #define XFA_FDE_XML_FDE_XML_IMP_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_system.h" | 10 #include "core/fxcrt/include/fx_system.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 LastSibling, | 33 LastSibling, |
34 FirstNeighbor, | 34 FirstNeighbor, |
35 PriorNeighbor, | 35 PriorNeighbor, |
36 NextNeighbor, | 36 NextNeighbor, |
37 LastNeighbor, | 37 LastNeighbor, |
38 FirstChild, | 38 FirstChild, |
39 LastChild | 39 LastChild |
40 }; | 40 }; |
41 | 41 |
42 CFDE_XMLNode(); | 42 CFDE_XMLNode(); |
43 virtual ~CFDE_XMLNode(); | 43 ~CFDE_XMLNode() override; |
44 | 44 |
45 virtual void Release() { delete this; } | 45 virtual void Release(); |
46 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Unknown; } | 46 virtual FDE_XMLNODETYPE GetType() const; |
47 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); | 47 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); |
48 | 48 |
49 int32_t CountChildNodes() const; | 49 int32_t CountChildNodes() const; |
50 CFDE_XMLNode* GetChildNode(int32_t index) const; | 50 CFDE_XMLNode* GetChildNode(int32_t index) const; |
51 int32_t GetChildNodeIndex(CFDE_XMLNode* pNode) const; | 51 int32_t GetChildNodeIndex(CFDE_XMLNode* pNode) const; |
52 int32_t InsertChildNode(CFDE_XMLNode* pNode, int32_t index = -1); | 52 int32_t InsertChildNode(CFDE_XMLNode* pNode, int32_t index = -1); |
53 void RemoveChildNode(CFDE_XMLNode* pNode); | 53 void RemoveChildNode(CFDE_XMLNode* pNode); |
54 void DeleteChildren(); | 54 void DeleteChildren(); |
55 void CloneChildren(CFDE_XMLNode* pClone); | 55 void CloneChildren(CFDE_XMLNode* pClone); |
56 | 56 |
57 CFDE_XMLNode* GetPath(const FX_WCHAR* pPath, | 57 CFDE_XMLNode* GetPath(const FX_WCHAR* pPath, |
58 int32_t iLength = -1, | 58 int32_t iLength = -1, |
59 FX_BOOL bQualifiedName = TRUE) const; | 59 FX_BOOL bQualifiedName = TRUE) const; |
60 | 60 |
61 int32_t GetNodeLevel() const; | 61 int32_t GetNodeLevel() const; |
62 CFDE_XMLNode* GetNodeItem(CFDE_XMLNode::NodeItem eItem) const; | 62 CFDE_XMLNode* GetNodeItem(CFDE_XMLNode::NodeItem eItem) const; |
63 FX_BOOL InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode); | 63 FX_BOOL InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode); |
64 CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem); | 64 CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem); |
65 | 65 |
66 void SaveXMLNode(IFX_Stream* pXMLStream); | 66 void SaveXMLNode(IFX_Stream* pXMLStream); |
67 | 67 |
68 CFDE_XMLNode* m_pParent; | 68 CFDE_XMLNode* m_pParent; |
69 CFDE_XMLNode* m_pChild; | 69 CFDE_XMLNode* m_pChild; |
70 CFDE_XMLNode* m_pPrior; | 70 CFDE_XMLNode* m_pPrior; |
71 CFDE_XMLNode* m_pNext; | 71 CFDE_XMLNode* m_pNext; |
72 }; | 72 }; |
73 | 73 |
74 class CFDE_XMLInstruction : public CFDE_XMLNode { | 74 class CFDE_XMLInstruction : public CFDE_XMLNode { |
75 public: | 75 public: |
76 CFDE_XMLInstruction(const CFX_WideString& wsTarget); | 76 explicit CFDE_XMLInstruction(const CFX_WideString& wsTarget); |
77 ~CFDE_XMLInstruction() override {} | 77 ~CFDE_XMLInstruction() override; |
78 | 78 |
79 // CFDE_XMLNode | 79 // CFDE_XMLNode |
80 void Release() override { delete this; } | 80 void Release() override; |
81 FDE_XMLNODETYPE GetType() const override { return FDE_XMLNODE_Instruction; } | 81 FDE_XMLNODETYPE GetType() const override; |
82 CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; | 82 CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; |
83 | 83 |
84 void GetTargetName(CFX_WideString& wsTarget) const { wsTarget = m_wsTarget; } | 84 void GetTargetName(CFX_WideString& wsTarget) const { wsTarget = m_wsTarget; } |
85 int32_t CountAttributes() const; | 85 int32_t CountAttributes() const; |
86 FX_BOOL GetAttribute(int32_t index, | 86 FX_BOOL GetAttribute(int32_t index, |
87 CFX_WideString& wsAttriName, | 87 CFX_WideString& wsAttriName, |
88 CFX_WideString& wsAttriValue) const; | 88 CFX_WideString& wsAttriValue) const; |
89 FX_BOOL HasAttribute(const FX_WCHAR* pwsAttriName) const; | 89 FX_BOOL HasAttribute(const FX_WCHAR* pwsAttriName) const; |
90 void GetString(const FX_WCHAR* pwsAttriName, | 90 void GetString(const FX_WCHAR* pwsAttriName, |
91 CFX_WideString& wsAttriValue, | 91 CFX_WideString& wsAttriValue, |
(...skipping 10 matching lines...) Expand all Loading... |
102 void AppendData(const CFX_WideString& wsData); | 102 void AppendData(const CFX_WideString& wsData); |
103 void RemoveData(int32_t index); | 103 void RemoveData(int32_t index); |
104 | 104 |
105 CFX_WideString m_wsTarget; | 105 CFX_WideString m_wsTarget; |
106 CFX_WideStringArray m_Attributes; | 106 CFX_WideStringArray m_Attributes; |
107 CFX_WideStringArray m_TargetData; | 107 CFX_WideStringArray m_TargetData; |
108 }; | 108 }; |
109 | 109 |
110 class CFDE_XMLElement : public CFDE_XMLNode { | 110 class CFDE_XMLElement : public CFDE_XMLNode { |
111 public: | 111 public: |
112 CFDE_XMLElement(const CFX_WideString& wsTag); | 112 explicit CFDE_XMLElement(const CFX_WideString& wsTag); |
113 ~CFDE_XMLElement() override; | 113 ~CFDE_XMLElement() override; |
114 | 114 |
115 // CFDE_XMLNode | 115 // CFDE_XMLNode |
116 void Release() override { delete this; } | 116 void Release() override; |
117 FDE_XMLNODETYPE GetType() const override { return FDE_XMLNODE_Element; } | 117 FDE_XMLNODETYPE GetType() const override; |
118 CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; | 118 CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; |
119 | 119 |
120 void GetTagName(CFX_WideString& wsTag) const; | 120 void GetTagName(CFX_WideString& wsTag) const; |
121 void GetLocalTagName(CFX_WideString& wsTag) const; | 121 void GetLocalTagName(CFX_WideString& wsTag) const; |
122 | 122 |
123 void GetNamespacePrefix(CFX_WideString& wsPrefix) const; | 123 void GetNamespacePrefix(CFX_WideString& wsPrefix) const; |
124 void GetNamespaceURI(CFX_WideString& wsNamespace) const; | 124 void GetNamespaceURI(CFX_WideString& wsNamespace) const; |
125 | 125 |
126 int32_t CountAttributes() const; | 126 int32_t CountAttributes() const; |
127 FX_BOOL GetAttribute(int32_t index, | 127 FX_BOOL GetAttribute(int32_t index, |
(...skipping 16 matching lines...) Expand all Loading... |
144 | 144 |
145 void GetTextData(CFX_WideString& wsText) const; | 145 void GetTextData(CFX_WideString& wsText) const; |
146 void SetTextData(const CFX_WideString& wsText); | 146 void SetTextData(const CFX_WideString& wsText); |
147 | 147 |
148 CFX_WideString m_wsTag; | 148 CFX_WideString m_wsTag; |
149 CFX_WideStringArray m_Attributes; | 149 CFX_WideStringArray m_Attributes; |
150 }; | 150 }; |
151 | 151 |
152 class CFDE_XMLText : public CFDE_XMLNode { | 152 class CFDE_XMLText : public CFDE_XMLNode { |
153 public: | 153 public: |
154 CFDE_XMLText(const CFX_WideString& wsText); | 154 explicit CFDE_XMLText(const CFX_WideString& wsText); |
155 ~CFDE_XMLText() override {} | 155 ~CFDE_XMLText() override; |
156 | 156 |
157 // CFDE_XMLNode | 157 // CFDE_XMLNode |
158 void Release() override { delete this; } | 158 void Release() override; |
159 FDE_XMLNODETYPE GetType() const override { return FDE_XMLNODE_Text; } | 159 FDE_XMLNODETYPE GetType() const override; |
160 CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; | 160 CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; |
161 | 161 |
162 void GetText(CFX_WideString& wsText) const { wsText = m_wsText; } | 162 void GetText(CFX_WideString& wsText) const { wsText = m_wsText; } |
163 void SetText(const CFX_WideString& wsText) { m_wsText = wsText; } | 163 void SetText(const CFX_WideString& wsText) { m_wsText = wsText; } |
164 | 164 |
165 CFX_WideString m_wsText; | 165 CFX_WideString m_wsText; |
166 }; | 166 }; |
167 | 167 |
168 class CFDE_XMLDeclaration : public CFDE_XMLNode { | 168 class CFDE_XMLDeclaration : public CFDE_XMLNode { |
169 public: | 169 public: |
170 CFDE_XMLDeclaration() : CFDE_XMLNode() {} | 170 CFDE_XMLDeclaration() {} |
171 ~CFDE_XMLDeclaration() override {} | 171 ~CFDE_XMLDeclaration() override {} |
172 }; | 172 }; |
173 | 173 |
174 class CFDE_XMLCharData : public CFDE_XMLDeclaration { | 174 class CFDE_XMLCharData : public CFDE_XMLDeclaration { |
175 public: | 175 public: |
176 CFDE_XMLCharData(const CFX_WideString& wsCData); | 176 explicit CFDE_XMLCharData(const CFX_WideString& wsCData); |
177 ~CFDE_XMLCharData() override {} | 177 ~CFDE_XMLCharData() override; |
178 | 178 |
179 void Release() override { delete this; } | 179 void Release() override; |
180 FDE_XMLNODETYPE GetType() const override { return FDE_XMLNODE_CharData; } | 180 FDE_XMLNODETYPE GetType() const override; |
181 CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; | 181 CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; |
182 | 182 |
183 void GetCharData(CFX_WideString& wsCharData) const { | 183 void GetCharData(CFX_WideString& wsCharData) const { |
184 wsCharData = m_wsCharData; | 184 wsCharData = m_wsCharData; |
185 } | 185 } |
186 void SetCharData(const CFX_WideString& wsCData) { m_wsCharData = wsCData; } | 186 void SetCharData(const CFX_WideString& wsCData) { m_wsCharData = wsCData; } |
187 | 187 |
188 CFX_WideString m_wsCharData; | 188 CFX_WideString m_wsCharData; |
189 }; | 189 }; |
190 | 190 |
(...skipping 24 matching lines...) Expand all Loading... |
215 class CFDE_XMLParser { | 215 class CFDE_XMLParser { |
216 public: | 216 public: |
217 virtual ~CFDE_XMLParser() {} | 217 virtual ~CFDE_XMLParser() {} |
218 | 218 |
219 virtual void Release() = 0; | 219 virtual void Release() = 0; |
220 virtual int32_t DoParser(IFX_Pause* pPause) = 0; | 220 virtual int32_t DoParser(IFX_Pause* pPause) = 0; |
221 }; | 221 }; |
222 | 222 |
223 class CFDE_BlockBuffer : public CFX_Target { | 223 class CFDE_BlockBuffer : public CFX_Target { |
224 public: | 224 public: |
225 CFDE_BlockBuffer(int32_t iAllocStep = 1024 * 1024); | 225 explicit CFDE_BlockBuffer(int32_t iAllocStep = 1024 * 1024); |
226 ~CFDE_BlockBuffer(); | 226 ~CFDE_BlockBuffer() override; |
227 | 227 |
228 FX_BOOL InitBuffer(int32_t iBufferSize = 1024 * 1024); | 228 FX_BOOL InitBuffer(int32_t iBufferSize = 1024 * 1024); |
229 FX_BOOL IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; } | 229 FX_BOOL IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; } |
230 void ReleaseBuffer() { delete this; } | 230 void ReleaseBuffer() { delete this; } |
231 FX_WCHAR* GetAvailableBlock(int32_t& iIndexInBlock); | 231 FX_WCHAR* GetAvailableBlock(int32_t& iIndexInBlock); |
232 inline int32_t GetAllocStep() const { return m_iAllocStep; } | 232 inline int32_t GetAllocStep() const { return m_iAllocStep; } |
233 inline int32_t& GetDataLengthRef() { return m_iDataLength; } | 233 inline int32_t& GetDataLengthRef() { return m_iDataLength; } |
234 inline void Reset(FX_BOOL bReserveData = TRUE) { | 234 inline void Reset(FX_BOOL bReserveData = TRUE) { |
235 if (!bReserveData) { | 235 if (!bReserveData) { |
236 m_iStartPosition = 0; | 236 m_iStartPosition = 0; |
(...skipping 15 matching lines...) Expand all Loading... |
252 CFX_ArrayTemplate<FX_WCHAR*> m_BlockArray; | 252 CFX_ArrayTemplate<FX_WCHAR*> m_BlockArray; |
253 int32_t m_iDataLength; | 253 int32_t m_iDataLength; |
254 int32_t m_iBufferSize; | 254 int32_t m_iBufferSize; |
255 int32_t m_iAllocStep; | 255 int32_t m_iAllocStep; |
256 int32_t m_iStartPosition; | 256 int32_t m_iStartPosition; |
257 }; | 257 }; |
258 | 258 |
259 class CFDE_XMLSyntaxParser : public CFX_Target { | 259 class CFDE_XMLSyntaxParser : public CFX_Target { |
260 public: | 260 public: |
261 CFDE_XMLSyntaxParser(); | 261 CFDE_XMLSyntaxParser(); |
262 ~CFDE_XMLSyntaxParser(); | 262 ~CFDE_XMLSyntaxParser() override; |
263 | 263 |
264 void Release() { delete this; } | 264 void Release() { delete this; } |
265 void Init(IFX_Stream* pStream, | 265 void Init(IFX_Stream* pStream, |
266 int32_t iXMLPlaneSize, | 266 int32_t iXMLPlaneSize, |
267 int32_t iTextDataSize = 256); | 267 int32_t iTextDataSize = 256); |
268 | 268 |
269 FDE_XmlSyntaxResult DoSyntaxParse(); | 269 FDE_XmlSyntaxResult DoSyntaxParse(); |
270 | 270 |
271 int32_t GetStatus() const; | 271 int32_t GetStatus() const; |
272 int32_t GetCurrentPos() const { | 272 int32_t GetCurrentPos() const { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 int32_t m_iTextDataLength; | 343 int32_t m_iTextDataLength; |
344 FDE_XmlSyntaxResult m_syntaxParserResult; | 344 FDE_XmlSyntaxResult m_syntaxParserResult; |
345 FDE_XmlSyntaxState m_syntaxParserState; | 345 FDE_XmlSyntaxState m_syntaxParserState; |
346 FX_WCHAR m_wQuotationMark; | 346 FX_WCHAR m_wQuotationMark; |
347 int32_t m_iEntityStart; | 347 int32_t m_iEntityStart; |
348 CFX_DWordStack m_SkipStack; | 348 CFX_DWordStack m_SkipStack; |
349 FX_WCHAR m_SkipChar; | 349 FX_WCHAR m_SkipChar; |
350 }; | 350 }; |
351 | 351 |
352 #endif // XFA_FDE_XML_FDE_XML_IMP_H_ | 352 #endif // XFA_FDE_XML_FDE_XML_IMP_H_ |
OLD | NEW |