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 "xfa/fde/xml/fde_xml_imp.h" | 10 #include "xfa/fde/xml/fde_xml_imp.h" |
11 #include "xfa/fxfa/parser/xfa_parser.h" | 11 #include "xfa/fxfa/include/fxfa_basic.h" |
12 | 12 |
| 13 class CXFA_Document; |
| 14 class CXFA_FFNotify; |
| 15 class CXFA_Node; |
13 class CXFA_XMLParser; | 16 class CXFA_XMLParser; |
14 | 17 |
15 class CXFA_SimpleParser : public IXFA_Parser { | 18 class CXFA_SimpleParser { |
16 public: | 19 public: |
17 CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); | 20 CXFA_SimpleParser(CXFA_Document* pFactory, bool bDocumentParser); |
18 ~CXFA_SimpleParser() override; | 21 ~CXFA_SimpleParser(); |
19 | 22 |
20 // IXFA_Parser | |
21 void Release() override; | |
22 int32_t StartParse(IFX_FileRead* pStream, | 23 int32_t StartParse(IFX_FileRead* pStream, |
23 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; | 24 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); |
24 int32_t DoParse(IFX_Pause* pPause = nullptr) override; | 25 int32_t DoParse(IFX_Pause* pPause = nullptr); |
25 int32_t ParseXMLData(const CFX_WideString& wsXML, | 26 int32_t ParseXMLData(const CFX_WideString& wsXML, |
26 CFDE_XMLNode*& pXMLNode, | 27 CFDE_XMLNode*& pXMLNode, |
27 IFX_Pause* pPause = nullptr) override; | 28 IFX_Pause* pPause = nullptr); |
28 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; | 29 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); |
29 CXFA_Document* GetFactory() const override; | 30 CXFA_Node* GetRootNode() const; |
30 CXFA_Node* GetRootNode() const override; | 31 CFDE_XMLDoc* GetXMLDoc() const; |
31 CFDE_XMLDoc* GetXMLDoc() const override; | 32 void CloseParser(); |
32 void CloseParser() override; | |
33 | 33 |
34 protected: | 34 protected: |
35 CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, | 35 CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, |
36 XFA_XDPPACKET ePacketID); | 36 XFA_XDPPACKET ePacketID); |
37 CXFA_Node* ParseAsXDPPacket_XDP(CFDE_XMLNode* pXMLDocumentNode, | 37 CXFA_Node* ParseAsXDPPacket_XDP(CFDE_XMLNode* pXMLDocumentNode, |
38 XFA_XDPPACKET ePacketID); | 38 XFA_XDPPACKET ePacketID); |
39 CXFA_Node* ParseAsXDPPacket_Config(CFDE_XMLNode* pXMLDocumentNode, | 39 CXFA_Node* ParseAsXDPPacket_Config(CFDE_XMLNode* pXMLDocumentNode, |
40 XFA_XDPPACKET ePacketID); | 40 XFA_XDPPACKET ePacketID); |
41 CXFA_Node* ParseAsXDPPacket_TemplateForm(CFDE_XMLNode* pXMLDocumentNode, | 41 CXFA_Node* ParseAsXDPPacket_TemplateForm(CFDE_XMLNode* pXMLDocumentNode, |
42 XFA_XDPPACKET ePacketID); | 42 XFA_XDPPACKET ePacketID); |
(...skipping 32 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 { |
86 public: | 86 public: |
87 CXFA_DocumentParser(CXFA_FFNotify* pNotify); | 87 explicit CXFA_DocumentParser(CXFA_FFNotify* pNotify); |
88 ~CXFA_DocumentParser() override; | 88 ~CXFA_DocumentParser(); |
89 | 89 |
90 // IXFA_Parser | |
91 void Release() override; | |
92 int32_t StartParse(IFX_FileRead* pStream, | 90 int32_t StartParse(IFX_FileRead* pStream, |
93 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; | 91 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); |
94 int32_t DoParse(IFX_Pause* pPause = nullptr) override; | 92 int32_t DoParse(IFX_Pause* pPause = nullptr); |
95 int32_t ParseXMLData(const CFX_WideString& wsXML, | 93 |
96 CFDE_XMLNode*& pXMLNode, | 94 CFDE_XMLDoc* GetXMLDoc() const; |
97 IFX_Pause* pPause = nullptr) override; | |
98 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; | |
99 CXFA_Document* GetFactory() const override; | |
100 CXFA_Node* GetRootNode() const override; | |
101 CFDE_XMLDoc* GetXMLDoc() const override; | |
102 CXFA_FFNotify* GetNotify() const; | 95 CXFA_FFNotify* GetNotify() const; |
103 CXFA_Document* GetDocument() const; | 96 CXFA_Document* GetDocument() const; |
104 void CloseParser() override; | 97 void CloseParser(); |
105 | 98 |
106 protected: | 99 protected: |
107 CXFA_SimpleParser m_nodeParser; | 100 CXFA_SimpleParser m_nodeParser; |
108 CXFA_FFNotify* m_pNotify; | 101 CXFA_FFNotify* m_pNotify; |
109 CXFA_Document* m_pDocument; | 102 std::unique_ptr<CXFA_Document> m_pDocument; |
110 }; | 103 }; |
111 | 104 |
112 class CXFA_XMLParser : public CFDE_XMLParser { | 105 class CXFA_XMLParser : public CFDE_XMLParser { |
113 public: | 106 public: |
114 CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream); | 107 CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream); |
115 ~CXFA_XMLParser() override; | 108 ~CXFA_XMLParser() override; |
116 | 109 |
117 // CFDE_XMLParser | 110 // CFDE_XMLParser |
118 void Release() override; | 111 void Release() override; |
119 int32_t DoParser(IFX_Pause* pPause) override; | 112 int32_t DoParser(IFX_Pause* pPause) override; |
(...skipping 10 matching lines...) Expand all Loading... |
130 CFDE_XMLSyntaxParser* m_pParser; | 123 CFDE_XMLSyntaxParser* m_pParser; |
131 CFDE_XMLNode* m_pParent; | 124 CFDE_XMLNode* m_pParent; |
132 CFDE_XMLNode* m_pChild; | 125 CFDE_XMLNode* m_pChild; |
133 CFX_StackTemplate<CFDE_XMLNode*> m_NodeStack; | 126 CFX_StackTemplate<CFDE_XMLNode*> m_NodeStack; |
134 CFX_WideString m_ws1; | 127 CFX_WideString m_ws1; |
135 CFX_WideString m_ws2; | 128 CFX_WideString m_ws2; |
136 FDE_XmlSyntaxResult m_syntaxParserResult; | 129 FDE_XmlSyntaxResult m_syntaxParserResult; |
137 }; | 130 }; |
138 | 131 |
139 #endif // XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ | 132 #endif // XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ |
OLD | NEW |