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_FDE_XML_FDE_XML_IMP_H_ | 7 #ifndef XFA_FDE_XML_FDE_XML_IMP_H_ |
8 #define XFA_FDE_XML_FDE_XML_IMP_H_ | 8 #define XFA_FDE_XML_FDE_XML_IMP_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_system.h" | 10 #include "core/fxcrt/include/fx_system.h" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 LastSibling, | 33 LastSibling, |
34 FirstNeighbor, | 34 FirstNeighbor, |
35 PriorNeighbor, | 35 PriorNeighbor, |
36 NextNeighbor, | 36 NextNeighbor, |
37 LastNeighbor, | 37 LastNeighbor, |
38 FirstChild, | 38 FirstChild, |
39 LastChild | 39 LastChild |
40 }; | 40 }; |
41 | 41 |
42 CFDE_XMLNode(); | 42 CFDE_XMLNode(); |
43 ~CFDE_XMLNode() override; | |
43 | 44 |
44 virtual void Release() { delete this; } | |
45 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Unknown; } | 45 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Unknown; } |
46 virtual int32_t CountChildNodes() const; | 46 virtual int32_t CountChildNodes() const; |
47 virtual CFDE_XMLNode* GetChildNode(int32_t index) const; | 47 virtual CFDE_XMLNode* GetChildNode(int32_t index) const; |
48 virtual int32_t GetChildNodeIndex(CFDE_XMLNode* pNode) const; | 48 virtual int32_t GetChildNodeIndex(CFDE_XMLNode* pNode) const; |
49 virtual CFDE_XMLNode* GetPath(const FX_WCHAR* pPath, | 49 virtual CFDE_XMLNode* GetPath(const FX_WCHAR* pPath, |
50 int32_t iLength = -1, | 50 int32_t iLength = -1, |
51 FX_BOOL bQualifiedName = TRUE) const; | 51 FX_BOOL bQualifiedName = TRUE) const; |
52 virtual int32_t InsertChildNode(CFDE_XMLNode* pNode, int32_t index = -1); | 52 virtual int32_t InsertChildNode(CFDE_XMLNode* pNode, int32_t index = -1); |
53 virtual void RemoveChildNode(CFDE_XMLNode* pNode); | 53 virtual void RemoveChildNode(CFDE_XMLNode* pNode); |
54 virtual void DeleteChildren(); | 54 virtual void DeleteChildren(); |
55 virtual CFDE_XMLNode* GetNodeItem(CFDE_XMLNode::NodeItem eItem) const; | 55 virtual CFDE_XMLNode* GetNodeItem(CFDE_XMLNode::NodeItem eItem) const; |
56 virtual int32_t GetNodeLevel() const; | 56 virtual int32_t GetNodeLevel() const; |
57 virtual FX_BOOL InsertNodeItem(CFDE_XMLNode::NodeItem eItem, | 57 virtual FX_BOOL InsertNodeItem(CFDE_XMLNode::NodeItem eItem, |
58 CFDE_XMLNode* pNode); | 58 CFDE_XMLNode* pNode); |
59 virtual CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem); | 59 virtual CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem); |
60 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); | 60 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); |
61 virtual void SaveXMLNode(IFX_Stream* pXMLStream); | 61 virtual void SaveXMLNode(IFX_Stream* pXMLStream); |
62 | 62 |
63 public: | |
64 ~CFDE_XMLNode(); | |
65 void CloneChildren(CFDE_XMLNode* pClone); | 63 void CloneChildren(CFDE_XMLNode* pClone); |
64 | |
66 CFDE_XMLNode* m_pParent; | 65 CFDE_XMLNode* m_pParent; |
67 CFDE_XMLNode* m_pChild; | 66 CFDE_XMLNode* m_pChild; |
68 CFDE_XMLNode* m_pPrior; | 67 CFDE_XMLNode* m_pPrior; |
69 CFDE_XMLNode* m_pNext; | 68 CFDE_XMLNode* m_pNext; |
70 }; | 69 }; |
70 | |
71 class CFDE_XMLInstruction : public CFDE_XMLNode { | 71 class CFDE_XMLInstruction : public CFDE_XMLNode { |
72 public: | 72 public: |
73 CFDE_XMLInstruction(const CFX_WideString& wsTarget); | 73 CFDE_XMLInstruction(const CFX_WideString& wsTarget); |
74 virtual void Release() { delete this; } | 74 ~CFDE_XMLInstruction() override {} |
Lei Zhang
2016/05/16 20:38:08
Move the impl to xfa/fde/xml/fde_xml_imp.cpp ? Dit
Tom Sepez
2016/05/16 21:29:05
Done.
| |
75 | |
75 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Instruction; } | 76 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Instruction; } |
76 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); | 77 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); |
77 virtual void GetTargetName(CFX_WideString& wsTarget) const { | 78 virtual void GetTargetName(CFX_WideString& wsTarget) const { |
78 wsTarget = m_wsTarget; | 79 wsTarget = m_wsTarget; |
79 } | 80 } |
80 virtual int32_t CountAttributes() const; | 81 virtual int32_t CountAttributes() const; |
81 virtual FX_BOOL GetAttribute(int32_t index, | 82 virtual FX_BOOL GetAttribute(int32_t index, |
82 CFX_WideString& wsAttriName, | 83 CFX_WideString& wsAttriName, |
83 CFX_WideString& wsAttriValue) const; | 84 CFX_WideString& wsAttriValue) const; |
84 virtual FX_BOOL HasAttribute(const FX_WCHAR* pwsAttriName) const; | 85 virtual FX_BOOL HasAttribute(const FX_WCHAR* pwsAttriName) const; |
85 virtual void GetString(const FX_WCHAR* pwsAttriName, | 86 virtual void GetString(const FX_WCHAR* pwsAttriName, |
86 CFX_WideString& wsAttriValue, | 87 CFX_WideString& wsAttriValue, |
87 const FX_WCHAR* pwsDefValue = NULL) const; | 88 const FX_WCHAR* pwsDefValue = NULL) const; |
88 virtual void SetString(const CFX_WideString& wsAttriName, | 89 virtual void SetString(const CFX_WideString& wsAttriName, |
89 const CFX_WideString& wsAttriValue); | 90 const CFX_WideString& wsAttriValue); |
90 virtual int32_t GetInteger(const FX_WCHAR* pwsAttriName, | 91 virtual int32_t GetInteger(const FX_WCHAR* pwsAttriName, |
91 int32_t iDefValue = 0) const; | 92 int32_t iDefValue = 0) const; |
92 virtual void SetInteger(const FX_WCHAR* pwsAttriName, int32_t iAttriValue); | 93 virtual void SetInteger(const FX_WCHAR* pwsAttriName, int32_t iAttriValue); |
93 virtual FX_FLOAT GetFloat(const FX_WCHAR* pwsAttriName, | 94 virtual FX_FLOAT GetFloat(const FX_WCHAR* pwsAttriName, |
94 FX_FLOAT fDefValue = 0) const; | 95 FX_FLOAT fDefValue = 0) const; |
95 virtual void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue); | 96 virtual void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue); |
96 virtual void RemoveAttribute(const FX_WCHAR* pwsAttriName); | 97 virtual void RemoveAttribute(const FX_WCHAR* pwsAttriName); |
97 virtual int32_t CountData() const; | 98 virtual int32_t CountData() const; |
98 virtual FX_BOOL GetData(int32_t index, CFX_WideString& wsData) const; | 99 virtual FX_BOOL GetData(int32_t index, CFX_WideString& wsData) const; |
99 virtual void AppendData(const CFX_WideString& wsData); | 100 virtual void AppendData(const CFX_WideString& wsData); |
100 virtual void RemoveData(int32_t index); | 101 virtual void RemoveData(int32_t index); |
101 | 102 |
102 public: | |
103 ~CFDE_XMLInstruction() {} | |
104 CFX_WideString m_wsTarget; | 103 CFX_WideString m_wsTarget; |
105 CFX_WideStringArray m_Attributes; | 104 CFX_WideStringArray m_Attributes; |
106 CFX_WideStringArray m_TargetData; | 105 CFX_WideStringArray m_TargetData; |
107 }; | 106 }; |
107 | |
108 class CFDE_XMLElement : public CFDE_XMLNode { | 108 class CFDE_XMLElement : public CFDE_XMLNode { |
109 public: | 109 public: |
110 CFDE_XMLElement(const CFX_WideString& wsTag); | 110 CFDE_XMLElement(const CFX_WideString& wsTag); |
111 virtual void Release() { delete this; } | 111 ~CFDE_XMLElement() override; |
112 | |
112 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Element; } | 113 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Element; } |
113 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); | 114 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); |
114 virtual void GetTagName(CFX_WideString& wsTag) const; | 115 virtual void GetTagName(CFX_WideString& wsTag) const; |
115 virtual void GetLocalTagName(CFX_WideString& wsTag) const; | 116 virtual void GetLocalTagName(CFX_WideString& wsTag) const; |
116 virtual void GetNamespacePrefix(CFX_WideString& wsPrefix) const; | 117 virtual void GetNamespacePrefix(CFX_WideString& wsPrefix) const; |
117 virtual void GetNamespaceURI(CFX_WideString& wsNamespace) const; | 118 virtual void GetNamespaceURI(CFX_WideString& wsNamespace) const; |
118 virtual int32_t CountAttributes() const; | 119 virtual int32_t CountAttributes() const; |
119 virtual FX_BOOL GetAttribute(int32_t index, | 120 virtual FX_BOOL GetAttribute(int32_t index, |
120 CFX_WideString& wsAttriName, | 121 CFX_WideString& wsAttriName, |
121 CFX_WideString& wsAttriValue) const; | 122 CFX_WideString& wsAttriValue) const; |
122 virtual FX_BOOL HasAttribute(const FX_WCHAR* pwsAttriName) const; | 123 virtual FX_BOOL HasAttribute(const FX_WCHAR* pwsAttriName) const; |
123 virtual void GetString(const FX_WCHAR* pwsAttriName, | 124 virtual void GetString(const FX_WCHAR* pwsAttriName, |
124 CFX_WideString& wsAttriValue, | 125 CFX_WideString& wsAttriValue, |
125 const FX_WCHAR* pwsDefValue = NULL) const; | 126 const FX_WCHAR* pwsDefValue = NULL) const; |
126 virtual void SetString(const CFX_WideString& wsAttriName, | 127 virtual void SetString(const CFX_WideString& wsAttriName, |
127 const CFX_WideString& wsAttriValue); | 128 const CFX_WideString& wsAttriValue); |
128 virtual int32_t GetInteger(const FX_WCHAR* pwsAttriName, | 129 virtual int32_t GetInteger(const FX_WCHAR* pwsAttriName, |
129 int32_t iDefValue = 0) const; | 130 int32_t iDefValue = 0) const; |
130 virtual void SetInteger(const FX_WCHAR* pwsAttriName, int32_t iAttriValue); | 131 virtual void SetInteger(const FX_WCHAR* pwsAttriName, int32_t iAttriValue); |
131 virtual FX_FLOAT GetFloat(const FX_WCHAR* pwsAttriName, | 132 virtual FX_FLOAT GetFloat(const FX_WCHAR* pwsAttriName, |
132 FX_FLOAT fDefValue = 0) const; | 133 FX_FLOAT fDefValue = 0) const; |
133 virtual void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue); | 134 virtual void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue); |
134 virtual void RemoveAttribute(const FX_WCHAR* pwsAttriName); | 135 virtual void RemoveAttribute(const FX_WCHAR* pwsAttriName); |
135 virtual void GetTextData(CFX_WideString& wsText) const; | 136 virtual void GetTextData(CFX_WideString& wsText) const; |
136 virtual void SetTextData(const CFX_WideString& wsText); | 137 virtual void SetTextData(const CFX_WideString& wsText); |
137 | 138 |
138 public: | |
139 ~CFDE_XMLElement(); | |
140 CFX_WideString m_wsTag; | 139 CFX_WideString m_wsTag; |
141 CFX_WideStringArray m_Attributes; | 140 CFX_WideStringArray m_Attributes; |
142 }; | 141 }; |
142 | |
143 class CFDE_XMLText : public CFDE_XMLNode { | 143 class CFDE_XMLText : public CFDE_XMLNode { |
144 public: | 144 public: |
145 CFDE_XMLText(const CFX_WideString& wsText); | 145 CFDE_XMLText(const CFX_WideString& wsText); |
146 virtual void Release() { delete this; } | 146 ~CFDE_XMLText() override {} |
147 | |
147 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Text; } | 148 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_Text; } |
148 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); | 149 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); |
149 virtual void GetText(CFX_WideString& wsText) const { wsText = m_wsText; } | 150 virtual void GetText(CFX_WideString& wsText) const { wsText = m_wsText; } |
150 virtual void SetText(const CFX_WideString& wsText) { m_wsText = wsText; } | 151 virtual void SetText(const CFX_WideString& wsText) { m_wsText = wsText; } |
151 | 152 |
152 public: | |
153 ~CFDE_XMLText() {} | |
154 CFX_WideString m_wsText; | 153 CFX_WideString m_wsText; |
155 }; | 154 }; |
155 | |
156 class CFDE_XMLDeclaration : public CFDE_XMLNode { | 156 class CFDE_XMLDeclaration : public CFDE_XMLNode { |
157 public: | 157 public: |
158 CFDE_XMLDeclaration() : CFDE_XMLNode() {} | 158 CFDE_XMLDeclaration() : CFDE_XMLNode() {} |
159 }; | 159 }; |
160 | |
160 class CFDE_XMLCharData : public CFDE_XMLDeclaration { | 161 class CFDE_XMLCharData : public CFDE_XMLDeclaration { |
161 public: | 162 public: |
162 CFDE_XMLCharData(const CFX_WideString& wsCData); | 163 CFDE_XMLCharData(const CFX_WideString& wsCData); |
164 ~CFDE_XMLCharData() override {} | |
163 | 165 |
164 virtual void Release() { delete this; } | |
165 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_CharData; } | 166 virtual FDE_XMLNODETYPE GetType() const { return FDE_XMLNODE_CharData; } |
166 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); | 167 virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); |
167 virtual void GetCharData(CFX_WideString& wsCharData) const { | 168 virtual void GetCharData(CFX_WideString& wsCharData) const { |
168 wsCharData = m_wsCharData; | 169 wsCharData = m_wsCharData; |
169 } | 170 } |
170 virtual void SetCharData(const CFX_WideString& wsCData) { | 171 virtual void SetCharData(const CFX_WideString& wsCData) { |
171 m_wsCharData = wsCData; | 172 m_wsCharData = wsCData; |
172 } | 173 } |
173 | 174 |
174 public: | |
175 ~CFDE_XMLCharData() {} | |
176 | |
177 CFX_WideString m_wsCharData; | 175 CFX_WideString m_wsCharData; |
178 }; | 176 }; |
177 | |
179 class CFDE_XMLDoc : public CFX_Target { | 178 class CFDE_XMLDoc : public CFX_Target { |
180 public: | 179 public: |
181 CFDE_XMLDoc(); | 180 CFDE_XMLDoc(); |
182 ~CFDE_XMLDoc(); | 181 ~CFDE_XMLDoc() override; |
183 virtual void Release() { delete this; } | 182 |
184 virtual FX_BOOL LoadXML(IFX_Stream* pXMLStream, | 183 virtual FX_BOOL LoadXML(IFX_Stream* pXMLStream, |
185 int32_t iXMLPlaneSize = 8192, | 184 int32_t iXMLPlaneSize = 8192, |
186 int32_t iTextDataSize = 256, | 185 int32_t iTextDataSize = 256, |
187 FDE_XMLREADERHANDLER* pHandler = NULL); | 186 FDE_XMLREADERHANDLER* pHandler = NULL); |
188 virtual FX_BOOL LoadXML(CFDE_XMLParser* pXMLParser); | 187 virtual FX_BOOL LoadXML(CFDE_XMLParser* pXMLParser); |
189 virtual int32_t DoLoad(IFX_Pause* pPause = NULL); | 188 virtual int32_t DoLoad(IFX_Pause* pPause = NULL); |
190 virtual void CloseXML(); | 189 virtual void CloseXML(); |
191 virtual CFDE_XMLNode* GetRoot() const { return m_pRoot; } | 190 virtual CFDE_XMLNode* GetRoot() const { return m_pRoot; } |
192 virtual void SaveXML(IFX_Stream* pXMLStream = NULL, FX_BOOL bSaveBOM = TRUE); | 191 virtual void SaveXML(IFX_Stream* pXMLStream = NULL, FX_BOOL bSaveBOM = TRUE); |
193 virtual void SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pNode); | 192 virtual void SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pNode); |
194 | 193 |
195 protected: | 194 protected: |
196 IFX_Stream* m_pStream; | 195 IFX_Stream* m_pStream; |
197 int32_t m_iStatus; | 196 int32_t m_iStatus; |
198 CFDE_XMLNode* m_pRoot; | 197 CFDE_XMLNode* m_pRoot; |
199 CFDE_XMLSyntaxParser* m_pSyntaxParser; | 198 CFDE_XMLSyntaxParser* m_pSyntaxParser; |
200 CFDE_XMLParser* m_pXMLParser; | 199 CFDE_XMLParser* m_pXMLParser; |
201 void Reset(FX_BOOL bInitRoot); | 200 void Reset(FX_BOOL bInitRoot); |
202 void ReleaseParser(); | 201 void ReleaseParser(); |
203 }; | 202 }; |
204 typedef CFX_StackTemplate<CFDE_XMLNode*> CFDE_XMLDOMNodeStack; | 203 typedef CFX_StackTemplate<CFDE_XMLNode*> CFDE_XMLDOMNodeStack; |
205 | 204 |
206 class CFDE_XMLParser { | 205 class CFDE_XMLParser { |
Lei Zhang
2016/05/16 20:38:08
BTW, this should be ISomething. It has 2 subclasse
Tom Sepez
2016/05/16 21:29:06
Renamed to IFDE_.
| |
207 public: | 206 public: |
208 virtual ~CFDE_XMLParser() {} | 207 virtual ~CFDE_XMLParser() {} |
209 | 208 |
210 virtual void Release() = 0; | |
211 virtual int32_t DoParser(IFX_Pause* pPause) = 0; | 209 virtual int32_t DoParser(IFX_Pause* pPause) = 0; |
212 }; | 210 }; |
213 | 211 |
214 class CFDE_XMLDOMParser : public CFDE_XMLParser, public CFX_Target { | 212 class CFDE_XMLDOMParser : public CFDE_XMLParser, public CFX_Target { |
215 public: | 213 public: |
216 CFDE_XMLDOMParser(CFDE_XMLNode* pRoot, CFDE_XMLSyntaxParser* pParser); | 214 CFDE_XMLDOMParser(CFDE_XMLNode* pRoot, CFDE_XMLSyntaxParser* pParser); |
217 ~CFDE_XMLDOMParser(); | 215 ~CFDE_XMLDOMParser() override; |
218 | 216 |
219 virtual void Release() { delete this; } | |
220 virtual int32_t DoParser(IFX_Pause* pPause); | 217 virtual int32_t DoParser(IFX_Pause* pPause); |
221 | 218 |
222 private: | 219 private: |
223 CFDE_XMLSyntaxParser* m_pParser; | 220 CFDE_XMLSyntaxParser* m_pParser; |
224 CFDE_XMLNode* m_pParent; | 221 CFDE_XMLNode* m_pParent; |
225 CFDE_XMLNode* m_pChild; | 222 CFDE_XMLNode* m_pChild; |
226 CFDE_XMLDOMNodeStack m_NodeStack; | 223 CFDE_XMLDOMNodeStack m_NodeStack; |
227 CFX_WideString m_ws1; | 224 CFX_WideString m_ws1; |
228 CFX_WideString m_ws2; | 225 CFX_WideString m_ws2; |
229 }; | 226 }; |
230 class CFDE_XMLTAG : public CFX_Target { | 227 class CFDE_XMLTAG : public CFX_Target { |
231 public: | 228 public: |
232 CFDE_XMLTAG() : eType(FDE_XMLNODE_Unknown) {} | 229 CFDE_XMLTAG() : eType(FDE_XMLNODE_Unknown) {} |
233 CFDE_XMLTAG(const CFDE_XMLTAG& src) | 230 CFDE_XMLTAG(const CFDE_XMLTAG& src) |
234 : wsTagName(src.wsTagName), eType(src.eType) {} | 231 : wsTagName(src.wsTagName), eType(src.eType) {} |
235 CFX_WideString wsTagName; | 232 CFX_WideString wsTagName; |
236 FDE_XMLNODETYPE eType; | 233 FDE_XMLNODETYPE eType; |
237 }; | 234 }; |
238 typedef CFX_ObjectStackTemplate<CFDE_XMLTAG> CFDE_XMLTagStack; | 235 typedef CFX_ObjectStackTemplate<CFDE_XMLTAG> CFDE_XMLTagStack; |
236 | |
239 class CFDE_XMLSAXParser : public CFDE_XMLParser, public CFX_Target { | 237 class CFDE_XMLSAXParser : public CFDE_XMLParser, public CFX_Target { |
240 public: | 238 public: |
241 CFDE_XMLSAXParser(FDE_XMLREADERHANDLER* pHandler, | 239 CFDE_XMLSAXParser(FDE_XMLREADERHANDLER* pHandler, |
242 CFDE_XMLSyntaxParser* pParser); | 240 CFDE_XMLSyntaxParser* pParser); |
243 ~CFDE_XMLSAXParser(); | 241 ~CFDE_XMLSAXParser() override; |
244 | 242 |
245 virtual void Release() { delete this; } | |
246 virtual int32_t DoParser(IFX_Pause* pPause); | 243 virtual int32_t DoParser(IFX_Pause* pPause); |
247 | 244 |
248 private: | 245 private: |
249 void Push(const CFDE_XMLTAG& xmlTag); | 246 void Push(const CFDE_XMLTAG& xmlTag); |
250 void Pop(); | 247 void Pop(); |
251 FDE_XMLREADERHANDLER* m_pHandler; | 248 FDE_XMLREADERHANDLER* m_pHandler; |
252 CFDE_XMLSyntaxParser* m_pParser; | 249 CFDE_XMLSyntaxParser* m_pParser; |
253 CFDE_XMLTagStack m_TagStack; | 250 CFDE_XMLTagStack m_TagStack; |
254 CFDE_XMLTAG* m_pTagTop; | 251 CFDE_XMLTAG* m_pTagTop; |
255 CFX_WideString m_ws1; | 252 CFX_WideString m_ws1; |
256 CFX_WideString m_ws2; | 253 CFX_WideString m_ws2; |
257 }; | 254 }; |
258 | 255 |
259 class CFDE_BlockBuffer : public CFX_Target { | 256 class CFDE_BlockBuffer : public CFX_Target { |
260 public: | 257 public: |
261 CFDE_BlockBuffer(int32_t iAllocStep = 1024 * 1024); | 258 CFDE_BlockBuffer(int32_t iAllocStep = 1024 * 1024); |
262 ~CFDE_BlockBuffer(); | 259 ~CFDE_BlockBuffer() override; |
263 | 260 |
264 FX_BOOL InitBuffer(int32_t iBufferSize = 1024 * 1024); | 261 FX_BOOL InitBuffer(int32_t iBufferSize = 1024 * 1024); |
265 FX_BOOL IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; } | 262 FX_BOOL IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; } |
266 void ReleaseBuffer() { delete this; } | 263 |
267 FX_WCHAR* GetAvailableBlock(int32_t& iIndexInBlock); | 264 FX_WCHAR* GetAvailableBlock(int32_t& iIndexInBlock); |
268 inline int32_t GetAllocStep() const { return m_iAllocStep; } | 265 inline int32_t GetAllocStep() const { return m_iAllocStep; } |
269 inline int32_t& GetDataLengthRef() { return m_iDataLength; } | 266 inline int32_t& GetDataLengthRef() { return m_iDataLength; } |
270 inline void Reset(FX_BOOL bReserveData = TRUE) { | 267 inline void Reset(FX_BOOL bReserveData = TRUE) { |
271 if (!bReserveData) { | 268 if (!bReserveData) { |
272 m_iStartPosition = 0; | 269 m_iStartPosition = 0; |
273 } | 270 } |
274 m_iDataLength = 0; | 271 m_iDataLength = 0; |
275 } | 272 } |
276 void SetTextChar(int32_t iIndex, FX_WCHAR ch); | 273 void SetTextChar(int32_t iIndex, FX_WCHAR ch); |
(...skipping 10 matching lines...) Expand all Loading... | |
287 CFX_ArrayTemplate<FX_WCHAR*> m_BlockArray; | 284 CFX_ArrayTemplate<FX_WCHAR*> m_BlockArray; |
288 int32_t m_iDataLength; | 285 int32_t m_iDataLength; |
289 int32_t m_iBufferSize; | 286 int32_t m_iBufferSize; |
290 int32_t m_iAllocStep; | 287 int32_t m_iAllocStep; |
291 int32_t m_iStartPosition; | 288 int32_t m_iStartPosition; |
292 }; | 289 }; |
293 | 290 |
294 class CFDE_XMLSyntaxParser : public CFX_Target { | 291 class CFDE_XMLSyntaxParser : public CFX_Target { |
295 public: | 292 public: |
296 CFDE_XMLSyntaxParser(); | 293 CFDE_XMLSyntaxParser(); |
297 ~CFDE_XMLSyntaxParser(); | 294 ~CFDE_XMLSyntaxParser() override; |
298 void Release() { delete this; } | 295 |
299 void Init(IFX_Stream* pStream, | 296 void Init(IFX_Stream* pStream, |
300 int32_t iXMLPlaneSize, | 297 int32_t iXMLPlaneSize, |
301 int32_t iTextDataSize = 256); | 298 int32_t iTextDataSize = 256); |
302 FDE_XmlSyntaxResult DoSyntaxParse(); | 299 FDE_XmlSyntaxResult DoSyntaxParse(); |
303 int32_t GetStatus() const; | 300 int32_t GetStatus() const; |
304 int32_t GetCurrentPos() const { | 301 int32_t GetCurrentPos() const { |
305 return m_iParsedChars + (m_pStart - m_pBuffer); | 302 return m_iParsedChars + (m_pStart - m_pBuffer); |
306 } | 303 } |
307 FX_FILESIZE GetCurrentBinaryPos() const; | 304 FX_FILESIZE GetCurrentBinaryPos() const; |
308 int32_t GetCurrentNodeNumber() const { return m_iCurrentNodeNum; } | 305 int32_t GetCurrentNodeNumber() const { return m_iCurrentNodeNum; } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 FDE_XmlSyntaxResult m_syntaxParserResult; | 371 FDE_XmlSyntaxResult m_syntaxParserResult; |
375 FDE_XmlSyntaxState m_syntaxParserState; | 372 FDE_XmlSyntaxState m_syntaxParserState; |
376 FX_WCHAR m_wQuotationMark; | 373 FX_WCHAR m_wQuotationMark; |
377 int32_t m_iEntityStart; | 374 int32_t m_iEntityStart; |
378 CFX_DWordStack m_SkipStack; | 375 CFX_DWordStack m_SkipStack; |
379 FX_WCHAR m_SkipChar; | 376 FX_WCHAR m_SkipChar; |
380 inline void ParseTextChar(FX_WCHAR ch); | 377 inline void ParseTextChar(FX_WCHAR ch); |
381 }; | 378 }; |
382 | 379 |
383 #endif // XFA_FDE_XML_FDE_XML_IMP_H_ | 380 #endif // XFA_FDE_XML_FDE_XML_IMP_H_ |
OLD | NEW |