| 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_FXFA_PARSER_XFA_PARSER_IMP_H_ | 7 #ifndef XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ |
| 8 #define XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ | 8 #define XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "xfa/fde/xml/fde_xml_imp.h" | 12 #include "xfa/fde/xml/fde_xml_imp.h" |
| 11 #include "xfa/fxfa/parser/xfa_parser.h" | 13 #include "xfa/fxfa/parser/xfa_parser.h" |
| 12 | 14 |
| 13 class CXFA_XMLParser; | 15 class CXFA_XMLParser; |
| 14 | 16 |
| 15 class CXFA_SimpleParser : public IXFA_Parser { | 17 class CXFA_SimpleParser final : public IXFA_Parser { |
| 16 public: | 18 public: |
| 17 CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); | 19 CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); |
| 18 ~CXFA_SimpleParser() override; | 20 ~CXFA_SimpleParser() override; |
| 19 | 21 |
| 20 void Release() override { delete this; } | |
| 21 | |
| 22 int32_t StartParse(IFX_FileRead* pStream, | 22 int32_t StartParse(IFX_FileRead* pStream, |
| 23 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; | 23 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; |
| 24 int32_t DoParse(IFX_Pause* pPause = NULL) override; | 24 int32_t DoParse(IFX_Pause* pPause = NULL) override; |
| 25 int32_t ParseXMLData(const CFX_WideString& wsXML, | 25 int32_t ParseXMLData(const CFX_WideString& wsXML, |
| 26 CFDE_XMLNode*& pXMLNode, | 26 CFDE_XMLNode*& pXMLNode, |
| 27 IFX_Pause* pPause = NULL) override; | 27 IFX_Pause* pPause = NULL) override; |
| 28 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; | 28 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; |
| 29 CXFA_Document* GetFactory() const override { return m_pFactory; } | 29 CXFA_Document* GetFactory() const override { return m_pFactory; } |
| 30 CXFA_Node* GetRootNode() const override { return m_pRootNode; } | 30 CXFA_Node* GetRootNode() const override { return m_pRootNode; } |
| 31 CFDE_XMLDoc* GetXMLDoc() const override { return m_pXMLDoc; } | 31 CFDE_XMLDoc* GetXMLDoc() const override { return m_pXMLDoc; } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 CFDE_XMLDoc* m_pXMLDoc; | 75 CFDE_XMLDoc* m_pXMLDoc; |
| 76 IFX_Stream* m_pStream; | 76 IFX_Stream* m_pStream; |
| 77 IFX_FileRead* m_pFileRead; | 77 IFX_FileRead* m_pFileRead; |
| 78 CXFA_Document* m_pFactory; | 78 CXFA_Document* m_pFactory; |
| 79 CXFA_Node* m_pRootNode; | 79 CXFA_Node* m_pRootNode; |
| 80 XFA_XDPPACKET m_ePacketID; | 80 XFA_XDPPACKET m_ePacketID; |
| 81 FX_BOOL m_bDocumentParser; | 81 FX_BOOL m_bDocumentParser; |
| 82 friend class CXFA_DocumentParser; | 82 friend class CXFA_DocumentParser; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class CXFA_DocumentParser : public IXFA_Parser { | 85 class CXFA_DocumentParser final : public IXFA_Parser { |
| 86 public: | 86 public: |
| 87 CXFA_DocumentParser(CXFA_FFNotify* pNotify); | 87 CXFA_DocumentParser(CXFA_FFNotify* pNotify); |
| 88 ~CXFA_DocumentParser() override; | 88 ~CXFA_DocumentParser() override; |
| 89 | 89 |
| 90 void Release() override { delete this; } | |
| 91 int32_t StartParse(IFX_FileRead* pStream, | 90 int32_t StartParse(IFX_FileRead* pStream, |
| 92 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; | 91 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; |
| 93 int32_t DoParse(IFX_Pause* pPause = NULL) override; | 92 int32_t DoParse(IFX_Pause* pPause = NULL) override; |
| 94 int32_t ParseXMLData(const CFX_WideString& wsXML, | 93 int32_t ParseXMLData(const CFX_WideString& wsXML, |
| 95 CFDE_XMLNode*& pXMLNode, | 94 CFDE_XMLNode*& pXMLNode, |
| 96 IFX_Pause* pPause = NULL) override; | 95 IFX_Pause* pPause = NULL) override; |
| 97 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; | 96 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; |
| 98 CXFA_Document* GetFactory() const override { | 97 CXFA_Document* GetFactory() const override { |
| 99 return m_nodeParser.GetFactory(); | 98 return m_nodeParser.GetFactory(); |
| 100 } | 99 } |
| 101 CXFA_Node* GetRootNode() const override { return m_nodeParser.GetRootNode(); } | 100 CXFA_Node* GetRootNode() const override { return m_nodeParser.GetRootNode(); } |
| 102 CFDE_XMLDoc* GetXMLDoc() const override { return m_nodeParser.GetXMLDoc(); } | 101 CFDE_XMLDoc* GetXMLDoc() const override { return m_nodeParser.GetXMLDoc(); } |
| 103 CXFA_FFNotify* GetNotify() const { return m_pNotify; } | 102 CXFA_FFNotify* GetNotify() const { return m_pNotify; } |
| 104 CXFA_Document* GetDocument() const { return m_pDocument; } | 103 CXFA_Document* GetDocument() const { return m_pDocument; } |
| 105 void CloseParser() override; | 104 void CloseParser() override; |
| 106 | 105 |
| 107 protected: | 106 protected: |
| 108 CXFA_SimpleParser m_nodeParser; | 107 CXFA_SimpleParser m_nodeParser; |
| 109 CXFA_FFNotify* m_pNotify; | 108 CXFA_FFNotify* m_pNotify; |
| 110 CXFA_Document* m_pDocument; | 109 CXFA_Document* m_pDocument; |
| 111 }; | 110 }; |
| 112 typedef CFX_StackTemplate<CFDE_XMLNode*> CXFA_XMLNodeStack; | 111 typedef CFX_StackTemplate<CFDE_XMLNode*> CXFA_XMLNodeStack; |
| 113 | 112 |
| 114 class CXFA_XMLParser : public CFDE_XMLParser { | 113 class CXFA_XMLParser : public IFDE_XMLParser { |
| 115 public: | 114 public: |
| 116 CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream); | 115 CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream); |
| 117 ~CXFA_XMLParser(); | 116 ~CXFA_XMLParser() override; |
| 118 | 117 |
| 119 virtual void Release() { delete this; } | 118 int32_t DoParser(IFX_Pause* pPause) override; |
| 120 virtual int32_t DoParser(IFX_Pause* pPause); | |
| 121 | 119 |
| 122 FX_FILESIZE m_nStart[2]; | 120 FX_FILESIZE m_nStart[2]; |
| 123 size_t m_nSize[2]; | 121 size_t m_nSize[2]; |
| 124 FX_FILESIZE m_nElementStart; | 122 FX_FILESIZE m_nElementStart; |
| 125 uint16_t m_dwCheckStatus; | 123 uint16_t m_dwCheckStatus; |
| 126 uint16_t m_dwCurrentCheckStatus; | 124 uint16_t m_dwCurrentCheckStatus; |
| 127 | 125 |
| 128 protected: | 126 protected: |
| 129 CFDE_XMLNode* m_pRoot; | 127 CFDE_XMLNode* m_pRoot; |
| 130 IFX_Stream* m_pStream; | 128 IFX_Stream* m_pStream; |
| 131 CFDE_XMLSyntaxParser* m_pParser; | 129 std::unique_ptr<CFDE_XMLSyntaxParser> m_pParser; |
| 132 CFDE_XMLNode* m_pParent; | 130 CFDE_XMLNode* m_pParent; |
| 133 CFDE_XMLNode* m_pChild; | 131 CFDE_XMLNode* m_pChild; |
| 134 CXFA_XMLNodeStack m_NodeStack; | 132 CXFA_XMLNodeStack m_NodeStack; |
| 135 CFX_WideString m_ws1; | 133 CFX_WideString m_ws1; |
| 136 CFX_WideString m_ws2; | 134 CFX_WideString m_ws2; |
| 137 FDE_XmlSyntaxResult m_syntaxParserResult; | 135 FDE_XmlSyntaxResult m_syntaxParserResult; |
| 138 }; | 136 }; |
| 139 | 137 |
| 140 #endif // XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ | 138 #endif // XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ |
| OLD | NEW |