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 CORE_FXCRT_XML_INT_H_ | 7 #ifndef CORE_FXCRT_XML_INT_H_ |
8 #define CORE_FXCRT_XML_INT_H_ | 8 #define CORE_FXCRT_XML_INT_H_ |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 | 11 |
12 #include "core/fxcrt/fx_stream.h" | 12 #include "core/fxcrt/fx_stream.h" |
13 | 13 |
14 class CFX_UTF8Decoder; | 14 class CFX_UTF8Decoder; |
15 class CXML_Element; | 15 class CXML_Element; |
16 | 16 |
17 class CXML_Parser { | 17 class CXML_Parser { |
18 public: | 18 public: |
19 CXML_Parser(); | 19 CXML_Parser(); |
20 ~CXML_Parser(); | 20 ~CXML_Parser(); |
21 | 21 |
22 bool Init(uint8_t* pBuffer, size_t size); | 22 bool Init(uint8_t* pBuffer, size_t size); |
23 bool Init(IFX_SeekableReadStream* pFileRead); | 23 bool Init(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead); |
24 bool Init(IFX_BufferedReadStream* pBuffer); | 24 bool Init(const CFX_RetainPtr<IFX_BufferedReadStream>& pBuffer); |
25 bool Init(bool bOwndedStream); | 25 bool Init(); |
26 bool ReadNextBlock(); | 26 bool ReadNextBlock(); |
27 bool IsEOF(); | 27 bool IsEOF(); |
28 bool HaveAvailData(); | 28 bool HaveAvailData(); |
29 void SkipWhiteSpaces(); | 29 void SkipWhiteSpaces(); |
30 void GetName(CFX_ByteString& space, CFX_ByteString& name); | 30 void GetName(CFX_ByteString& space, CFX_ByteString& name); |
31 void GetAttrValue(CFX_WideString& value); | 31 void GetAttrValue(CFX_WideString& value); |
32 uint32_t GetCharRef(); | 32 uint32_t GetCharRef(); |
33 void GetTagName(CFX_ByteString& space, | 33 void GetTagName(CFX_ByteString& space, |
34 CFX_ByteString& name, | 34 CFX_ByteString& name, |
35 bool& bEndTag, | 35 bool& bEndTag, |
36 bool bStartTag = false); | 36 bool bStartTag = false); |
37 void SkipLiterals(const CFX_ByteStringC& str); | 37 void SkipLiterals(const CFX_ByteStringC& str); |
38 CXML_Element* ParseElement(CXML_Element* pParent, bool bStartTag = false); | 38 CXML_Element* ParseElement(CXML_Element* pParent, bool bStartTag = false); |
39 void InsertContentSegment(bool bCDATA, | 39 void InsertContentSegment(bool bCDATA, |
40 const CFX_WideStringC& content, | 40 const CFX_WideStringC& content, |
41 CXML_Element* pElement); | 41 CXML_Element* pElement); |
42 void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement); | 42 void InsertCDATASegment(CFX_UTF8Decoder& decoder, CXML_Element* pElement); |
43 | 43 |
44 IFX_BufferedReadStream* m_pDataAcc; | 44 CFX_RetainPtr<IFX_BufferedReadStream> m_pDataAcc; |
45 bool m_bOwnedStream; | |
46 FX_FILESIZE m_nOffset; | 45 FX_FILESIZE m_nOffset; |
47 bool m_bSaveSpaceChars; | 46 bool m_bSaveSpaceChars; |
48 const uint8_t* m_pBuffer; | 47 const uint8_t* m_pBuffer; |
49 size_t m_dwBufferSize; | 48 size_t m_dwBufferSize; |
50 FX_FILESIZE m_nBufferOffset; | 49 FX_FILESIZE m_nBufferOffset; |
51 size_t m_dwIndex; | 50 size_t m_dwIndex; |
52 }; | 51 }; |
53 | 52 |
54 void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, | 53 void FX_XML_SplitQualifiedName(const CFX_ByteStringC& bsFullName, |
55 CFX_ByteStringC& bsSpace, | 54 CFX_ByteStringC& bsSpace, |
56 CFX_ByteStringC& bsName); | 55 CFX_ByteStringC& bsName); |
57 | 56 |
58 #endif // CORE_FXCRT_XML_INT_H_ | 57 #endif // CORE_FXCRT_XML_INT_H_ |
OLD | NEW |