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_CXFA_SIMPLE_PARSER_H_ | 7 #ifndef XFA_FXFA_PARSER_CXFA_SIMPLE_PARSER_H_ |
8 #define XFA_FXFA_PARSER_CXFA_SIMPLE_PARSER_H_ | 8 #define XFA_FXFA_PARSER_CXFA_SIMPLE_PARSER_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "xfa/fde/xml/fde_xml_imp.h" | 12 #include "xfa/fde/xml/fde_xml_imp.h" |
13 #include "xfa/fxfa/include/fxfa_basic.h" | 13 #include "xfa/fxfa/include/fxfa_basic.h" |
14 | 14 |
15 class CXFA_Document; | 15 class CXFA_Document; |
16 class CXFA_Node; | 16 class CXFA_Node; |
17 class CXFA_XMLParser; | 17 class CXFA_XMLParser; |
18 class IFX_FileRead; | 18 class IFX_FileRead; |
19 class IFX_Pause; | 19 class IFX_Pause; |
20 class IFX_Stream; | 20 class IFX_Stream; |
21 | 21 |
22 class CXFA_SimpleParser { | 22 class CXFA_SimpleParser { |
23 public: | 23 public: |
24 CXFA_SimpleParser(CXFA_Document* pFactory, bool bDocumentParser); | 24 CXFA_SimpleParser(CXFA_Document* pFactory, bool bDocumentParser); |
25 ~CXFA_SimpleParser(); | 25 ~CXFA_SimpleParser(); |
26 | 26 |
27 int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID); | 27 int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID); |
28 int32_t DoParse(IFX_Pause* pPause = nullptr); | 28 int32_t DoParse(IFX_Pause* pPause); |
29 int32_t ParseXMLData(const CFX_WideString& wsXML, | 29 int32_t ParseXMLData(const CFX_WideString& wsXML, |
30 CFDE_XMLNode*& pXMLNode, | 30 CFDE_XMLNode*& pXMLNode, |
31 IFX_Pause* pPause = nullptr); | 31 IFX_Pause* pPause); |
32 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); | 32 void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode); |
33 CXFA_Node* GetRootNode() const; | 33 CXFA_Node* GetRootNode() const; |
34 CFDE_XMLDoc* GetXMLDoc() const; | 34 CFDE_XMLDoc* GetXMLDoc() const; |
35 void CloseParser(); | 35 void CloseParser(); |
36 | 36 |
37 void SetFactory(CXFA_Document* pFactory); | 37 void SetFactory(CXFA_Document* pFactory); |
38 | 38 |
39 private: | 39 private: |
40 CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, | 40 CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode, |
41 XFA_XDPPACKET ePacketID); | 41 XFA_XDPPACKET ePacketID); |
42 CXFA_Node* ParseAsXDPPacket_XDP(CFDE_XMLNode* pXMLDocumentNode, | 42 CXFA_Node* ParseAsXDPPacket_XDP(CFDE_XMLNode* pXMLDocumentNode, |
43 XFA_XDPPACKET ePacketID); | 43 XFA_XDPPACKET ePacketID); |
44 CXFA_Node* ParseAsXDPPacket_Config(CFDE_XMLNode* pXMLDocumentNode, | 44 CXFA_Node* ParseAsXDPPacket_Config(CFDE_XMLNode* pXMLDocumentNode, |
45 XFA_XDPPACKET ePacketID); | 45 XFA_XDPPACKET ePacketID); |
46 CXFA_Node* ParseAsXDPPacket_TemplateForm(CFDE_XMLNode* pXMLDocumentNode, | 46 CXFA_Node* ParseAsXDPPacket_TemplateForm(CFDE_XMLNode* pXMLDocumentNode, |
47 XFA_XDPPACKET ePacketID); | 47 XFA_XDPPACKET ePacketID); |
48 CXFA_Node* ParseAsXDPPacket_Data(CFDE_XMLNode* pXMLDocumentNode, | 48 CXFA_Node* ParseAsXDPPacket_Data(CFDE_XMLNode* pXMLDocumentNode, |
49 XFA_XDPPACKET ePacketID); | 49 XFA_XDPPACKET ePacketID); |
50 CXFA_Node* ParseAsXDPPacket_LocaleConnectionSourceSet( | 50 CXFA_Node* ParseAsXDPPacket_LocaleConnectionSourceSet( |
51 CFDE_XMLNode* pXMLDocumentNode, | 51 CFDE_XMLNode* pXMLDocumentNode, |
52 XFA_XDPPACKET ePacketID); | 52 XFA_XDPPACKET ePacketID); |
53 CXFA_Node* ParseAsXDPPacket_Xdc(CFDE_XMLNode* pXMLDocumentNode, | 53 CXFA_Node* ParseAsXDPPacket_Xdc(CFDE_XMLNode* pXMLDocumentNode, |
54 XFA_XDPPACKET ePacketID); | 54 XFA_XDPPACKET ePacketID); |
55 CXFA_Node* ParseAsXDPPacket_User(CFDE_XMLNode* pXMLDocumentNode, | 55 CXFA_Node* ParseAsXDPPacket_User(CFDE_XMLNode* pXMLDocumentNode, |
56 XFA_XDPPACKET ePacketID); | 56 XFA_XDPPACKET ePacketID); |
57 CXFA_Node* NormalLoader(CXFA_Node* pXFANode, | 57 CXFA_Node* NormalLoader(CXFA_Node* pXFANode, |
58 CFDE_XMLNode* pXMLDoc, | 58 CFDE_XMLNode* pXMLDoc, |
59 XFA_XDPPACKET ePacketID, | 59 XFA_XDPPACKET ePacketID, |
60 FX_BOOL bUseAttribute = TRUE); | 60 FX_BOOL bUseAttribute); |
61 CXFA_Node* DataLoader(CXFA_Node* pXFANode, | 61 CXFA_Node* DataLoader(CXFA_Node* pXFANode, |
62 CFDE_XMLNode* pXMLDoc, | 62 CFDE_XMLNode* pXMLDoc, |
63 FX_BOOL bDoTransform); | 63 FX_BOOL bDoTransform); |
64 CXFA_Node* UserPacketLoader(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLDoc); | 64 CXFA_Node* UserPacketLoader(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLDoc); |
65 void ParseContentNode(CXFA_Node* pXFANode, | 65 void ParseContentNode(CXFA_Node* pXFANode, |
66 CFDE_XMLNode* pXMLNode, | 66 CFDE_XMLNode* pXMLNode, |
67 XFA_XDPPACKET ePacketID); | 67 XFA_XDPPACKET ePacketID); |
68 void ParseDataValue(CXFA_Node* pXFANode, | 68 void ParseDataValue(CXFA_Node* pXFANode, |
69 CFDE_XMLNode* pXMLNode, | 69 CFDE_XMLNode* pXMLNode, |
70 XFA_XDPPACKET ePacketID); | 70 XFA_XDPPACKET ePacketID); |
71 void ParseDataGroup(CXFA_Node* pXFANode, | 71 void ParseDataGroup(CXFA_Node* pXFANode, |
72 CFDE_XMLNode* pXMLNode, | 72 CFDE_XMLNode* pXMLNode, |
73 XFA_XDPPACKET ePacketID); | 73 XFA_XDPPACKET ePacketID); |
74 void ParseInstruction(CXFA_Node* pXFANode, | 74 void ParseInstruction(CXFA_Node* pXFANode, |
75 CFDE_XMLInstruction* pXMLInstruction, | 75 CFDE_XMLInstruction* pXMLInstruction, |
76 XFA_XDPPACKET ePacketID); | 76 XFA_XDPPACKET ePacketID); |
77 | 77 |
78 CXFA_XMLParser* m_pXMLParser; | 78 CXFA_XMLParser* m_pXMLParser; |
79 std::unique_ptr<CFDE_XMLDoc> m_pXMLDoc; | 79 std::unique_ptr<CFDE_XMLDoc> m_pXMLDoc; |
80 std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream; | 80 std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream; |
81 IFX_FileRead* m_pFileRead; | 81 IFX_FileRead* m_pFileRead; |
82 CXFA_Document* m_pFactory; | 82 CXFA_Document* m_pFactory; |
83 CXFA_Node* m_pRootNode; | 83 CXFA_Node* m_pRootNode; |
84 XFA_XDPPACKET m_ePacketID; | 84 XFA_XDPPACKET m_ePacketID; |
85 FX_BOOL m_bDocumentParser; | 85 FX_BOOL m_bDocumentParser; |
86 }; | 86 }; |
87 | 87 |
88 #endif // XFA_FXFA_PARSER_CXFA_SIMPLE_PARSER_H_ | 88 #endif // XFA_FXFA_PARSER_CXFA_SIMPLE_PARSER_H_ |
OLD | NEW |