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 #include "xfa/fgas/xml/fgas_sax.h" | 7 #include "xfa/fde/xml/cfx_saxreader.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "xfa/fxfa/include/xfa_checksum.h" | 11 #include "xfa/fxfa/include/xfa_checksum.h" |
12 | 12 |
| 13 enum class CFX_SaxMode { |
| 14 Text = 0, |
| 15 NodeStart, |
| 16 DeclOrComment, |
| 17 DeclNode, |
| 18 Comment, |
| 19 CommentContent, |
| 20 TagName, |
| 21 TagAttributeName, |
| 22 TagAttributeEqual, |
| 23 TagAttributeValue, |
| 24 TagMaybeClose, |
| 25 TagClose, |
| 26 TagEnd, |
| 27 TargetData, |
| 28 MAX |
| 29 }; |
| 30 |
| 31 class CFX_SAXCommentContext { |
| 32 public: |
| 33 CFX_SAXCommentContext() : m_iHeaderCount(0), m_iTailCount(0) {} |
| 34 int32_t m_iHeaderCount; |
| 35 int32_t m_iTailCount; |
| 36 }; |
| 37 |
13 namespace { | 38 namespace { |
14 | 39 |
15 const uint32_t kSaxFileBufSize = 32768; | 40 const uint32_t kSaxFileBufSize = 32768; |
16 | 41 |
| 42 typedef void (CFX_SAXReader::*FX_SAXReader_LPFParse)(); |
| 43 static const FX_SAXReader_LPFParse |
| 44 g_FX_SAXReader_LPFParse[static_cast<int>(CFX_SaxMode::MAX)] = { |
| 45 &CFX_SAXReader::ParseText, |
| 46 &CFX_SAXReader::ParseNodeStart, |
| 47 &CFX_SAXReader::ParseDeclOrComment, |
| 48 &CFX_SAXReader::ParseDeclNode, |
| 49 &CFX_SAXReader::ParseComment, |
| 50 &CFX_SAXReader::ParseCommentContent, |
| 51 &CFX_SAXReader::ParseTagName, |
| 52 &CFX_SAXReader::ParseTagAttributeName, |
| 53 &CFX_SAXReader::ParseTagAttributeEqual, |
| 54 &CFX_SAXReader::ParseTagAttributeValue, |
| 55 &CFX_SAXReader::ParseMaybeClose, |
| 56 &CFX_SAXReader::ParseTagClose, |
| 57 &CFX_SAXReader::ParseTagEnd, |
| 58 &CFX_SAXReader::ParseTargetData, |
| 59 }; |
| 60 |
17 } // namespace | 61 } // namespace |
18 | 62 |
19 CFX_SAXFile::CFX_SAXFile() | 63 CFX_SAXFile::CFX_SAXFile() |
20 : m_pFile(NULL), | 64 : m_pFile(nullptr), |
21 m_dwStart(0), | 65 m_dwStart(0), |
22 m_dwEnd(0), | 66 m_dwEnd(0), |
23 m_dwCur(0), | 67 m_dwCur(0), |
24 m_pBuf(NULL), | 68 m_pBuf(nullptr), |
25 m_dwBufSize(0), | 69 m_dwBufSize(0), |
26 m_dwBufIndex(0) {} | 70 m_dwBufIndex(0) {} |
27 FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile, | 71 FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile, |
28 uint32_t dwStart, | 72 uint32_t dwStart, |
29 uint32_t dwLen) { | 73 uint32_t dwLen) { |
30 ASSERT(m_pFile == NULL && pFile != NULL); | 74 ASSERT(!m_pFile && pFile); |
31 uint32_t dwSize = pFile->GetSize(); | 75 uint32_t dwSize = pFile->GetSize(); |
32 if (dwStart >= dwSize) { | 76 if (dwStart >= dwSize) { |
33 return FALSE; | 77 return FALSE; |
34 } | 78 } |
35 if (dwLen == static_cast<uint32_t>(-1) || dwStart + dwLen > dwSize) { | 79 if (dwLen == static_cast<uint32_t>(-1) || dwStart + dwLen > dwSize) { |
36 dwLen = dwSize - dwStart; | 80 dwLen = dwSize - dwStart; |
37 } | 81 } |
38 if (dwLen == 0) { | 82 if (dwLen == 0) { |
39 return FALSE; | 83 return FALSE; |
40 } | 84 } |
41 m_dwBufSize = std::min(dwLen, kSaxFileBufSize); | 85 m_dwBufSize = std::min(dwLen, kSaxFileBufSize); |
42 m_pBuf = FX_Alloc(uint8_t, m_dwBufSize); | 86 m_pBuf = FX_Alloc(uint8_t, m_dwBufSize); |
43 if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize)) { | 87 if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize)) { |
44 return FALSE; | 88 return FALSE; |
45 } | 89 } |
46 m_dwStart = dwStart; | 90 m_dwStart = dwStart; |
47 m_dwEnd = dwStart + dwLen; | 91 m_dwEnd = dwStart + dwLen; |
48 m_dwCur = dwStart; | 92 m_dwCur = dwStart; |
49 m_pFile = pFile; | 93 m_pFile = pFile; |
50 m_dwBufIndex = 0; | 94 m_dwBufIndex = 0; |
51 return TRUE; | 95 return TRUE; |
52 } | 96 } |
53 FX_BOOL CFX_SAXFile::ReadNextBlock() { | 97 FX_BOOL CFX_SAXFile::ReadNextBlock() { |
54 ASSERT(m_pFile != NULL); | 98 ASSERT(m_pFile); |
55 uint32_t dwSize = m_dwEnd - m_dwCur; | 99 uint32_t dwSize = m_dwEnd - m_dwCur; |
56 if (dwSize == 0) { | 100 if (dwSize == 0) { |
57 return FALSE; | 101 return FALSE; |
58 } | 102 } |
59 m_dwBufSize = std::min(dwSize, kSaxFileBufSize); | 103 m_dwBufSize = std::min(dwSize, kSaxFileBufSize); |
60 if (!m_pFile->ReadBlock(m_pBuf, m_dwCur, m_dwBufSize)) { | 104 if (!m_pFile->ReadBlock(m_pBuf, m_dwCur, m_dwBufSize)) { |
61 return FALSE; | 105 return FALSE; |
62 } | 106 } |
63 m_dwBufIndex = 0; | 107 m_dwBufIndex = 0; |
64 return TRUE; | 108 return TRUE; |
65 } | 109 } |
66 void CFX_SAXFile::Reset() { | 110 void CFX_SAXFile::Reset() { |
67 if (m_pBuf) { | 111 if (m_pBuf) { |
68 FX_Free(m_pBuf); | 112 FX_Free(m_pBuf); |
69 m_pBuf = NULL; | 113 m_pBuf = nullptr; |
70 } | 114 } |
71 m_pFile = NULL; | 115 m_pFile = nullptr; |
72 } | 116 } |
73 CFX_SAXReader::CFX_SAXReader() | 117 CFX_SAXReader::CFX_SAXReader() |
74 : m_File(), | 118 : m_File(), |
75 m_pHandler(nullptr), | 119 m_pHandler(nullptr), |
76 m_iState(-1), | 120 m_iState(-1), |
77 m_pRoot(nullptr), | 121 m_pRoot(nullptr), |
78 m_pCurItem(nullptr), | 122 m_pCurItem(nullptr), |
79 m_dwItemID(0), | 123 m_dwItemID(0), |
80 m_iDataSize(256), | 124 m_iDataSize(256), |
81 m_iNameSize(256), | 125 m_iNameSize(256), |
82 m_dwParseMode(0), | 126 m_dwParseMode(0), |
83 m_pCommentContext(nullptr) { | 127 m_pCommentContext(nullptr) { |
84 m_pszData = FX_Alloc(uint8_t, m_iDataSize); | 128 m_pszData = FX_Alloc(uint8_t, m_iDataSize); |
85 m_pszName = FX_Alloc(uint8_t, m_iNameSize); | 129 m_pszName = FX_Alloc(uint8_t, m_iNameSize); |
86 } | 130 } |
87 CFX_SAXReader::~CFX_SAXReader() { | 131 CFX_SAXReader::~CFX_SAXReader() { |
88 Reset(); | 132 Reset(); |
89 if (m_pszData) { | 133 if (m_pszData) { |
90 FX_Free(m_pszData); | 134 FX_Free(m_pszData); |
91 m_pszData = NULL; | 135 m_pszData = nullptr; |
92 } | 136 } |
93 if (m_pszName) { | 137 if (m_pszName) { |
94 FX_Free(m_pszName); | 138 FX_Free(m_pszName); |
95 m_pszName = NULL; | 139 m_pszName = nullptr; |
96 } | 140 } |
97 } | 141 } |
98 void CFX_SAXReader::Reset() { | 142 void CFX_SAXReader::Reset() { |
99 m_File.Reset(); | 143 m_File.Reset(); |
100 CFX_SAXItem* pItem = m_pRoot; | 144 CFX_SAXItem* pItem = m_pRoot; |
101 while (pItem) { | 145 while (pItem) { |
102 CFX_SAXItem* pNext = pItem->m_pNext; | 146 CFX_SAXItem* pNext = pItem->m_pNext; |
103 delete pItem; | 147 delete pItem; |
104 pItem = pNext; | 148 pItem = pNext; |
105 } | 149 } |
106 m_pRoot = NULL; | 150 m_pRoot = nullptr; |
107 m_pCurItem = NULL; | 151 m_pCurItem = nullptr; |
108 m_dwItemID = 0; | 152 m_dwItemID = 0; |
109 m_SkipStack.RemoveAll(); | 153 m_SkipStack.RemoveAll(); |
110 m_SkipChar = 0; | 154 m_SkipChar = 0; |
111 m_iDataLength = 0; | 155 m_iDataLength = 0; |
112 m_iEntityStart = -1; | 156 m_iEntityStart = -1; |
113 m_iNameLength = 0; | 157 m_iNameLength = 0; |
114 m_iDataPos = 0; | 158 m_iDataPos = 0; |
115 if (m_pCommentContext) { | 159 if (m_pCommentContext) { |
116 delete m_pCommentContext; | 160 delete m_pCommentContext; |
117 m_pCommentContext = NULL; | 161 m_pCommentContext = nullptr; |
118 } | 162 } |
119 } | 163 } |
120 inline void CFX_SAXReader::Push() { | 164 inline void CFX_SAXReader::Push() { |
121 CFX_SAXItem* pNew = new CFX_SAXItem; | 165 CFX_SAXItem* pNew = new CFX_SAXItem; |
122 pNew->m_dwID = ++m_dwItemID; | 166 pNew->m_dwID = ++m_dwItemID; |
123 pNew->m_bSkip = m_pCurItem->m_bSkip; | 167 pNew->m_bSkip = m_pCurItem->m_bSkip; |
124 pNew->m_pPrev = m_pCurItem; | 168 pNew->m_pPrev = m_pCurItem; |
125 m_pCurItem->m_pNext = pNew; | 169 m_pCurItem->m_pNext = pNew; |
126 m_pCurItem = pNew; | 170 m_pCurItem = pNew; |
127 } | 171 } |
128 inline void CFX_SAXReader::Pop() { | 172 inline void CFX_SAXReader::Pop() { |
129 if (!m_pCurItem) { | 173 if (!m_pCurItem) { |
130 return; | 174 return; |
131 } | 175 } |
132 CFX_SAXItem* pPrev = m_pCurItem->m_pPrev; | 176 CFX_SAXItem* pPrev = m_pCurItem->m_pPrev; |
133 pPrev->m_pNext = NULL; | 177 pPrev->m_pNext = nullptr; |
134 delete m_pCurItem; | 178 delete m_pCurItem; |
135 m_pCurItem = pPrev; | 179 m_pCurItem = pPrev; |
136 } | 180 } |
137 inline void CFX_SAXReader::AppendData(uint8_t ch) { | 181 inline void CFX_SAXReader::AppendData(uint8_t ch) { |
138 ReallocDataBuffer(); | 182 ReallocDataBuffer(); |
139 m_pszData[m_iDataPos++] = ch; | 183 m_pszData[m_iDataPos++] = ch; |
140 } | 184 } |
141 inline void CFX_SAXReader::AppendName(uint8_t ch) { | 185 inline void CFX_SAXReader::AppendName(uint8_t ch) { |
142 ReallocNameBuffer(); | 186 ReallocNameBuffer(); |
143 m_pszName[m_iDataPos++] = ch; | 187 m_pszName[m_iDataPos++] = ch; |
(...skipping 14 matching lines...) Expand all Loading... |
158 return; | 202 return; |
159 } | 203 } |
160 if (m_iNameSize <= 1024 * 1024) { | 204 if (m_iNameSize <= 1024 * 1024) { |
161 m_iNameSize *= 2; | 205 m_iNameSize *= 2; |
162 } else { | 206 } else { |
163 m_iNameSize += 1024 * 1024; | 207 m_iNameSize += 1024 * 1024; |
164 } | 208 } |
165 m_pszName = (uint8_t*)FX_Realloc(uint8_t, m_pszName, m_iNameSize); | 209 m_pszName = (uint8_t*)FX_Realloc(uint8_t, m_pszName, m_iNameSize); |
166 } | 210 } |
167 inline FX_BOOL CFX_SAXReader::SkipSpace(uint8_t ch) { | 211 inline FX_BOOL CFX_SAXReader::SkipSpace(uint8_t ch) { |
168 return (m_dwParseMode & FX_SAXPARSEMODE_NotSkipSpace) == 0 && ch < 0x21; | 212 return (m_dwParseMode & CFX_SaxParseMode_NotSkipSpace) == 0 && ch < 0x21; |
169 } | 213 } |
170 int32_t CFX_SAXReader::StartParse(IFX_FileRead* pFile, | 214 int32_t CFX_SAXReader::StartParse(IFX_FileRead* pFile, |
171 uint32_t dwStart, | 215 uint32_t dwStart, |
172 uint32_t dwLen, | 216 uint32_t dwLen, |
173 uint32_t dwParseMode) { | 217 uint32_t dwParseMode) { |
174 m_iState = -1; | 218 m_iState = -1; |
175 Reset(); | 219 Reset(); |
176 if (!m_File.StartFile(pFile, dwStart, dwLen)) { | 220 if (!m_File.StartFile(pFile, dwStart, dwLen)) { |
177 return -1; | 221 return -1; |
178 } | 222 } |
179 m_iState = 0; | 223 m_iState = 0; |
180 m_eMode = FX_SAXMODE_Text; | 224 m_eMode = CFX_SaxMode::Text; |
181 m_ePrevMode = FX_SAXMODE_Text; | 225 m_ePrevMode = CFX_SaxMode::Text; |
182 m_bCharData = FALSE; | 226 m_bCharData = FALSE; |
183 m_dwDataOffset = 0; | 227 m_dwDataOffset = 0; |
184 m_pRoot = m_pCurItem = new CFX_SAXItem; | 228 m_pRoot = m_pCurItem = new CFX_SAXItem; |
185 m_pCurItem->m_dwID = ++m_dwItemID; | 229 m_pCurItem->m_dwID = ++m_dwItemID; |
186 m_dwParseMode = dwParseMode; | 230 m_dwParseMode = dwParseMode; |
187 return 0; | 231 return 0; |
188 } | 232 } |
189 typedef void (CFX_SAXReader::*FX_SAXReader_LPFParse)(); | 233 |
190 static const FX_SAXReader_LPFParse g_FX_SAXReader_LPFParse[FX_SAXMODE_MAX] = { | |
191 &CFX_SAXReader::ParseText, | |
192 &CFX_SAXReader::ParseNodeStart, | |
193 &CFX_SAXReader::ParseDeclOrComment, | |
194 &CFX_SAXReader::ParseDeclNode, | |
195 &CFX_SAXReader::ParseComment, | |
196 &CFX_SAXReader::ParseCommentContent, | |
197 &CFX_SAXReader::ParseTagName, | |
198 &CFX_SAXReader::ParseTagAttributeName, | |
199 &CFX_SAXReader::ParseTagAttributeEqual, | |
200 &CFX_SAXReader::ParseTagAttributeValue, | |
201 &CFX_SAXReader::ParseMaybeClose, | |
202 &CFX_SAXReader::ParseTagClose, | |
203 &CFX_SAXReader::ParseTagEnd, | |
204 &CFX_SAXReader::ParseTargetData, | |
205 }; | |
206 int32_t CFX_SAXReader::ContinueParse(IFX_Pause* pPause) { | 234 int32_t CFX_SAXReader::ContinueParse(IFX_Pause* pPause) { |
207 if (m_iState < 0 || m_iState > 99) { | 235 if (m_iState < 0 || m_iState > 99) { |
208 return m_iState; | 236 return m_iState; |
209 } | 237 } |
210 while (m_File.m_dwCur < m_File.m_dwEnd) { | 238 while (m_File.m_dwCur < m_File.m_dwEnd) { |
211 uint32_t& index = m_File.m_dwBufIndex; | 239 uint32_t& index = m_File.m_dwBufIndex; |
212 uint32_t size = m_File.m_dwBufSize; | 240 uint32_t size = m_File.m_dwBufSize; |
213 const uint8_t* pBuf = m_File.m_pBuf; | 241 const uint8_t* pBuf = m_File.m_pBuf; |
214 while (index < size) { | 242 while (index < size) { |
215 m_CurByte = pBuf[index]; | 243 m_CurByte = pBuf[index]; |
216 (this->*g_FX_SAXReader_LPFParse[m_eMode])(); | 244 (this->*g_FX_SAXReader_LPFParse[static_cast<int>(m_eMode)])(); |
217 index++; | 245 index++; |
218 } | 246 } |
219 m_File.m_dwCur += index; | 247 m_File.m_dwCur += index; |
220 m_iState = (m_File.m_dwCur - m_File.m_dwStart) * 100 / | 248 m_iState = (m_File.m_dwCur - m_File.m_dwStart) * 100 / |
221 (m_File.m_dwEnd - m_File.m_dwStart); | 249 (m_File.m_dwEnd - m_File.m_dwStart); |
222 if (m_File.m_dwCur >= m_File.m_dwEnd) { | 250 if (m_File.m_dwCur >= m_File.m_dwEnd) { |
223 break; | 251 break; |
224 } | 252 } |
225 if (!m_File.ReadNextBlock()) { | 253 if (!m_File.ReadNextBlock()) { |
226 m_iState = -2; | 254 m_iState = -2; |
227 break; | 255 break; |
228 } | 256 } |
229 m_dwDataOffset = 0; | 257 m_dwDataOffset = 0; |
230 if (pPause && pPause->NeedToPauseNow()) { | 258 if (pPause && pPause->NeedToPauseNow()) { |
231 break; | 259 break; |
232 } | 260 } |
233 } | 261 } |
234 return m_iState; | 262 return m_iState; |
235 } | 263 } |
236 void CFX_SAXReader::ParseChar(uint8_t ch) { | 264 void CFX_SAXReader::ParseChar(uint8_t ch) { |
237 ReallocDataBuffer(); | 265 ReallocDataBuffer(); |
238 m_pszData[m_iDataPos] = ch; | 266 m_pszData[m_iDataPos] = ch; |
239 if (m_iEntityStart > -1 && ch == ';') { | 267 if (m_iEntityStart > -1 && ch == ';') { |
240 int32_t iSaveEntityStart = m_iEntityStart; | 268 int32_t iSaveEntityStart = m_iEntityStart; |
241 CFX_ByteString csEntity(m_pszData + m_iEntityStart + 1, | 269 CFX_ByteString csEntity(m_pszData + m_iEntityStart + 1, |
242 m_iDataPos - m_iEntityStart - 1); | 270 m_iDataPos - m_iEntityStart - 1); |
243 int32_t iLen = csEntity.GetLength(); | 271 int32_t iLen = csEntity.GetLength(); |
244 if (iLen > 0) { | 272 if (iLen > 0) { |
245 if (csEntity[0] == '#') { | 273 if (csEntity[0] == '#') { |
246 if ((m_dwParseMode & FX_SAXPARSEMODE_NotConvert_sharp) == 0) { | 274 if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_sharp) == 0) { |
247 ch = 0; | 275 ch = 0; |
248 uint8_t w; | 276 uint8_t w; |
249 if (iLen > 1 && csEntity[1] == 'x') { | 277 if (iLen > 1 && csEntity[1] == 'x') { |
250 for (int32_t i = 2; i < iLen; i++) { | 278 for (int32_t i = 2; i < iLen; i++) { |
251 w = csEntity[i]; | 279 w = csEntity[i]; |
252 if (w >= '0' && w <= '9') { | 280 if (w >= '0' && w <= '9') { |
253 ch = (ch << 4) + w - '0'; | 281 ch = (ch << 4) + w - '0'; |
254 } else if (w >= 'A' && w <= 'F') { | 282 } else if (w >= 'A' && w <= 'F') { |
255 ch = (ch << 4) + w - 55; | 283 ch = (ch << 4) + w - 55; |
256 } else if (w >= 'a' && w <= 'f') { | 284 } else if (w >= 'a' && w <= 'f') { |
(...skipping 10 matching lines...) Expand all Loading... |
267 } | 295 } |
268 ch = ch * 10 + w - '0'; | 296 ch = ch * 10 + w - '0'; |
269 } | 297 } |
270 } | 298 } |
271 if (ch != 0) { | 299 if (ch != 0) { |
272 m_pszData[m_iEntityStart++] = ch; | 300 m_pszData[m_iEntityStart++] = ch; |
273 } | 301 } |
274 } | 302 } |
275 } else { | 303 } else { |
276 if (csEntity.Compare("amp") == 0) { | 304 if (csEntity.Compare("amp") == 0) { |
277 if ((m_dwParseMode & FX_SAXPARSEMODE_NotConvert_amp) == 0) { | 305 if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_amp) == 0) { |
278 m_pszData[m_iEntityStart++] = '&'; | 306 m_pszData[m_iEntityStart++] = '&'; |
279 } | 307 } |
280 } else if (csEntity.Compare("lt") == 0) { | 308 } else if (csEntity.Compare("lt") == 0) { |
281 if ((m_dwParseMode & FX_SAXPARSEMODE_NotConvert_lt) == 0) { | 309 if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_lt) == 0) { |
282 m_pszData[m_iEntityStart++] = '<'; | 310 m_pszData[m_iEntityStart++] = '<'; |
283 } | 311 } |
284 } else if (csEntity.Compare("gt") == 0) { | 312 } else if (csEntity.Compare("gt") == 0) { |
285 if ((m_dwParseMode & FX_SAXPARSEMODE_NotConvert_gt) == 0) { | 313 if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_gt) == 0) { |
286 m_pszData[m_iEntityStart++] = '>'; | 314 m_pszData[m_iEntityStart++] = '>'; |
287 } | 315 } |
288 } else if (csEntity.Compare("apos") == 0) { | 316 } else if (csEntity.Compare("apos") == 0) { |
289 if ((m_dwParseMode & FX_SAXPARSEMODE_NotConvert_apos) == 0) { | 317 if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_apos) == 0) { |
290 m_pszData[m_iEntityStart++] = '\''; | 318 m_pszData[m_iEntityStart++] = '\''; |
291 } | 319 } |
292 } else if (csEntity.Compare("quot") == 0) { | 320 } else if (csEntity.Compare("quot") == 0) { |
293 if ((m_dwParseMode & FX_SAXPARSEMODE_NotConvert_quot) == 0) { | 321 if ((m_dwParseMode & CFX_SaxParseMode_NotConvert_quot) == 0) { |
294 m_pszData[m_iEntityStart++] = '\"'; | 322 m_pszData[m_iEntityStart++] = '\"'; |
295 } | 323 } |
296 } | 324 } |
297 } | 325 } |
298 } | 326 } |
299 if (iSaveEntityStart != m_iEntityStart) { | 327 if (iSaveEntityStart != m_iEntityStart) { |
300 m_iDataPos = m_iEntityStart; | 328 m_iDataPos = m_iEntityStart; |
301 m_iEntityStart = -1; | 329 m_iEntityStart = -1; |
302 } else { | 330 } else { |
303 m_iDataPos++; | 331 m_iDataPos++; |
(...skipping 10 matching lines...) Expand all Loading... |
314 if (m_CurByte == '<') { | 342 if (m_CurByte == '<') { |
315 if (m_iDataPos > 0) { | 343 if (m_iDataPos > 0) { |
316 m_iDataLength = m_iDataPos; | 344 m_iDataLength = m_iDataPos; |
317 m_iDataPos = 0; | 345 m_iDataPos = 0; |
318 if (m_pHandler) { | 346 if (m_pHandler) { |
319 NotifyData(); | 347 NotifyData(); |
320 } | 348 } |
321 } | 349 } |
322 Push(); | 350 Push(); |
323 m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex; | 351 m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex; |
324 m_eMode = FX_SAXMODE_NodeStart; | 352 m_eMode = CFX_SaxMode::NodeStart; |
325 return; | 353 return; |
326 } | 354 } |
327 if (m_iDataPos < 1 && SkipSpace(m_CurByte)) { | 355 if (m_iDataPos < 1 && SkipSpace(m_CurByte)) { |
328 return; | 356 return; |
329 } | 357 } |
330 ParseChar(m_CurByte); | 358 ParseChar(m_CurByte); |
331 } | 359 } |
332 void CFX_SAXReader::ParseNodeStart() { | 360 void CFX_SAXReader::ParseNodeStart() { |
333 if (m_CurByte == '?') { | 361 if (m_CurByte == '?') { |
334 m_pCurItem->m_eNode = FX_SAXNODE_Instruction; | 362 m_pCurItem->m_eNode = CFX_SAXItem::Type::Instruction; |
335 m_eMode = FX_SAXMODE_TagName; | 363 m_eMode = CFX_SaxMode::TagName; |
336 return; | 364 return; |
337 } | 365 } |
338 if (m_CurByte == '!') { | 366 if (m_CurByte == '!') { |
339 m_eMode = FX_SAXMODE_DeclOrComment; | 367 m_eMode = CFX_SaxMode::DeclOrComment; |
340 return; | 368 return; |
341 } | 369 } |
342 if (m_CurByte == '/') { | 370 if (m_CurByte == '/') { |
343 m_eMode = FX_SAXMODE_TagEnd; | 371 m_eMode = CFX_SaxMode::TagEnd; |
344 return; | 372 return; |
345 } | 373 } |
346 if (m_CurByte == '>') { | 374 if (m_CurByte == '>') { |
347 Pop(); | 375 Pop(); |
348 m_eMode = FX_SAXMODE_Text; | 376 m_eMode = CFX_SaxMode::Text; |
349 return; | 377 return; |
350 } | 378 } |
351 if (m_CurByte > 0x20) { | 379 if (m_CurByte > 0x20) { |
352 m_dwDataOffset = m_File.m_dwBufIndex; | 380 m_dwDataOffset = m_File.m_dwBufIndex; |
353 m_pCurItem->m_eNode = FX_SAXNODE_Tag; | 381 m_pCurItem->m_eNode = CFX_SAXItem::Type::Tag; |
354 m_eMode = FX_SAXMODE_TagName; | 382 m_eMode = CFX_SaxMode::TagName; |
355 AppendData(m_CurByte); | 383 AppendData(m_CurByte); |
356 } | 384 } |
357 } | 385 } |
358 void CFX_SAXReader::ParseDeclOrComment() { | 386 void CFX_SAXReader::ParseDeclOrComment() { |
359 if (m_CurByte == '-') { | 387 if (m_CurByte == '-') { |
360 m_eMode = FX_SAXMODE_Comment; | 388 m_eMode = CFX_SaxMode::Comment; |
361 m_pCurItem->m_eNode = FX_SAXNODE_Comment; | 389 m_pCurItem->m_eNode = CFX_SAXItem::Type::Comment; |
362 if (m_pCommentContext == NULL) { | 390 if (!m_pCommentContext) |
363 m_pCommentContext = new CFX_SAXCommentContext; | 391 m_pCommentContext = new CFX_SAXCommentContext; |
364 } | 392 |
365 m_pCommentContext->m_iHeaderCount = 1; | 393 m_pCommentContext->m_iHeaderCount = 1; |
366 m_pCommentContext->m_iTailCount = 0; | 394 m_pCommentContext->m_iTailCount = 0; |
367 } else { | 395 } else { |
368 m_eMode = FX_SAXMODE_DeclNode; | 396 m_eMode = CFX_SaxMode::DeclNode; |
369 m_dwDataOffset = m_File.m_dwBufIndex; | 397 m_dwDataOffset = m_File.m_dwBufIndex; |
370 m_SkipChar = '>'; | 398 m_SkipChar = '>'; |
371 m_SkipStack.Add('>'); | 399 m_SkipStack.Add('>'); |
372 SkipNode(); | 400 SkipNode(); |
373 } | 401 } |
374 } | 402 } |
375 void CFX_SAXReader::ParseComment() { | 403 void CFX_SAXReader::ParseComment() { |
376 m_pCommentContext->m_iHeaderCount = 2; | 404 m_pCommentContext->m_iHeaderCount = 2; |
377 m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex; | 405 m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex; |
378 m_eMode = FX_SAXMODE_CommentContent; | 406 m_eMode = CFX_SaxMode::CommentContent; |
379 } | 407 } |
380 void CFX_SAXReader::ParseCommentContent() { | 408 void CFX_SAXReader::ParseCommentContent() { |
381 if (m_CurByte == '-') { | 409 if (m_CurByte == '-') { |
382 m_pCommentContext->m_iTailCount++; | 410 m_pCommentContext->m_iTailCount++; |
383 } else if (m_CurByte == '>' && m_pCommentContext->m_iTailCount == 2) { | 411 } else if (m_CurByte == '>' && m_pCommentContext->m_iTailCount == 2) { |
384 m_iDataLength = m_iDataPos; | 412 m_iDataLength = m_iDataPos; |
385 m_iDataPos = 0; | 413 m_iDataPos = 0; |
386 if (m_pHandler) { | 414 if (m_pHandler) { |
387 NotifyTargetData(); | 415 NotifyTargetData(); |
388 } | 416 } |
389 Pop(); | 417 Pop(); |
390 m_eMode = FX_SAXMODE_Text; | 418 m_eMode = CFX_SaxMode::Text; |
391 } else { | 419 } else { |
392 while (m_pCommentContext->m_iTailCount > 0) { | 420 while (m_pCommentContext->m_iTailCount > 0) { |
393 AppendData('-'); | 421 AppendData('-'); |
394 m_pCommentContext->m_iTailCount--; | 422 m_pCommentContext->m_iTailCount--; |
395 } | 423 } |
396 AppendData(m_CurByte); | 424 AppendData(m_CurByte); |
397 } | 425 } |
398 } | 426 } |
399 void CFX_SAXReader::ParseDeclNode() { | 427 void CFX_SAXReader::ParseDeclNode() { |
400 SkipNode(); | 428 SkipNode(); |
401 } | 429 } |
402 void CFX_SAXReader::ParseTagName() { | 430 void CFX_SAXReader::ParseTagName() { |
403 if (m_CurByte < 0x21 || m_CurByte == '/' || m_CurByte == '>' || | 431 if (m_CurByte < 0x21 || m_CurByte == '/' || m_CurByte == '>' || |
404 m_CurByte == '?') { | 432 m_CurByte == '?') { |
405 m_iDataLength = m_iDataPos; | 433 m_iDataLength = m_iDataPos; |
406 m_iDataPos = 0; | 434 m_iDataPos = 0; |
407 if (m_pHandler) { | 435 if (m_pHandler) { |
408 NotifyEnter(); | 436 NotifyEnter(); |
409 } | 437 } |
410 if (m_CurByte < 0x21) { | 438 if (m_CurByte < 0x21) { |
411 m_eMode = FX_SAXMODE_TagAttributeName; | 439 m_eMode = CFX_SaxMode::TagAttributeName; |
412 } else if (m_CurByte == '/' || m_CurByte == '?') { | 440 } else if (m_CurByte == '/' || m_CurByte == '?') { |
413 m_ePrevMode = m_eMode; | 441 m_ePrevMode = m_eMode; |
414 m_eMode = FX_SAXMODE_TagMaybeClose; | 442 m_eMode = CFX_SaxMode::TagMaybeClose; |
415 } else { | 443 } else { |
416 if (m_pHandler) { | 444 if (m_pHandler) { |
417 NotifyBreak(); | 445 NotifyBreak(); |
418 } | 446 } |
419 m_eMode = FX_SAXMODE_Text; | 447 m_eMode = CFX_SaxMode::Text; |
420 } | 448 } |
421 } else { | 449 } else { |
422 AppendData(m_CurByte); | 450 AppendData(m_CurByte); |
423 } | 451 } |
424 } | 452 } |
425 void CFX_SAXReader::ParseTagAttributeName() { | 453 void CFX_SAXReader::ParseTagAttributeName() { |
426 if (m_CurByte < 0x21 || m_CurByte == '=') { | 454 if (m_CurByte < 0x21 || m_CurByte == '=') { |
427 if (m_iDataPos < 1 && m_CurByte < 0x21) { | 455 if (m_iDataPos < 1 && m_CurByte < 0x21) { |
428 return; | 456 return; |
429 } | 457 } |
430 m_iNameLength = m_iDataPos; | 458 m_iNameLength = m_iDataPos; |
431 m_iDataPos = 0; | 459 m_iDataPos = 0; |
432 m_SkipChar = 0; | 460 m_SkipChar = 0; |
433 m_eMode = m_CurByte == '=' ? FX_SAXMODE_TagAttributeValue | 461 m_eMode = m_CurByte == '=' ? CFX_SaxMode::TagAttributeValue |
434 : FX_SAXMODE_TagAttributeEqual; | 462 : CFX_SaxMode::TagAttributeEqual; |
435 return; | 463 return; |
436 } | 464 } |
437 if (m_CurByte == '/' || m_CurByte == '>' || m_CurByte == '?') { | 465 if (m_CurByte == '/' || m_CurByte == '>' || m_CurByte == '?') { |
438 if (m_CurByte == '/' || m_CurByte == '?') { | 466 if (m_CurByte == '/' || m_CurByte == '?') { |
439 m_ePrevMode = m_eMode; | 467 m_ePrevMode = m_eMode; |
440 m_eMode = FX_SAXMODE_TagMaybeClose; | 468 m_eMode = CFX_SaxMode::TagMaybeClose; |
441 } else { | 469 } else { |
442 if (m_pHandler) { | 470 if (m_pHandler) { |
443 NotifyBreak(); | 471 NotifyBreak(); |
444 } | 472 } |
445 m_eMode = FX_SAXMODE_Text; | 473 m_eMode = CFX_SaxMode::Text; |
446 } | 474 } |
447 return; | 475 return; |
448 } | 476 } |
449 if (m_iDataPos < 1) { | 477 if (m_iDataPos < 1) { |
450 m_dwDataOffset = m_File.m_dwBufIndex; | 478 m_dwDataOffset = m_File.m_dwBufIndex; |
451 } | 479 } |
452 AppendName(m_CurByte); | 480 AppendName(m_CurByte); |
453 } | 481 } |
454 void CFX_SAXReader::ParseTagAttributeEqual() { | 482 void CFX_SAXReader::ParseTagAttributeEqual() { |
455 if (m_CurByte == '=') { | 483 if (m_CurByte == '=') { |
456 m_SkipChar = 0; | 484 m_SkipChar = 0; |
457 m_eMode = FX_SAXMODE_TagAttributeValue; | 485 m_eMode = CFX_SaxMode::TagAttributeValue; |
458 return; | 486 return; |
459 } else if (m_pCurItem->m_eNode == FX_SAXNODE_Instruction) { | 487 } else if (m_pCurItem->m_eNode == CFX_SAXItem::Type::Instruction) { |
460 m_iDataPos = m_iNameLength; | 488 m_iDataPos = m_iNameLength; |
461 AppendName(0x20); | 489 AppendName(0x20); |
462 m_eMode = FX_SAXMODE_TargetData; | 490 m_eMode = CFX_SaxMode::TargetData; |
463 ParseTargetData(); | 491 ParseTargetData(); |
464 } | 492 } |
465 } | 493 } |
466 void CFX_SAXReader::ParseTagAttributeValue() { | 494 void CFX_SAXReader::ParseTagAttributeValue() { |
467 if (m_SkipChar) { | 495 if (m_SkipChar) { |
468 if (m_SkipChar == m_CurByte) { | 496 if (m_SkipChar == m_CurByte) { |
469 { | 497 { |
470 m_iDataLength = m_iDataPos; | 498 m_iDataLength = m_iDataPos; |
471 m_iDataPos = 0; | 499 m_iDataPos = 0; |
472 if (m_pHandler) { | 500 if (m_pHandler) { |
473 NotifyAttribute(); | 501 NotifyAttribute(); |
474 } | 502 } |
475 } | 503 } |
476 m_SkipChar = 0; | 504 m_SkipChar = 0; |
477 m_eMode = FX_SAXMODE_TagAttributeName; | 505 m_eMode = CFX_SaxMode::TagAttributeName; |
478 return; | 506 return; |
479 } | 507 } |
480 ParseChar(m_CurByte); | 508 ParseChar(m_CurByte); |
481 return; | 509 return; |
482 } | 510 } |
483 if (m_CurByte < 0x21) { | 511 if (m_CurByte < 0x21) { |
484 return; | 512 return; |
485 } | 513 } |
486 if (m_iDataPos < 1) { | 514 if (m_iDataPos < 1) { |
487 if (m_CurByte == '\'' || m_CurByte == '\"') { | 515 if (m_CurByte == '\'' || m_CurByte == '\"') { |
488 m_SkipChar = m_CurByte; | 516 m_SkipChar = m_CurByte; |
489 } | 517 } |
490 } | 518 } |
491 } | 519 } |
492 void CFX_SAXReader::ParseMaybeClose() { | 520 void CFX_SAXReader::ParseMaybeClose() { |
493 if (m_CurByte == '>') { | 521 if (m_CurByte == '>') { |
494 if (m_pCurItem->m_eNode == FX_SAXNODE_Instruction) { | 522 if (m_pCurItem->m_eNode == CFX_SAXItem::Type::Instruction) { |
495 m_iNameLength = m_iDataPos; | 523 m_iNameLength = m_iDataPos; |
496 m_iDataPos = 0; | 524 m_iDataPos = 0; |
497 if (m_pHandler) { | 525 if (m_pHandler) { |
498 NotifyTargetData(); | 526 NotifyTargetData(); |
499 } | 527 } |
500 } | 528 } |
501 ParseTagClose(); | 529 ParseTagClose(); |
502 m_eMode = FX_SAXMODE_Text; | 530 m_eMode = CFX_SaxMode::Text; |
503 } else if (m_ePrevMode == FX_SAXMODE_TagName) { | 531 } else if (m_ePrevMode == CFX_SaxMode::TagName) { |
504 AppendData('/'); | 532 AppendData('/'); |
505 m_eMode = FX_SAXMODE_TagName; | 533 m_eMode = CFX_SaxMode::TagName; |
506 m_ePrevMode = FX_SAXMODE_Text; | 534 m_ePrevMode = CFX_SaxMode::Text; |
507 ParseTagName(); | 535 ParseTagName(); |
508 } else if (m_ePrevMode == FX_SAXMODE_TagAttributeName) { | 536 } else if (m_ePrevMode == CFX_SaxMode::TagAttributeName) { |
509 AppendName('/'); | 537 AppendName('/'); |
510 m_eMode = FX_SAXMODE_TagAttributeName; | 538 m_eMode = CFX_SaxMode::TagAttributeName; |
511 m_ePrevMode = FX_SAXMODE_Text; | 539 m_ePrevMode = CFX_SaxMode::Text; |
512 ParseTagAttributeName(); | 540 ParseTagAttributeName(); |
513 } else if (m_ePrevMode == FX_SAXMODE_TargetData) { | 541 } else if (m_ePrevMode == CFX_SaxMode::TargetData) { |
514 AppendName('?'); | 542 AppendName('?'); |
515 m_eMode = FX_SAXMODE_TargetData; | 543 m_eMode = CFX_SaxMode::TargetData; |
516 m_ePrevMode = FX_SAXMODE_Text; | 544 m_ePrevMode = CFX_SaxMode::Text; |
517 ParseTargetData(); | 545 ParseTargetData(); |
518 } | 546 } |
519 } | 547 } |
520 void CFX_SAXReader::ParseTagClose() { | 548 void CFX_SAXReader::ParseTagClose() { |
521 m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex; | 549 m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex; |
522 if (m_pHandler) { | 550 if (m_pHandler) { |
523 NotifyClose(); | 551 NotifyClose(); |
524 } | 552 } |
525 Pop(); | 553 Pop(); |
526 } | 554 } |
527 void CFX_SAXReader::ParseTagEnd() { | 555 void CFX_SAXReader::ParseTagEnd() { |
528 if (m_CurByte < 0x21) { | 556 if (m_CurByte < 0x21) { |
529 return; | 557 return; |
530 } | 558 } |
531 if (m_CurByte == '>') { | 559 if (m_CurByte == '>') { |
532 Pop(); | 560 Pop(); |
533 m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex; | 561 m_dwNodePos = m_File.m_dwCur + m_File.m_dwBufIndex; |
534 m_iDataLength = m_iDataPos; | 562 m_iDataLength = m_iDataPos; |
535 m_iDataPos = 0; | 563 m_iDataPos = 0; |
536 if (m_pHandler) { | 564 if (m_pHandler) { |
537 NotifyEnd(); | 565 NotifyEnd(); |
538 } | 566 } |
539 Pop(); | 567 Pop(); |
540 m_eMode = FX_SAXMODE_Text; | 568 m_eMode = CFX_SaxMode::Text; |
541 } else { | 569 } else { |
542 ParseChar(m_CurByte); | 570 ParseChar(m_CurByte); |
543 } | 571 } |
544 } | 572 } |
545 void CFX_SAXReader::ParseTargetData() { | 573 void CFX_SAXReader::ParseTargetData() { |
546 if (m_CurByte == '?') { | 574 if (m_CurByte == '?') { |
547 m_ePrevMode = m_eMode; | 575 m_ePrevMode = m_eMode; |
548 m_eMode = FX_SAXMODE_TagMaybeClose; | 576 m_eMode = CFX_SaxMode::TagMaybeClose; |
549 } else { | 577 } else { |
550 AppendName(m_CurByte); | 578 AppendName(m_CurByte); |
551 } | 579 } |
552 } | 580 } |
553 void CFX_SAXReader::SkipNode() { | 581 void CFX_SAXReader::SkipNode() { |
554 int32_t iLen = m_SkipStack.GetSize(); | 582 int32_t iLen = m_SkipStack.GetSize(); |
555 if (m_SkipChar == '\'' || m_SkipChar == '\"') { | 583 if (m_SkipChar == '\'' || m_SkipChar == '\"') { |
556 if (m_CurByte != m_SkipChar) { | 584 if (m_CurByte != m_SkipChar) { |
557 return; | 585 return; |
558 } | 586 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 FXSYS_memmove(m_pszData, m_pszData + 7, | 629 FXSYS_memmove(m_pszData, m_pszData + 7, |
602 m_iDataLength * sizeof(uint8_t)); | 630 m_iDataLength * sizeof(uint8_t)); |
603 m_bCharData = TRUE; | 631 m_bCharData = TRUE; |
604 if (m_pHandler) { | 632 if (m_pHandler) { |
605 NotifyData(); | 633 NotifyData(); |
606 } | 634 } |
607 m_bCharData = FALSE; | 635 m_bCharData = FALSE; |
608 } else { | 636 } else { |
609 Pop(); | 637 Pop(); |
610 } | 638 } |
611 m_eMode = FX_SAXMODE_Text; | 639 m_eMode = CFX_SaxMode::Text; |
612 } | 640 } |
613 } | 641 } |
614 break; | 642 break; |
615 } | 643 } |
616 if (iLen > 0) { | 644 if (iLen > 0) { |
617 ParseChar(m_CurByte); | 645 ParseChar(m_CurByte); |
618 } | 646 } |
619 } | 647 } |
620 | 648 |
621 void CFX_SAXReader::NotifyData() { | 649 void CFX_SAXReader::NotifyData() { |
622 if (m_pCurItem->m_eNode == FX_SAXNODE_Tag) | 650 if (m_pCurItem->m_eNode == CFX_SAXItem::Type::Tag) |
623 m_pHandler->OnTagData(m_pCurItem->m_pNode, | 651 m_pHandler->OnTagData( |
624 m_bCharData ? FX_SAXNODE_CharData : FX_SAXNODE_Text, | 652 m_pCurItem->m_pNode, |
625 CFX_ByteStringC(m_pszData, m_iDataLength), | 653 m_bCharData ? CFX_SAXItem::Type::CharData : CFX_SAXItem::Type::Text, |
626 m_File.m_dwCur + m_dwDataOffset); | 654 CFX_ByteStringC(m_pszData, m_iDataLength), |
| 655 m_File.m_dwCur + m_dwDataOffset); |
627 } | 656 } |
628 | 657 |
629 void CFX_SAXReader::NotifyEnter() { | 658 void CFX_SAXReader::NotifyEnter() { |
630 if (m_pCurItem->m_eNode == FX_SAXNODE_Tag || | 659 if (m_pCurItem->m_eNode == CFX_SAXItem::Type::Tag || |
631 m_pCurItem->m_eNode == FX_SAXNODE_Instruction) { | 660 m_pCurItem->m_eNode == CFX_SAXItem::Type::Instruction) { |
632 m_pCurItem->m_pNode = | 661 m_pCurItem->m_pNode = |
633 m_pHandler->OnTagEnter(CFX_ByteStringC(m_pszData, m_iDataLength), | 662 m_pHandler->OnTagEnter(CFX_ByteStringC(m_pszData, m_iDataLength), |
634 m_pCurItem->m_eNode, m_dwNodePos); | 663 m_pCurItem->m_eNode, m_dwNodePos); |
635 } | 664 } |
636 } | 665 } |
637 | 666 |
638 void CFX_SAXReader::NotifyAttribute() { | 667 void CFX_SAXReader::NotifyAttribute() { |
639 if (m_pCurItem->m_eNode == FX_SAXNODE_Tag || | 668 if (m_pCurItem->m_eNode == CFX_SAXItem::Type::Tag || |
640 m_pCurItem->m_eNode == FX_SAXNODE_Instruction) { | 669 m_pCurItem->m_eNode == CFX_SAXItem::Type::Instruction) { |
641 m_pHandler->OnTagAttribute(m_pCurItem->m_pNode, | 670 m_pHandler->OnTagAttribute(m_pCurItem->m_pNode, |
642 CFX_ByteStringC(m_pszName, m_iNameLength), | 671 CFX_ByteStringC(m_pszName, m_iNameLength), |
643 CFX_ByteStringC(m_pszData, m_iDataLength)); | 672 CFX_ByteStringC(m_pszData, m_iDataLength)); |
644 } | 673 } |
645 } | 674 } |
646 | 675 |
647 void CFX_SAXReader::NotifyBreak() { | 676 void CFX_SAXReader::NotifyBreak() { |
648 if (m_pCurItem->m_eNode == FX_SAXNODE_Tag) | 677 if (m_pCurItem->m_eNode == CFX_SAXItem::Type::Tag) |
649 m_pHandler->OnTagBreak(m_pCurItem->m_pNode); | 678 m_pHandler->OnTagBreak(m_pCurItem->m_pNode); |
650 } | 679 } |
651 | 680 |
652 void CFX_SAXReader::NotifyClose() { | 681 void CFX_SAXReader::NotifyClose() { |
653 if (m_pCurItem->m_eNode == FX_SAXNODE_Tag || | 682 if (m_pCurItem->m_eNode == CFX_SAXItem::Type::Tag || |
654 m_pCurItem->m_eNode == FX_SAXNODE_Instruction) { | 683 m_pCurItem->m_eNode == CFX_SAXItem::Type::Instruction) { |
655 m_pHandler->OnTagClose(m_pCurItem->m_pNode, m_dwNodePos); | 684 m_pHandler->OnTagClose(m_pCurItem->m_pNode, m_dwNodePos); |
656 } | 685 } |
657 } | 686 } |
658 | 687 |
659 void CFX_SAXReader::NotifyEnd() { | 688 void CFX_SAXReader::NotifyEnd() { |
660 if (m_pCurItem->m_eNode != FX_SAXNODE_Tag) | 689 if (m_pCurItem->m_eNode != CFX_SAXItem::Type::Tag) |
661 return; | 690 return; |
662 | 691 |
663 m_pHandler->OnTagEnd(m_pCurItem->m_pNode, | 692 m_pHandler->OnTagEnd(m_pCurItem->m_pNode, |
664 CFX_ByteStringC(m_pszData, m_iDataLength), m_dwNodePos); | 693 CFX_ByteStringC(m_pszData, m_iDataLength), m_dwNodePos); |
665 } | 694 } |
666 | 695 |
667 void CFX_SAXReader::NotifyTargetData() { | 696 void CFX_SAXReader::NotifyTargetData() { |
668 if (m_pCurItem->m_eNode == FX_SAXNODE_Instruction) { | 697 if (m_pCurItem->m_eNode == CFX_SAXItem::Type::Instruction) { |
669 m_pHandler->OnTargetData(m_pCurItem->m_pNode, m_pCurItem->m_eNode, | 698 m_pHandler->OnTargetData(m_pCurItem->m_pNode, m_pCurItem->m_eNode, |
670 CFX_ByteStringC(m_pszName, m_iNameLength), | 699 CFX_ByteStringC(m_pszName, m_iNameLength), |
671 m_dwNodePos); | 700 m_dwNodePos); |
672 } else if (m_pCurItem->m_eNode == FX_SAXNODE_Comment) { | 701 } else if (m_pCurItem->m_eNode == CFX_SAXItem::Type::Comment) { |
673 m_pHandler->OnTargetData(m_pCurItem->m_pNode, m_pCurItem->m_eNode, | 702 m_pHandler->OnTargetData(m_pCurItem->m_pNode, m_pCurItem->m_eNode, |
674 CFX_ByteStringC(m_pszData, m_iDataLength), | 703 CFX_ByteStringC(m_pszData, m_iDataLength), |
675 m_dwNodePos); | 704 m_dwNodePos); |
676 } | 705 } |
677 } | 706 } |
678 | 707 |
679 void CFX_SAXReader::SkipCurrentNode() { | 708 void CFX_SAXReader::SkipCurrentNode() { |
680 if (!m_pCurItem) | 709 if (!m_pCurItem) |
681 return; | 710 return; |
682 | 711 |
683 m_pCurItem->m_bSkip = TRUE; | 712 m_pCurItem->m_bSkip = TRUE; |
684 } | 713 } |
685 | 714 |
686 void CFX_SAXReader::SetHandler(CXFA_SAXReaderHandler* pHandler) { | 715 void CFX_SAXReader::SetHandler(CXFA_SAXReaderHandler* pHandler) { |
687 m_pHandler = pHandler; | 716 m_pHandler = pHandler; |
688 } | 717 } |
OLD | NEW |