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_CFX_SAXREADER_H_ | 7 #ifndef XFA_FDE_XML_CFX_SAXREADER_H_ |
8 #define XFA_FDE_XML_CFX_SAXREADER_H_ | 8 #define XFA_FDE_XML_CFX_SAXREADER_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 CXFA_SAXContext* m_pNode; | 32 CXFA_SAXContext* m_pNode; |
33 Type m_eNode; | 33 Type m_eNode; |
34 const uint32_t m_dwID; | 34 const uint32_t m_dwID; |
35 FX_BOOL m_bSkip; | 35 FX_BOOL m_bSkip; |
36 }; | 36 }; |
37 | 37 |
38 class CFX_SAXFile { | 38 class CFX_SAXFile { |
39 public: | 39 public: |
40 CFX_SAXFile(); | 40 CFX_SAXFile(); |
41 FX_BOOL StartFile(IFX_FileRead* pFile, uint32_t dwStart, uint32_t dwLen); | 41 FX_BOOL StartFile(IFX_SeekableReadStream* pFile, |
| 42 uint32_t dwStart, |
| 43 uint32_t dwLen); |
42 FX_BOOL ReadNextBlock(); | 44 FX_BOOL ReadNextBlock(); |
43 void Reset(); | 45 void Reset(); |
44 IFX_FileRead* m_pFile; | 46 IFX_SeekableReadStream* m_pFile; |
45 uint32_t m_dwStart; | 47 uint32_t m_dwStart; |
46 uint32_t m_dwEnd; | 48 uint32_t m_dwEnd; |
47 uint32_t m_dwCur; | 49 uint32_t m_dwCur; |
48 uint8_t* m_pBuf; | 50 uint8_t* m_pBuf; |
49 uint32_t m_dwBufSize; | 51 uint32_t m_dwBufSize; |
50 uint32_t m_dwBufIndex; | 52 uint32_t m_dwBufIndex; |
51 }; | 53 }; |
52 | 54 |
53 class CFX_SAXCommentContext; | 55 class CFX_SAXCommentContext; |
54 enum class CFX_SaxMode; | 56 enum class CFX_SaxMode; |
55 | 57 |
56 enum CFX_SaxParseMode { | 58 enum CFX_SaxParseMode { |
57 CFX_SaxParseMode_NotConvert_amp = 1 << 0, | 59 CFX_SaxParseMode_NotConvert_amp = 1 << 0, |
58 CFX_SaxParseMode_NotConvert_lt = 1 << 1, | 60 CFX_SaxParseMode_NotConvert_lt = 1 << 1, |
59 CFX_SaxParseMode_NotConvert_gt = 1 << 2, | 61 CFX_SaxParseMode_NotConvert_gt = 1 << 2, |
60 CFX_SaxParseMode_NotConvert_apos = 1 << 3, | 62 CFX_SaxParseMode_NotConvert_apos = 1 << 3, |
61 CFX_SaxParseMode_NotConvert_quot = 1 << 4, | 63 CFX_SaxParseMode_NotConvert_quot = 1 << 4, |
62 CFX_SaxParseMode_NotConvert_sharp = 1 << 5, | 64 CFX_SaxParseMode_NotConvert_sharp = 1 << 5, |
63 CFX_SaxParseMode_NotSkipSpace = 1 << 6 | 65 CFX_SaxParseMode_NotSkipSpace = 1 << 6 |
64 }; | 66 }; |
65 | 67 |
66 class CXFA_SAXReaderHandler; | 68 class CXFA_SAXReaderHandler; |
67 | 69 |
68 class CFX_SAXReader { | 70 class CFX_SAXReader { |
69 public: | 71 public: |
70 CFX_SAXReader(); | 72 CFX_SAXReader(); |
71 ~CFX_SAXReader(); | 73 ~CFX_SAXReader(); |
72 | 74 |
73 int32_t StartParse(IFX_FileRead* pFile, | 75 int32_t StartParse(IFX_SeekableReadStream* pFile, |
74 uint32_t dwStart = 0, | 76 uint32_t dwStart = 0, |
75 uint32_t dwLen = -1, | 77 uint32_t dwLen = -1, |
76 uint32_t dwParseMode = 0); | 78 uint32_t dwParseMode = 0); |
77 int32_t ContinueParse(IFX_Pause* pPause = nullptr); | 79 int32_t ContinueParse(IFX_Pause* pPause = nullptr); |
78 void SkipCurrentNode(); | 80 void SkipCurrentNode(); |
79 void SetHandler(CXFA_SAXReaderHandler* pHandler); | 81 void SetHandler(CXFA_SAXReaderHandler* pHandler); |
80 void AppendData(uint8_t ch); | 82 void AppendData(uint8_t ch); |
81 void AppendName(uint8_t ch); | 83 void AppendName(uint8_t ch); |
82 void ParseText(); | 84 void ParseText(); |
83 void ParseNodeStart(); | 85 void ParseNodeStart(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 int32_t m_iEntityStart; | 134 int32_t m_iEntityStart; |
133 int32_t m_iDataPos; | 135 int32_t m_iDataPos; |
134 uint8_t* m_pszName; | 136 uint8_t* m_pszName; |
135 int32_t m_iNameSize; | 137 int32_t m_iNameSize; |
136 int32_t m_iNameLength; | 138 int32_t m_iNameLength; |
137 uint32_t m_dwParseMode; | 139 uint32_t m_dwParseMode; |
138 CFX_SAXCommentContext* m_pCommentContext; | 140 CFX_SAXCommentContext* m_pCommentContext; |
139 }; | 141 }; |
140 | 142 |
141 #endif // XFA_FDE_XML_CFX_SAXREADER_H_ | 143 #endif // XFA_FDE_XML_CFX_SAXREADER_H_ |
OLD | NEW |