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