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_SRC_FDP_INCLUDE_FDE_XML_H_ | 7 #ifndef XFA_SRC_FDP_INCLUDE_FDE_XML_H_ |
8 #define XFA_SRC_FDP_INCLUDE_FDE_XML_H_ | 8 #define XFA_SRC_FDP_INCLUDE_FDE_XML_H_ |
9 | 9 |
10 #include "xfa/src/fgas/include/fx_stm.h" | 10 #include "xfa/src/fgas/include/fx_stm.h" |
11 #include "xfa/src/fgas/include/fx_utl.h" | 11 #include "xfa/src/fgas/include/fx_utl.h" |
12 | 12 |
13 class IFDE_XMLNode; | 13 class IFDE_XMLNode; |
14 class IFDE_XMLInstruction; | 14 class IFDE_XMLInstruction; |
15 class IFDE_XMLDeclaration; | 15 class IFDE_XMLDeclaration; |
16 class IFDE_XMLDeclComment; | 16 class IFDE_XMLDeclComment; |
17 class IFDE_XMLDeclCharData; | 17 class IFDE_XMLDeclCharData; |
18 class IFDE_XMLDeclDocType; | 18 class IFDE_XMLDeclDocType; |
19 class IFDE_XMLDeclElement; | 19 class IFDE_XMLDeclElement; |
20 class IFDE_XMLDeclAttriList; | 20 class IFDE_XMLDeclAttriList; |
21 class IFDE_XMLDeclNotition; | 21 class IFDE_XMLDeclNotition; |
22 class IFDE_XMLDeclEntity; | 22 class IFDE_XMLDeclEntity; |
23 class IFDE_XMLElement; | 23 class IFDE_XMLElement; |
24 class IFDE_XMLText; | 24 class IFDE_XMLText; |
25 class IFDE_XMLDoc; | 25 class IFDE_XMLDoc; |
26 class IFDE_XMLParser; | 26 class IFDE_XMLParser; |
27 class IFDE_XMLSyntaxParser; | 27 class IFDE_XMLSyntaxParser; |
28 | 28 |
29 #ifdef __cplusplus | |
30 extern "C" { | |
31 #endif | |
32 enum FDE_XMLNODETYPE { | 29 enum FDE_XMLNODETYPE { |
33 FDE_XMLNODE_Unknown = 0, | 30 FDE_XMLNODE_Unknown = 0, |
34 FDE_XMLNODE_Instruction, | 31 FDE_XMLNODE_Instruction, |
35 FDE_XMLNODE_Element, | 32 FDE_XMLNODE_Element, |
36 FDE_XMLNODE_Text, | 33 FDE_XMLNODE_Text, |
37 FDE_XMLNODE_CharData, | 34 FDE_XMLNODE_CharData, |
38 }; | 35 }; |
39 typedef struct _FDE_XMLNODE { | 36 |
| 37 struct FDE_XMLNODE { |
40 int32_t iNodeNum; | 38 int32_t iNodeNum; |
41 FDE_XMLNODETYPE eNodeType; | 39 FDE_XMLNODETYPE eNodeType; |
42 } FDE_XMLNODE, *FDE_LPXMLNODE; | 40 }; |
43 typedef FDE_XMLNODE const* FDE_LPCXMLNODE; | |
44 typedef CFX_StackTemplate<FDE_XMLNODE> CFDE_XMLNodeStack; | 41 typedef CFX_StackTemplate<FDE_XMLNODE> CFDE_XMLNodeStack; |
| 42 |
45 FX_BOOL FDE_IsXMLValidChar(FX_WCHAR ch); | 43 FX_BOOL FDE_IsXMLValidChar(FX_WCHAR ch); |
46 FX_BOOL FDE_IsXMLWhiteSpace(FX_WCHAR ch); | 44 FX_BOOL FDE_IsXMLWhiteSpace(FX_WCHAR ch); |
47 FX_BOOL FDE_IsXMLNameChar(FX_WCHAR ch, FX_BOOL bFirstChar); | 45 FX_BOOL FDE_IsXMLNameChar(FX_WCHAR ch, FX_BOOL bFirstChar); |
48 #ifdef __cplusplus | |
49 } | |
50 #endif | |
51 | 46 |
52 class IFDE_XMLNode { | 47 class IFDE_XMLNode { |
53 public: | 48 public: |
54 virtual ~IFDE_XMLNode() {} | 49 virtual ~IFDE_XMLNode() {} |
55 virtual void Release() = 0; | 50 virtual void Release() = 0; |
56 virtual FDE_XMLNODETYPE GetType() const = 0; | 51 virtual FDE_XMLNODETYPE GetType() const = 0; |
57 virtual int32_t CountChildNodes() const = 0; | 52 virtual int32_t CountChildNodes() const = 0; |
58 virtual IFDE_XMLNode* GetChildNode(int32_t index) const = 0; | 53 virtual IFDE_XMLNode* GetChildNode(int32_t index) const = 0; |
59 virtual int32_t GetChildNodeIndex(IFDE_XMLNode* pNode) const = 0; | 54 virtual int32_t GetChildNodeIndex(IFDE_XMLNode* pNode) const = 0; |
60 virtual IFDE_XMLNode* GetPath(const FX_WCHAR* pPath, | 55 virtual IFDE_XMLNode* GetPath(const FX_WCHAR* pPath, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 public: | 145 public: |
151 }; | 146 }; |
152 class IFDE_XMLCharData : public IFDE_XMLDeclaration { | 147 class IFDE_XMLCharData : public IFDE_XMLDeclaration { |
153 public: | 148 public: |
154 static IFDE_XMLCharData* Create(const CFX_WideString& wsCData); | 149 static IFDE_XMLCharData* Create(const CFX_WideString& wsCData); |
155 virtual ~IFDE_XMLCharData() {} | 150 virtual ~IFDE_XMLCharData() {} |
156 | 151 |
157 virtual void GetCharData(CFX_WideString& wsCData) const = 0; | 152 virtual void GetCharData(CFX_WideString& wsCData) const = 0; |
158 virtual void SetCharData(const CFX_WideString& wsCData) = 0; | 153 virtual void SetCharData(const CFX_WideString& wsCData) = 0; |
159 }; | 154 }; |
160 typedef struct _FDE_XMLREADERHANDLER { | 155 |
| 156 struct FDE_XMLREADERHANDLER { |
161 void* pData; | 157 void* pData; |
162 | 158 void (*OnTagEnter)(FDE_XMLREADERHANDLER* pThis, |
163 void (*OnTagEnter)(_FDE_XMLREADERHANDLER* pThis, | |
164 FDE_XMLNODETYPE eType, | 159 FDE_XMLNODETYPE eType, |
165 const CFX_WideString& wsTagName); | 160 const CFX_WideString& wsTagName); |
166 void (*OnTagBreak)(_FDE_XMLREADERHANDLER* pThis, | 161 void (*OnTagBreak)(FDE_XMLREADERHANDLER* pThis, |
167 const CFX_WideString& wsTagName); | 162 const CFX_WideString& wsTagName); |
168 void (*OnTagClose)(_FDE_XMLREADERHANDLER* pThis, | 163 void (*OnTagClose)(FDE_XMLREADERHANDLER* pThis, |
169 const CFX_WideString& wsTagName); | 164 const CFX_WideString& wsTagName); |
170 void (*OnAttribute)(_FDE_XMLREADERHANDLER* pThis, | 165 void (*OnAttribute)(FDE_XMLREADERHANDLER* pThis, |
171 const CFX_WideString& wsName, | 166 const CFX_WideString& wsName, |
172 const CFX_WideString& wsValue); | 167 const CFX_WideString& wsValue); |
173 void (*OnData)(_FDE_XMLREADERHANDLER* pThis, | 168 void (*OnData)(FDE_XMLREADERHANDLER* pThis, |
174 FDE_XMLNODETYPE eType, | 169 FDE_XMLNODETYPE eType, |
175 const CFX_WideString& wsValue); | 170 const CFX_WideString& wsValue); |
176 } FDE_XMLREADERHANDLER, *FDE_LPXMLREADERHANDLER; | 171 }; |
| 172 |
177 class IFDE_XMLDoc { | 173 class IFDE_XMLDoc { |
178 public: | 174 public: |
179 static IFDE_XMLDoc* Create(); | 175 static IFDE_XMLDoc* Create(); |
180 virtual ~IFDE_XMLDoc() {} | 176 virtual ~IFDE_XMLDoc() {} |
181 virtual void Release() = 0; | 177 virtual void Release() = 0; |
182 virtual FX_BOOL LoadXML(IFX_Stream* pXMLStream, | 178 virtual FX_BOOL LoadXML(IFX_Stream* pXMLStream, |
183 int32_t iXMLPlaneSize = 8192, | 179 int32_t iXMLPlaneSize = 8192, |
184 int32_t iTextDataSize = 256, | 180 int32_t iTextDataSize = 256, |
185 FDE_LPXMLREADERHANDLER pHandler = NULL) = 0; | 181 FDE_XMLREADERHANDLER* pHandler = NULL) = 0; |
186 virtual FX_BOOL LoadXML(IFDE_XMLParser* pXMLParser) = 0; | 182 virtual FX_BOOL LoadXML(IFDE_XMLParser* pXMLParser) = 0; |
187 virtual int32_t DoLoad(IFX_Pause* pPause = NULL) = 0; | 183 virtual int32_t DoLoad(IFX_Pause* pPause = NULL) = 0; |
188 virtual void CloseXML() = 0; | 184 virtual void CloseXML() = 0; |
189 virtual IFDE_XMLNode* GetRoot() const = 0; | 185 virtual IFDE_XMLNode* GetRoot() const = 0; |
190 virtual void SaveXML(IFX_Stream* pXMLStream = NULL, | 186 virtual void SaveXML(IFX_Stream* pXMLStream = NULL, |
191 FX_BOOL bSaveBOM = TRUE) = 0; | 187 FX_BOOL bSaveBOM = TRUE) = 0; |
192 virtual void SaveXMLNode(IFX_Stream* pXMLStream, IFDE_XMLNode* pNode) = 0; | 188 virtual void SaveXMLNode(IFX_Stream* pXMLStream, IFDE_XMLNode* pNode) = 0; |
193 }; | 189 }; |
194 class IFDE_XMLParser { | 190 class IFDE_XMLParser { |
195 public: | 191 public: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 virtual int32_t GetLastNodeNumber() const = 0; | 224 virtual int32_t GetLastNodeNumber() const = 0; |
229 virtual void GetTargetName(CFX_WideString& wsTarget) const = 0; | 225 virtual void GetTargetName(CFX_WideString& wsTarget) const = 0; |
230 virtual void GetTagName(CFX_WideString& wsTag) const = 0; | 226 virtual void GetTagName(CFX_WideString& wsTag) const = 0; |
231 virtual void GetAttributeName(CFX_WideString& wsAttriName) const = 0; | 227 virtual void GetAttributeName(CFX_WideString& wsAttriName) const = 0; |
232 virtual void GetAttributeValue(CFX_WideString& wsAttriValue) const = 0; | 228 virtual void GetAttributeValue(CFX_WideString& wsAttriValue) const = 0; |
233 virtual void GetTextData(CFX_WideString& wsText) const = 0; | 229 virtual void GetTextData(CFX_WideString& wsText) const = 0; |
234 virtual void GetTargetData(CFX_WideString& wsData) const = 0; | 230 virtual void GetTargetData(CFX_WideString& wsData) const = 0; |
235 }; | 231 }; |
236 | 232 |
237 #endif // XFA_SRC_FDP_INCLUDE_FDE_XML_H_ | 233 #endif // XFA_SRC_FDP_INCLUDE_FDE_XML_H_ |
OLD | NEW |