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 _FX_XML_H_ | 7 #ifndef _FX_XML_H_ |
8 #define _FX_XML_H_ | 8 #define _FX_XML_H_ |
9 | 9 |
10 #include "fx_basic.h" | 10 #include "fx_basic.h" |
11 | 11 |
12 class CXML_AttrItem : public CFX_Object | 12 class CXML_AttrItem |
13 { | 13 { |
14 public: | 14 public: |
15 CFX_ByteString m_QSpaceName; | 15 CFX_ByteString m_QSpaceName; |
16 CFX_ByteString m_AttrName; | 16 CFX_ByteString m_AttrName; |
17 CFX_WideString m_Value; | 17 CFX_WideString m_Value; |
18 }; | 18 }; |
19 class CXML_AttrMap : public CFX_Object | 19 class CXML_AttrMap |
20 { | 20 { |
21 public: | 21 public: |
22 CXML_AttrMap() | 22 CXML_AttrMap() |
23 { | 23 { |
24 m_pMap = NULL; | 24 m_pMap = NULL; |
25 } | 25 } |
26 ~CXML_AttrMap() | 26 ~CXML_AttrMap() |
27 { | 27 { |
28 RemoveAll(); | 28 RemoveAll(); |
29 } | 29 } |
30 const CFX_WideString* Lookup(FX_BSTR space, FX_BSTR name) const; | 30 const CFX_WideString* Lookup(FX_BSTR space, FX_BSTR name) const; |
31 void SetAt(FX_BSTR space, FX_BSTR nam
e, FX_WSTR value); | 31 void SetAt(FX_BSTR space, FX_BSTR nam
e, FX_WSTR value); |
32 void RemoveAt(FX_BSTR space, FX_BSTR
name); | 32 void RemoveAt(FX_BSTR space, FX_BSTR
name); |
33 void RemoveAll(); | 33 void RemoveAll(); |
34 int GetSize() const; | 34 int GetSize() const; |
35 CXML_AttrItem& GetAt(int index) const; | 35 CXML_AttrItem& GetAt(int index) const; |
36 CFX_ObjectArray<CXML_AttrItem>* m_pMap; | 36 CFX_ObjectArray<CXML_AttrItem>* m_pMap; |
37 }; | 37 }; |
38 class CXML_Content : public CFX_Object | 38 class CXML_Content |
39 { | 39 { |
40 public: | 40 public: |
41 CXML_Content() : m_bCDATA(FALSE), m_Content() {} | 41 CXML_Content() : m_bCDATA(FALSE), m_Content() {} |
42 void Set(FX_BOOL bCDATA, FX_WSTR content) | 42 void Set(FX_BOOL bCDATA, FX_WSTR content) |
43 { | 43 { |
44 m_bCDATA = bCDATA; | 44 m_bCDATA = bCDATA; |
45 m_Content = content; | 45 m_Content = content; |
46 } | 46 } |
47 FX_BOOL m_bCDATA; | 47 FX_BOOL m_bCDATA; |
48 CFX_WideString m_Content; | 48 CFX_WideString m_Content; |
49 }; | 49 }; |
50 class CXML_Element : public CFX_Object | 50 class CXML_Element |
51 { | 51 { |
52 public: | 52 public: |
53 static CXML_Element* Parse(const void* pBuffer, size_t size, FX_BOOL
bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); | 53 static CXML_Element* Parse(const void* pBuffer, size_t size, FX_BOOL
bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = NULL); |
54 static CXML_Element* Parse(IFX_FileRead *pFile, FX_BOOL bSaveSpaceCha
rs = FALSE, FX_FILESIZE* pParsedSize = NULL); | 54 static CXML_Element* Parse(IFX_FileRead *pFile, FX_BOOL bSaveSpaceCha
rs = FALSE, FX_FILESIZE* pParsedSize = NULL); |
55 static CXML_Element* Parse(IFX_BufferRead *pBuffer, FX_BOOL bSaveSpac
eChars = FALSE, FX_FILESIZE* pParsedSize = NULL); | 55 static CXML_Element* Parse(IFX_BufferRead *pBuffer, FX_BOOL bSaveSpac
eChars = FALSE, FX_FILESIZE* pParsedSize = NULL); |
56 CXML_Element(FX_BSTR qSpace, FX_BSTR tagName); | 56 CXML_Element(FX_BSTR qSpace, FX_BSTR tagName); |
57 CXML_Element(FX_BSTR qTagName); | 57 CXML_Element(FX_BSTR qTagName); |
58 CXML_Element(); | 58 CXML_Element(); |
59 | 59 |
60 ~CXML_Element(); | 60 ~CXML_Element(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 CFX_ByteString m_QSpaceName; | 170 CFX_ByteString m_QSpaceName; |
171 CFX_ByteString m_TagName; | 171 CFX_ByteString m_TagName; |
172 | 172 |
173 CXML_AttrMap m_AttrMap; | 173 CXML_AttrMap m_AttrMap; |
174 | 174 |
175 CFX_PtrArray m_Children; | 175 CFX_PtrArray m_Children; |
176 friend class CXML_Parser; | 176 friend class CXML_Parser; |
177 friend class CXML_Composer; | 177 friend class CXML_Composer; |
178 }; | 178 }; |
179 #endif | 179 #endif |
OLD | NEW |