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/parser/xfa_parser.h" |
12 | 12 |
13 class CXFA_XMLParser; | 13 class CXFA_XMLParser; |
14 | 14 |
15 class CXFA_SimpleParser : public IXFA_Parser { | 15 class CXFA_SimpleParser : public IXFA_Parser { |
16 public: | 16 public: |
17 CXFA_SimpleParser(IXFA_ObjFactory* pFactory, FX_BOOL bDocumentParser = FALSE); | 17 CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); |
18 ~CXFA_SimpleParser(); | 18 ~CXFA_SimpleParser() override; |
19 virtual void Release() { delete this; } | |
20 | 19 |
21 virtual int32_t StartParse(IFX_FileRead* pStream, | 20 void Release() override { delete this; } |
22 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); | 21 |
23 virtual int32_t DoParse(IFX_Pause* pPause = NULL); | 22 int32_t StartParse(IFX_FileRead* pStream, |
24 virtual int32_t ParseXMLData(const CFX_WideString& wsXML, | 23 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; |
25 CFDE_XMLNode*& pXMLNode, | 24 int32_t DoParse(IFX_Pause* pPause = NULL) override; |
26 IFX_Pause* pPause = NULL); | 25 int32_t ParseXMLData(const CFX_WideString& wsXML, |
27 virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); | 26 CFDE_XMLNode*& pXMLNode, |
28 virtual IXFA_ObjFactory* GetFactory() const { return m_pFactory; } | 27 IFX_Pause* pPause = NULL) override; |
29 virtual CXFA_Node* GetRootNode() const { return m_pRootNode; } | 28 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; |
30 virtual CFDE_XMLDoc* GetXMLDoc() const { return m_pXMLDoc; } | 29 CXFA_Document* GetFactory() const override { return m_pFactory; } |
31 virtual void CloseParser(); | 30 CXFA_Node* GetRootNode() const override { return m_pRootNode; } |
| 31 CFDE_XMLDoc* GetXMLDoc() const override { return m_pXMLDoc; } |
| 32 void CloseParser() override; |
32 | 33 |
33 protected: | 34 protected: |
34 CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, | 35 CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, |
35 XFA_XDPPACKET ePacketID); | 36 XFA_XDPPACKET ePacketID); |
36 CXFA_Node* ParseAsXDPPacket_XDP(CFDE_XMLNode* pXMLDocumentNode, | 37 CXFA_Node* ParseAsXDPPacket_XDP(CFDE_XMLNode* pXMLDocumentNode, |
37 XFA_XDPPACKET ePacketID); | 38 XFA_XDPPACKET ePacketID); |
38 CXFA_Node* ParseAsXDPPacket_Config(CFDE_XMLNode* pXMLDocumentNode, | 39 CXFA_Node* ParseAsXDPPacket_Config(CFDE_XMLNode* pXMLDocumentNode, |
39 XFA_XDPPACKET ePacketID); | 40 XFA_XDPPACKET ePacketID); |
40 CXFA_Node* ParseAsXDPPacket_TemplateForm(CFDE_XMLNode* pXMLDocumentNode, | 41 CXFA_Node* ParseAsXDPPacket_TemplateForm(CFDE_XMLNode* pXMLDocumentNode, |
41 XFA_XDPPACKET ePacketID); | 42 XFA_XDPPACKET ePacketID); |
(...skipping 19 matching lines...) Expand all Loading... |
61 XFA_XDPPACKET ePacketID); | 62 XFA_XDPPACKET ePacketID); |
62 void ParseDataValue(CXFA_Node* pXFANode, | 63 void ParseDataValue(CXFA_Node* pXFANode, |
63 CFDE_XMLNode* pXMLNode, | 64 CFDE_XMLNode* pXMLNode, |
64 XFA_XDPPACKET ePacketID); | 65 XFA_XDPPACKET ePacketID); |
65 void ParseDataGroup(CXFA_Node* pXFANode, | 66 void ParseDataGroup(CXFA_Node* pXFANode, |
66 CFDE_XMLNode* pXMLNode, | 67 CFDE_XMLNode* pXMLNode, |
67 XFA_XDPPACKET ePacketID); | 68 XFA_XDPPACKET ePacketID); |
68 void ParseInstruction(CXFA_Node* pXFANode, | 69 void ParseInstruction(CXFA_Node* pXFANode, |
69 CFDE_XMLInstruction* pXMLInstruction, | 70 CFDE_XMLInstruction* pXMLInstruction, |
70 XFA_XDPPACKET ePacketID); | 71 XFA_XDPPACKET ePacketID); |
71 void SetFactory(IXFA_ObjFactory* pFactory); | 72 void SetFactory(CXFA_Document* pFactory); |
72 | 73 |
73 CXFA_XMLParser* m_pXMLParser; | 74 CXFA_XMLParser* m_pXMLParser; |
74 CFDE_XMLDoc* m_pXMLDoc; | 75 CFDE_XMLDoc* m_pXMLDoc; |
75 IFX_Stream* m_pStream; | 76 IFX_Stream* m_pStream; |
76 IFX_FileRead* m_pFileRead; | 77 IFX_FileRead* m_pFileRead; |
77 IXFA_ObjFactory* m_pFactory; | 78 CXFA_Document* m_pFactory; |
78 CXFA_Node* m_pRootNode; | 79 CXFA_Node* m_pRootNode; |
79 XFA_XDPPACKET m_ePacketID; | 80 XFA_XDPPACKET m_ePacketID; |
80 FX_BOOL m_bDocumentParser; | 81 FX_BOOL m_bDocumentParser; |
81 friend class CXFA_DocumentParser; | 82 friend class CXFA_DocumentParser; |
82 }; | 83 }; |
83 | 84 |
84 class CXFA_DocumentParser : public IXFA_DocParser { | 85 class CXFA_DocumentParser : public IXFA_Parser { |
85 public: | 86 public: |
86 CXFA_DocumentParser(IXFA_Notify* pNotify); | 87 CXFA_DocumentParser(CXFA_FFNotify* pNotify); |
87 ~CXFA_DocumentParser(); | 88 ~CXFA_DocumentParser() override; |
88 virtual void Release() { delete this; } | 89 |
89 virtual int32_t StartParse(IFX_FileRead* pStream, | 90 void Release() override { delete this; } |
90 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP); | 91 int32_t StartParse(IFX_FileRead* pStream, |
91 virtual int32_t DoParse(IFX_Pause* pPause = NULL); | 92 XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; |
92 virtual int32_t ParseXMLData(const CFX_WideString& wsXML, | 93 int32_t DoParse(IFX_Pause* pPause = NULL) override; |
93 CFDE_XMLNode*& pXMLNode, | 94 int32_t ParseXMLData(const CFX_WideString& wsXML, |
94 IFX_Pause* pPause = NULL); | 95 CFDE_XMLNode*& pXMLNode, |
95 virtual void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); | 96 IFX_Pause* pPause = NULL) override; |
96 virtual IXFA_ObjFactory* GetFactory() const { | 97 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; |
| 98 CXFA_Document* GetFactory() const override { |
97 return m_nodeParser.GetFactory(); | 99 return m_nodeParser.GetFactory(); |
98 } | 100 } |
99 virtual CXFA_Node* GetRootNode() const { return m_nodeParser.GetRootNode(); } | 101 CXFA_Node* GetRootNode() const override { return m_nodeParser.GetRootNode(); } |
100 virtual CFDE_XMLDoc* GetXMLDoc() const { return m_nodeParser.GetXMLDoc(); } | 102 CFDE_XMLDoc* GetXMLDoc() const override { return m_nodeParser.GetXMLDoc(); } |
101 virtual IXFA_Notify* GetNotify() const { return m_pNotify; } | 103 CXFA_FFNotify* GetNotify() const { return m_pNotify; } |
102 virtual CXFA_Document* GetDocument() const { return m_pDocument; } | 104 CXFA_Document* GetDocument() const { return m_pDocument; } |
103 virtual void CloseParser(); | 105 void CloseParser() override; |
104 | 106 |
105 protected: | 107 protected: |
106 CXFA_SimpleParser m_nodeParser; | 108 CXFA_SimpleParser m_nodeParser; |
107 IXFA_Notify* m_pNotify; | 109 CXFA_FFNotify* m_pNotify; |
108 CXFA_Document* m_pDocument; | 110 CXFA_Document* m_pDocument; |
109 }; | 111 }; |
110 typedef CFX_StackTemplate<CFDE_XMLNode*> CXFA_XMLNodeStack; | 112 typedef CFX_StackTemplate<CFDE_XMLNode*> CXFA_XMLNodeStack; |
111 | 113 |
112 class CXFA_XMLParser : public CFDE_XMLParser { | 114 class CXFA_XMLParser : public CFDE_XMLParser { |
113 public: | 115 public: |
114 CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream); | 116 CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream); |
115 ~CXFA_XMLParser(); | 117 ~CXFA_XMLParser(); |
116 | 118 |
117 virtual void Release() { delete this; } | 119 virtual void Release() { delete this; } |
(...skipping 11 matching lines...) Expand all Loading... |
129 CFDE_XMLSyntaxParser* m_pParser; | 131 CFDE_XMLSyntaxParser* m_pParser; |
130 CFDE_XMLNode* m_pParent; | 132 CFDE_XMLNode* m_pParent; |
131 CFDE_XMLNode* m_pChild; | 133 CFDE_XMLNode* m_pChild; |
132 CXFA_XMLNodeStack m_NodeStack; | 134 CXFA_XMLNodeStack m_NodeStack; |
133 CFX_WideString m_ws1; | 135 CFX_WideString m_ws1; |
134 CFX_WideString m_ws2; | 136 CFX_WideString m_ws2; |
135 uint32_t m_dwStatus; | 137 uint32_t m_dwStatus; |
136 }; | 138 }; |
137 | 139 |
138 #endif // XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ | 140 #endif // XFA_FXFA_PARSER_XFA_PARSER_IMP_H_ |
OLD | NEW |