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/fx_system.h" | 10 #include "core/fxcrt/fx_system.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 bool bQualifiedName = true) const; | 59 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 bool InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode); | 63 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(IFGAS_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 explicit CFDE_XMLInstruction(const CFX_WideString& wsTarget); | 76 explicit CFDE_XMLInstruction(const CFX_WideString& wsTarget); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 class CFDE_XMLDoc : public CFX_Target { | 191 class CFDE_XMLDoc : public CFX_Target { |
192 public: | 192 public: |
193 CFDE_XMLDoc(); | 193 CFDE_XMLDoc(); |
194 ~CFDE_XMLDoc() override; | 194 ~CFDE_XMLDoc() override; |
195 | 195 |
196 bool LoadXML(CFDE_XMLParser* pXMLParser); | 196 bool LoadXML(CFDE_XMLParser* pXMLParser); |
197 int32_t DoLoad(IFX_Pause* pPause = nullptr); | 197 int32_t DoLoad(IFX_Pause* pPause = nullptr); |
198 void CloseXML(); | 198 void CloseXML(); |
199 CFDE_XMLNode* GetRoot() const { return m_pRoot; } | 199 CFDE_XMLNode* GetRoot() const { return m_pRoot; } |
200 void SaveXML(IFX_Stream* pXMLStream = nullptr, bool bSaveBOM = true); | 200 void SaveXML(IFGAS_Stream* pXMLStream = nullptr, bool bSaveBOM = true); |
201 void SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pNode); | 201 void SaveXMLNode(IFGAS_Stream* pXMLStream, CFDE_XMLNode* pNode); |
202 | 202 |
203 protected: | 203 protected: |
204 void Reset(bool bInitRoot); | 204 void Reset(bool bInitRoot); |
205 void ReleaseParser(); | 205 void ReleaseParser(); |
206 | 206 |
207 IFX_Stream* m_pStream; | 207 IFGAS_Stream* m_pStream; |
208 int32_t m_iStatus; | 208 int32_t m_iStatus; |
209 CFDE_XMLNode* m_pRoot; | 209 CFDE_XMLNode* m_pRoot; |
210 CFDE_XMLSyntaxParser* m_pSyntaxParser; | 210 CFDE_XMLSyntaxParser* m_pSyntaxParser; |
211 CFDE_XMLParser* m_pXMLParser; | 211 CFDE_XMLParser* m_pXMLParser; |
212 }; | 212 }; |
213 | 213 |
214 class CFDE_XMLParser { | 214 class CFDE_XMLParser { |
215 public: | 215 public: |
216 virtual ~CFDE_XMLParser() {} | 216 virtual ~CFDE_XMLParser() {} |
217 | 217 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 int32_t m_iAllocStep; | 254 int32_t m_iAllocStep; |
255 int32_t m_iStartPosition; | 255 int32_t m_iStartPosition; |
256 }; | 256 }; |
257 | 257 |
258 class CFDE_XMLSyntaxParser : public CFX_Target { | 258 class CFDE_XMLSyntaxParser : public CFX_Target { |
259 public: | 259 public: |
260 CFDE_XMLSyntaxParser(); | 260 CFDE_XMLSyntaxParser(); |
261 ~CFDE_XMLSyntaxParser() override; | 261 ~CFDE_XMLSyntaxParser() override; |
262 | 262 |
263 void Release() { delete this; } | 263 void Release() { delete this; } |
264 void Init(IFX_Stream* pStream, | 264 void Init(IFGAS_Stream* pStream, |
265 int32_t iXMLPlaneSize, | 265 int32_t iXMLPlaneSize, |
266 int32_t iTextDataSize = 256); | 266 int32_t iTextDataSize = 256); |
267 | 267 |
268 FDE_XmlSyntaxResult DoSyntaxParse(); | 268 FDE_XmlSyntaxResult DoSyntaxParse(); |
269 | 269 |
270 int32_t GetStatus() const; | 270 int32_t GetStatus() const; |
271 int32_t GetCurrentPos() const { | 271 int32_t GetCurrentPos() const { |
272 return m_iParsedChars + (m_pStart - m_pBuffer); | 272 return m_iParsedChars + (m_pStart - m_pBuffer); |
273 } | 273 } |
274 FX_FILESIZE GetCurrentBinaryPos() const; | 274 FX_FILESIZE GetCurrentBinaryPos() const; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 SkipDeclNode, | 313 SkipDeclNode, |
314 DeclCharData, | 314 DeclCharData, |
315 SkipComment, | 315 SkipComment, |
316 SkipCommentOrDecl, | 316 SkipCommentOrDecl, |
317 SkipCData, | 317 SkipCData, |
318 TargetData | 318 TargetData |
319 }; | 319 }; |
320 | 320 |
321 void ParseTextChar(FX_WCHAR ch); | 321 void ParseTextChar(FX_WCHAR ch); |
322 | 322 |
323 IFX_Stream* m_pStream; | 323 IFGAS_Stream* m_pStream; |
324 int32_t m_iXMLPlaneSize; | 324 int32_t m_iXMLPlaneSize; |
325 int32_t m_iCurrentPos; | 325 int32_t m_iCurrentPos; |
326 int32_t m_iCurrentNodeNum; | 326 int32_t m_iCurrentNodeNum; |
327 int32_t m_iLastNodeNum; | 327 int32_t m_iLastNodeNum; |
328 int32_t m_iParsedChars; | 328 int32_t m_iParsedChars; |
329 int32_t m_iParsedBytes; | 329 int32_t m_iParsedBytes; |
330 FX_WCHAR* m_pBuffer; | 330 FX_WCHAR* m_pBuffer; |
331 int32_t m_iBufferChars; | 331 int32_t m_iBufferChars; |
332 bool m_bEOS; | 332 bool m_bEOS; |
333 FX_WCHAR* m_pStart; | 333 FX_WCHAR* m_pStart; |
334 FX_WCHAR* m_pEnd; | 334 FX_WCHAR* m_pEnd; |
335 FDE_XMLNODE m_CurNode; | 335 FDE_XMLNODE m_CurNode; |
336 CFX_StackTemplate<FDE_XMLNODE> m_XMLNodeStack; | 336 CFX_StackTemplate<FDE_XMLNODE> m_XMLNodeStack; |
337 CFDE_BlockBuffer m_BlockBuffer; | 337 CFDE_BlockBuffer m_BlockBuffer; |
338 int32_t m_iAllocStep; | 338 int32_t m_iAllocStep; |
339 int32_t& m_iDataLength; | 339 int32_t& m_iDataLength; |
340 FX_WCHAR* m_pCurrentBlock; | 340 FX_WCHAR* m_pCurrentBlock; |
341 int32_t m_iIndexInBlock; | 341 int32_t m_iIndexInBlock; |
342 int32_t m_iTextDataLength; | 342 int32_t m_iTextDataLength; |
343 FDE_XmlSyntaxResult m_syntaxParserResult; | 343 FDE_XmlSyntaxResult m_syntaxParserResult; |
344 FDE_XmlSyntaxState m_syntaxParserState; | 344 FDE_XmlSyntaxState m_syntaxParserState; |
345 FX_WCHAR m_wQuotationMark; | 345 FX_WCHAR m_wQuotationMark; |
346 int32_t m_iEntityStart; | 346 int32_t m_iEntityStart; |
347 CFX_StackTemplate<uint32_t> m_SkipStack; | 347 CFX_StackTemplate<uint32_t> m_SkipStack; |
348 FX_WCHAR m_SkipChar; | 348 FX_WCHAR m_SkipChar; |
349 }; | 349 }; |
350 | 350 |
351 #endif // XFA_FDE_XML_FDE_XML_IMP_H_ | 351 #endif // XFA_FDE_XML_FDE_XML_IMP_H_ |
OLD | NEW |