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 _FDE_XML | 7 #ifndef _FDE_XML |
8 #define _FDE_XML | 8 #define _FDE_XML |
9 class IFDE_XMLNode; | 9 class IFDE_XMLNode; |
10 class IFDE_XMLInstruction; | 10 class IFDE_XMLInstruction; |
(...skipping 14 matching lines...) Expand all Loading... |
25 extern "C" { | 25 extern "C" { |
26 #endif | 26 #endif |
27 enum FDE_XMLNODETYPE { | 27 enum FDE_XMLNODETYPE { |
28 FDE_XMLNODE_Unknown = 0, | 28 FDE_XMLNODE_Unknown = 0, |
29 FDE_XMLNODE_Instruction , | 29 FDE_XMLNODE_Instruction , |
30 FDE_XMLNODE_Element , | 30 FDE_XMLNODE_Element , |
31 FDE_XMLNODE_Text , | 31 FDE_XMLNODE_Text , |
32 FDE_XMLNODE_CharData , | 32 FDE_XMLNODE_CharData , |
33 }; | 33 }; |
34 typedef struct _FDE_XMLNODE { | 34 typedef struct _FDE_XMLNODE { |
35 FX_INT32» » iNodeNum; | 35 int32_t» » iNodeNum; |
36 FDE_XMLNODETYPE eNodeType; | 36 FDE_XMLNODETYPE eNodeType; |
37 } FDE_XMLNODE, * FDE_LPXMLNODE; | 37 } FDE_XMLNODE, * FDE_LPXMLNODE; |
38 typedef FDE_XMLNODE const * FDE_LPCXMLNODE; | 38 typedef FDE_XMLNODE const * FDE_LPCXMLNODE; |
39 typedef CFX_StackTemplate<FDE_XMLNODE> CFDE_XMLNodeStack; | 39 typedef CFX_StackTemplate<FDE_XMLNODE> CFDE_XMLNodeStack; |
40 FX_BOOL FDE_IsXMLValidChar(FX_WCHAR ch); | 40 FX_BOOL FDE_IsXMLValidChar(FX_WCHAR ch); |
41 FX_BOOL FDE_IsXMLWhiteSpace(FX_WCHAR ch); | 41 FX_BOOL FDE_IsXMLWhiteSpace(FX_WCHAR ch); |
42 FX_BOOL FDE_IsXMLNameChar(FX_WCHAR ch, FX_BOOL bFirstChar); | 42 FX_BOOL FDE_IsXMLNameChar(FX_WCHAR ch, FX_BOOL bFirstChar); |
43 #ifdef __cplusplus | 43 #ifdef __cplusplus |
44 } | 44 } |
45 #endif | 45 #endif |
46 class IFDE_XMLNode | 46 class IFDE_XMLNode |
47 { | 47 { |
48 public: | 48 public: |
49 virtual void Release() = 0; | 49 virtual void Release() = 0; |
50 virtual FDE_XMLNODETYPE GetType() const = 0; | 50 virtual FDE_XMLNODETYPE GetType() const = 0; |
51 virtual FX_INT32» » CountChildNodes() const = 0; | 51 virtual int32_t» » CountChildNodes() const = 0; |
52 virtual IFDE_XMLNode*» GetChildNode(FX_INT32 index) const = 0; | 52 virtual IFDE_XMLNode*» GetChildNode(int32_t index) const = 0; |
53 virtual FX_INT32» » GetChildNodeIndex(IFDE_XMLNode *pNode) const = 0
; | 53 virtual int32_t» » GetChildNodeIndex(IFDE_XMLNode *pNode) const = 0
; |
54 virtual IFDE_XMLNode*» GetPath(FX_LPCWSTR pPath, FX_INT32 iLength = -1,
FX_BOOL bQualifiedName = TRUE) const = 0; | 54 virtual IFDE_XMLNode*» GetPath(FX_LPCWSTR pPath, int32_t iLength = -1,
FX_BOOL bQualifiedName = TRUE) const = 0; |
55 virtual FX_INT32» » InsertChildNode(IFDE_XMLNode *pNode, FX_INT32 in
dex = -1) = 0; | 55 virtual int32_t» » InsertChildNode(IFDE_XMLNode *pNode, int32_t ind
ex = -1) = 0; |
56 virtual void RemoveChildNode(IFDE_XMLNode *pNode) = 0
; | 56 virtual void RemoveChildNode(IFDE_XMLNode *pNode) = 0
; |
57 virtual void DeleteChildren() = 0; | 57 virtual void DeleteChildren() = 0; |
58 enum NodeItem {Root = 0, Parent, FirstSibling, PriorSibling, NextSibling, La
stSibling, FirstNeighbor, PriorNeighbor, NextNeighbor, LastNeighbor, FirstChild,
LastChild}; | 58 enum NodeItem {Root = 0, Parent, FirstSibling, PriorSibling, NextSibling, La
stSibling, FirstNeighbor, PriorNeighbor, NextNeighbor, LastNeighbor, FirstChild,
LastChild}; |
59 virtual IFDE_XMLNode* GetNodeItem(NodeItem eItem) const = 0; | 59 virtual IFDE_XMLNode* GetNodeItem(NodeItem eItem) const = 0; |
60 virtual FX_INT32» » GetNodeLevel() const = 0; | 60 virtual int32_t» » GetNodeLevel() const = 0; |
61 virtual FX_BOOL InsertNodeItem(IFDE_XMLNode::NodeItem eI
tem, IFDE_XMLNode *pNode) = 0; | 61 virtual FX_BOOL InsertNodeItem(IFDE_XMLNode::NodeItem eI
tem, IFDE_XMLNode *pNode) = 0; |
62 virtual IFDE_XMLNode* RemoveNodeItem(IFDE_XMLNode::NodeItem eItem) = 0
; | 62 virtual IFDE_XMLNode* RemoveNodeItem(IFDE_XMLNode::NodeItem eItem) = 0
; |
63 virtual IFDE_XMLNode* Clone(FX_BOOL bRecursive) = 0; | 63 virtual IFDE_XMLNode* Clone(FX_BOOL bRecursive) = 0; |
64 virtual void SaveXMLNode(IFX_Stream *pXMLStream) = 0; | 64 virtual void SaveXMLNode(IFX_Stream *pXMLStream) = 0; |
65 }; | 65 }; |
66 class IFDE_XMLInstruction : public IFDE_XMLNode | 66 class IFDE_XMLInstruction : public IFDE_XMLNode |
67 { | 67 { |
68 public: | 68 public: |
69 static IFDE_XMLInstruction* Create(const CFX_WideString &wsTarget); | 69 static IFDE_XMLInstruction* Create(const CFX_WideString &wsTarget); |
70 virtual void GetTargetName(CFX_WideString &ws
Target) const = 0; | 70 virtual void GetTargetName(CFX_WideString &ws
Target) const = 0; |
71 virtual FX_INT32» » CountAttributes() const = 0; | 71 virtual int32_t» » CountAttributes() const = 0; |
72 virtual FX_BOOL» » » GetAttribute(FX_INT32 index, CFX_WideStr
ing &wsAttriName, CFX_WideString &wsAttriValue) const = 0; | 72 virtual FX_BOOL» » » GetAttribute(int32_t index, CFX_WideStri
ng &wsAttriName, CFX_WideString &wsAttriValue) const = 0; |
73 virtual FX_BOOL HasAttribute(FX_LPCWSTR pwsAttriName) co
nst = 0; | 73 virtual FX_BOOL HasAttribute(FX_LPCWSTR pwsAttriName) co
nst = 0; |
74 virtual void GetString(FX_LPCWSTR pwsAttriName, CFX_W
ideString &wsAttriValue, FX_LPCWSTR pwsDefValue = NULL) const = 0; | 74 virtual void GetString(FX_LPCWSTR pwsAttriName, CFX_W
ideString &wsAttriValue, FX_LPCWSTR pwsDefValue = NULL) const = 0; |
75 virtual void SetString(const CFX_WideString &wsAttriN
ame, const CFX_WideString &wsAttriValue) = 0; | 75 virtual void SetString(const CFX_WideString &wsAttriN
ame, const CFX_WideString &wsAttriValue) = 0; |
76 virtual FX_INT32» » GetInteger(FX_LPCWSTR pwsAttriName, FX_INT32 iDe
fValue = 0) const = 0; | 76 virtual int32_t» » GetInteger(FX_LPCWSTR pwsAttriName, int32_t iDef
Value = 0) const = 0; |
77 virtual void» » » SetInteger(FX_LPCWSTR pwsAttriName, FX_I
NT32 iAttriValue) = 0; | 77 virtual void» » » SetInteger(FX_LPCWSTR pwsAttriName, int3
2_t iAttriValue) = 0; |
78 virtual FX_FLOAT GetFloat(FX_LPCWSTR pwsAttriName, FX_FLOAT fDefV
alue = 0) const = 0; | 78 virtual FX_FLOAT GetFloat(FX_LPCWSTR pwsAttriName, FX_FLOAT fDefV
alue = 0) const = 0; |
79 virtual void SetFloat(FX_LPCWSTR pwsAttriName, FX_FLO
AT fAttriValue) = 0; | 79 virtual void SetFloat(FX_LPCWSTR pwsAttriName, FX_FLO
AT fAttriValue) = 0; |
80 virtual void RemoveAttribute(FX_LPCWSTR pwsAttriName)
= 0; | 80 virtual void RemoveAttribute(FX_LPCWSTR pwsAttriName)
= 0; |
81 virtual FX_INT32» » CountData() const = 0; | 81 virtual int32_t» » CountData() const = 0; |
82 virtual FX_BOOL» » » GetData(FX_INT32 index, CFX_WideString &
wsData) const = 0; | 82 virtual FX_BOOL» » » GetData(int32_t index, CFX_WideString &w
sData) const = 0; |
83 virtual void AppendData(const CFX_WideString &wsData)
= 0; | 83 virtual void AppendData(const CFX_WideString &wsData)
= 0; |
84 virtual void» » » RemoveData(FX_INT32 index) = 0; | 84 virtual void» » » RemoveData(int32_t index) = 0; |
85 }; | 85 }; |
86 class IFDE_XMLElement : public IFDE_XMLNode | 86 class IFDE_XMLElement : public IFDE_XMLNode |
87 { | 87 { |
88 public: | 88 public: |
89 static IFDE_XMLElement* Create(const CFX_WideString &wsTag); | 89 static IFDE_XMLElement* Create(const CFX_WideString &wsTag); |
90 virtual void GetTagName(CFX_WideString &wsTag) const
= 0; | 90 virtual void GetTagName(CFX_WideString &wsTag) const
= 0; |
91 virtual void GetLocalTagName(CFX_WideString &wsTag) c
onst = 0; | 91 virtual void GetLocalTagName(CFX_WideString &wsTag) c
onst = 0; |
92 virtual void GetNamespacePrefix(CFX_WideString &wsPre
fix) const = 0; | 92 virtual void GetNamespacePrefix(CFX_WideString &wsPre
fix) const = 0; |
93 virtual void GetNamespaceURI(CFX_WideString &wsNamesp
ace) const = 0; | 93 virtual void GetNamespaceURI(CFX_WideString &wsNamesp
ace) const = 0; |
94 virtual FX_INT32» » CountAttributes() const = 0; | 94 virtual int32_t» » CountAttributes() const = 0; |
95 virtual FX_BOOL» » » GetAttribute(FX_INT32 index, CFX_WideStr
ing &wsAttriName, CFX_WideString &wsAttriValue) const = 0; | 95 virtual FX_BOOL» » » GetAttribute(int32_t index, CFX_WideStri
ng &wsAttriName, CFX_WideString &wsAttriValue) const = 0; |
96 virtual FX_BOOL HasAttribute(FX_LPCWSTR pwsAttriName) co
nst = 0; | 96 virtual FX_BOOL HasAttribute(FX_LPCWSTR pwsAttriName) co
nst = 0; |
97 virtual void GetString(FX_LPCWSTR pwsAttriName, CFX_W
ideString &wsAttriValue, FX_LPCWSTR pwsDefValue = NULL) const = 0; | 97 virtual void GetString(FX_LPCWSTR pwsAttriName, CFX_W
ideString &wsAttriValue, FX_LPCWSTR pwsDefValue = NULL) const = 0; |
98 virtual void SetString(const CFX_WideString &wsAttriN
ame, const CFX_WideString &wsAttriValue) = 0; | 98 virtual void SetString(const CFX_WideString &wsAttriN
ame, const CFX_WideString &wsAttriValue) = 0; |
99 virtual FX_INT32» » GetInteger(FX_LPCWSTR pwsAttriName, FX_INT32 iDe
fValue = 0) const = 0; | 99 virtual int32_t» » GetInteger(FX_LPCWSTR pwsAttriName, int32_t iDef
Value = 0) const = 0; |
100 virtual void» » » SetInteger(FX_LPCWSTR pwsAttriName, FX_I
NT32 iAttriValue) = 0; | 100 virtual void» » » SetInteger(FX_LPCWSTR pwsAttriName, int3
2_t iAttriValue) = 0; |
101 virtual FX_FLOAT GetFloat(FX_LPCWSTR pwsAttriName, FX_FLOAT fDefV
alue = 0) const = 0; | 101 virtual FX_FLOAT GetFloat(FX_LPCWSTR pwsAttriName, FX_FLOAT fDefV
alue = 0) const = 0; |
102 virtual void SetFloat(FX_LPCWSTR pwsAttriName, FX_FLO
AT fAttriValue) = 0; | 102 virtual void SetFloat(FX_LPCWSTR pwsAttriName, FX_FLO
AT fAttriValue) = 0; |
103 virtual void RemoveAttribute(FX_LPCWSTR pwsAttriName)
= 0; | 103 virtual void RemoveAttribute(FX_LPCWSTR pwsAttriName)
= 0; |
104 virtual void GetTextData(CFX_WideString &wsText) cons
t = 0; | 104 virtual void GetTextData(CFX_WideString &wsText) cons
t = 0; |
105 virtual void SetTextData(const CFX_WideString &wsText
) = 0; | 105 virtual void SetTextData(const CFX_WideString &wsText
) = 0; |
106 }; | 106 }; |
107 class IFDE_XMLText : public IFDE_XMLNode | 107 class IFDE_XMLText : public IFDE_XMLNode |
108 { | 108 { |
109 public: | 109 public: |
110 static IFDE_XMLText* Create(const CFX_WideString &wsText); | 110 static IFDE_XMLText* Create(const CFX_WideString &wsText); |
(...skipping 19 matching lines...) Expand all Loading... |
130 void (*OnTagBreak)(_FDE_XMLREADERHANDLER *pThis, const CFX_WideString
&wsTagName); | 130 void (*OnTagBreak)(_FDE_XMLREADERHANDLER *pThis, const CFX_WideString
&wsTagName); |
131 void (*OnTagClose)(_FDE_XMLREADERHANDLER *pThis, const CFX_WideString
&wsTagName); | 131 void (*OnTagClose)(_FDE_XMLREADERHANDLER *pThis, const CFX_WideString
&wsTagName); |
132 void (*OnAttribute)(_FDE_XMLREADERHANDLER *pThis, const CFX_WideStrin
g &wsName, const CFX_WideString &wsValue); | 132 void (*OnAttribute)(_FDE_XMLREADERHANDLER *pThis, const CFX_WideStrin
g &wsName, const CFX_WideString &wsValue); |
133 void (*OnData)(_FDE_XMLREADERHANDLER *pThis, FDE_XMLNODETYPE eType, c
onst CFX_WideString &wsValue); | 133 void (*OnData)(_FDE_XMLREADERHANDLER *pThis, FDE_XMLNODETYPE eType, c
onst CFX_WideString &wsValue); |
134 } FDE_XMLREADERHANDLER, * FDE_LPXMLREADERHANDLER; | 134 } FDE_XMLREADERHANDLER, * FDE_LPXMLREADERHANDLER; |
135 class IFDE_XMLDoc | 135 class IFDE_XMLDoc |
136 { | 136 { |
137 public: | 137 public: |
138 static IFDE_XMLDoc* Create(); | 138 static IFDE_XMLDoc* Create(); |
139 virtual void Release() = 0; | 139 virtual void Release() = 0; |
140 virtual FX_BOOL» » » LoadXML(IFX_Stream *pXMLStream, FX_INT32
iXMLPlaneSize = 8192, FX_INT32 iTextDataSize = 256, FDE_LPXMLREADERHANDLER pHan
dler = NULL) = 0; | 140 virtual FX_BOOL» » » LoadXML(IFX_Stream *pXMLStream, int32_t
iXMLPlaneSize = 8192, int32_t iTextDataSize = 256, FDE_LPXMLREADERHANDLER pHandl
er = NULL) = 0; |
141 virtual FX_BOOL LoadXML(IFDE_XMLParser *pXMLParser) = 0; | 141 virtual FX_BOOL LoadXML(IFDE_XMLParser *pXMLParser) = 0; |
142 virtual FX_INT32» » DoLoad(IFX_Pause *pPause = NULL) = 0; | 142 virtual int32_t» » DoLoad(IFX_Pause *pPause = NULL) = 0; |
143 virtual void CloseXML() = 0; | 143 virtual void CloseXML() = 0; |
144 virtual IFDE_XMLNode* GetRoot() const = 0; | 144 virtual IFDE_XMLNode* GetRoot() const = 0; |
145 virtual void SaveXML(IFX_Stream *pXMLStream = NULL, F
X_BOOL bSaveBOM = TRUE) = 0; | 145 virtual void SaveXML(IFX_Stream *pXMLStream = NULL, F
X_BOOL bSaveBOM = TRUE) = 0; |
146 virtual void SaveXMLNode(IFX_Stream *pXMLStream, IFDE
_XMLNode *pNode) = 0; | 146 virtual void SaveXMLNode(IFX_Stream *pXMLStream, IFDE
_XMLNode *pNode) = 0; |
147 }; | 147 }; |
148 class IFDE_XMLParser | 148 class IFDE_XMLParser |
149 { | 149 { |
150 public: | 150 public: |
151 virtual void Release() = 0; | 151 virtual void Release() = 0; |
152 virtual FX_INT32» » » DoParser(IFX_Pause *pPause) = 0; | 152 virtual int32_t» » » DoParser(IFX_Pause *pPause) = 0; |
153 }; | 153 }; |
154 #define FDE_XMLSYNTAXSTATUS_None 0x00 | 154 #define FDE_XMLSYNTAXSTATUS_None 0x00 |
155 #define FDE_XMLSYNTAXSTATUS_InstructionOpen 0x01 | 155 #define FDE_XMLSYNTAXSTATUS_InstructionOpen 0x01 |
156 #define FDE_XMLSYNTAXSTATUS_InstructionClose 0x02 | 156 #define FDE_XMLSYNTAXSTATUS_InstructionClose 0x02 |
157 #define FDE_XMLSYNTAXSTATUS_ElementOpen 0x03 | 157 #define FDE_XMLSYNTAXSTATUS_ElementOpen 0x03 |
158 #define FDE_XMLSYNTAXSTATUS_ElementBreak 0x04 | 158 #define FDE_XMLSYNTAXSTATUS_ElementBreak 0x04 |
159 #define FDE_XMLSYNTAXSTATUS_ElementClose 0x05 | 159 #define FDE_XMLSYNTAXSTATUS_ElementClose 0x05 |
160 #define FDE_XMLSYNTAXSTATUS_TargetName 0x06 | 160 #define FDE_XMLSYNTAXSTATUS_TargetName 0x06 |
161 #define FDE_XMLSYNTAXSTATUS_TagName 0x07 | 161 #define FDE_XMLSYNTAXSTATUS_TagName 0x07 |
162 #define FDE_XMLSYNTAXSTATUS_AttriName 0x08 | 162 #define FDE_XMLSYNTAXSTATUS_AttriName 0x08 |
163 #define FDE_XMLSYNTAXSTATUS_AttriValue 0x09 | 163 #define FDE_XMLSYNTAXSTATUS_AttriValue 0x09 |
164 #define FDE_XMLSYNTAXSTATUS_Text 0x0A | 164 #define FDE_XMLSYNTAXSTATUS_Text 0x0A |
165 #define FDE_XMLSYNTAXSTATUS_CData 0x0B | 165 #define FDE_XMLSYNTAXSTATUS_CData 0x0B |
166 #define FDE_XMLSYNTAXSTATUS_TargetData 0x0C | 166 #define FDE_XMLSYNTAXSTATUS_TargetData 0x0C |
167 #define FDE_XMLSYNTAXSTATUS_Error 0xFE | 167 #define FDE_XMLSYNTAXSTATUS_Error 0xFE |
168 #define FDE_XMLSYNTAXSTATUS_EOS 0xFF | 168 #define FDE_XMLSYNTAXSTATUS_EOS 0xFF |
169 class IFDE_XMLSyntaxParser | 169 class IFDE_XMLSyntaxParser |
170 { | 170 { |
171 public: | 171 public: |
172 static IFDE_XMLSyntaxParser* Create(); | 172 static IFDE_XMLSyntaxParser* Create(); |
173 virtual void Release() = 0; | 173 virtual void Release() = 0; |
174 virtual void» » » Init(IFX_Stream *pStream, FX_INT32 iXMLP
laneSize, FX_INT32 iTextDataSize = 256) = 0; | 174 virtual void» » » Init(IFX_Stream *pStream, int32_t iXMLPl
aneSize, int32_t iTextDataSize = 256) = 0; |
175 virtual FX_DWORD DoSyntaxParse() = 0; | 175 virtual FX_DWORD DoSyntaxParse() = 0; |
176 virtual FX_INT32» » GetStatus() const = 0; | 176 virtual int32_t» » GetStatus() const = 0; |
177 virtual FX_INT32» » GetCurrentPos() const = 0; | 177 virtual int32_t» » GetCurrentPos() const = 0; |
178 virtual FX_FILESIZE GetCurrentBinaryPos() const = 0; | 178 virtual FX_FILESIZE GetCurrentBinaryPos() const = 0; |
179 virtual FX_INT32» » GetCurrentNodeNumber() const = 0; | 179 virtual int32_t» » GetCurrentNodeNumber() const = 0; |
180 virtual FX_INT32» » GetLastNodeNumber() const = 0; | 180 virtual int32_t» » GetLastNodeNumber() const = 0; |
181 virtual void GetTargetName(CFX_WideString &wsTarget)
const = 0; | 181 virtual void GetTargetName(CFX_WideString &wsTarget)
const = 0; |
182 virtual void GetTagName(CFX_WideString &wsTag) const
= 0; | 182 virtual void GetTagName(CFX_WideString &wsTag) const
= 0; |
183 virtual void GetAttributeName(CFX_WideString &wsAttri
Name) const = 0; | 183 virtual void GetAttributeName(CFX_WideString &wsAttri
Name) const = 0; |
184 virtual void GetAttributeValue(CFX_WideString &wsAttr
iValue) const = 0; | 184 virtual void GetAttributeValue(CFX_WideString &wsAttr
iValue) const = 0; |
185 virtual void GetTextData(CFX_WideString &wsText) cons
t = 0; | 185 virtual void GetTextData(CFX_WideString &wsText) cons
t = 0; |
186 virtual void GetTargetData(CFX_WideString &wsData) co
nst = 0; | 186 virtual void GetTargetData(CFX_WideString &wsData) co
nst = 0; |
187 }; | 187 }; |
188 #endif | 188 #endif |
OLD | NEW |