| 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_INCLUDE_FX_XML_H_ | 7 #ifndef CORE_FXCRT_INCLUDE_FX_XML_H_ |
| 8 #define CORE_FXCRT_INCLUDE_FX_XML_H_ | 8 #define CORE_FXCRT_INCLUDE_FX_XML_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "core/fxcrt/include/fx_basic.h" | 13 #include "core/fxcrt/include/fx_basic.h" |
| 14 | 14 |
| 15 class CXML_AttrItem { | 15 class CXML_AttrItem { |
| 16 public: | 16 public: |
| 17 bool Matches(const CFX_ByteStringC& space, const CFX_ByteStringC& name) const; | 17 bool Matches(const CFX_ByteString& space, const CFX_ByteString& name) const; |
| 18 | 18 |
| 19 CFX_ByteString m_QSpaceName; | 19 CFX_ByteString m_QSpaceName; |
| 20 CFX_ByteString m_AttrName; | 20 CFX_ByteString m_AttrName; |
| 21 CFX_WideString m_Value; | 21 CFX_WideString m_Value; |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 class CXML_AttrMap { | 24 class CXML_AttrMap { |
| 25 public: | 25 public: |
| 26 const CFX_WideString* Lookup(const CFX_ByteStringC& space, | 26 const CFX_WideString* Lookup(const CFX_ByteString& space, |
| 27 const CFX_ByteStringC& name) const; | 27 const CFX_ByteString& name) const; |
| 28 void SetAt(const CFX_ByteStringC& space, | 28 void SetAt(const CFX_ByteString& space, |
| 29 const CFX_ByteStringC& name, | 29 const CFX_ByteString& name, |
| 30 const CFX_WideStringC& value); | 30 const CFX_WideString& value); |
| 31 int GetSize() const; | 31 int GetSize() const; |
| 32 CXML_AttrItem& GetAt(int index) const; | 32 CXML_AttrItem& GetAt(int index) const; |
| 33 | 33 |
| 34 std::unique_ptr<std::vector<CXML_AttrItem>> m_pMap; | 34 std::unique_ptr<std::vector<CXML_AttrItem>> m_pMap; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 class CXML_Content { | 37 class CXML_Content { |
| 38 public: | 38 public: |
| 39 CXML_Content() : m_bCDATA(FALSE), m_Content() {} | 39 CXML_Content() : m_bCDATA(FALSE), m_Content() {} |
| 40 void Set(FX_BOOL bCDATA, const CFX_WideStringC& content) { | 40 void Set(FX_BOOL bCDATA, const CFX_WideStringC& content) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 62 FX_FILESIZE* pParsedSize = NULL); | 62 FX_FILESIZE* pParsedSize = NULL); |
| 63 | 63 |
| 64 CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); | 64 CXML_Element(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagName); |
| 65 CXML_Element(const CFX_ByteStringC& qTagName); | 65 CXML_Element(const CFX_ByteStringC& qTagName); |
| 66 CXML_Element(); | 66 CXML_Element(); |
| 67 ~CXML_Element(); | 67 ~CXML_Element(); |
| 68 | 68 |
| 69 void Empty(); | 69 void Empty(); |
| 70 CFX_ByteString GetTagName(FX_BOOL bQualified = FALSE) const; | 70 CFX_ByteString GetTagName(FX_BOOL bQualified = FALSE) const; |
| 71 CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; | 71 CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; |
| 72 CFX_ByteString GetNamespaceURI(const CFX_ByteStringC& qName) const; | 72 CFX_ByteString GetNamespaceURI(const CFX_ByteString& qName) const; |
| 73 CXML_Element* GetParent() const { return m_pParent; } | 73 CXML_Element* GetParent() const { return m_pParent; } |
| 74 uint32_t CountAttrs() const { return m_AttrMap.GetSize(); } | 74 uint32_t CountAttrs() const { return m_AttrMap.GetSize(); } |
| 75 void GetAttrByIndex(int index, | 75 void GetAttrByIndex(int index, |
| 76 CFX_ByteString& space, | 76 CFX_ByteString& space, |
| 77 CFX_ByteString& name, | 77 CFX_ByteString& name, |
| 78 CFX_WideString& value) const; | 78 CFX_WideString& value) const; |
| 79 FX_BOOL HasAttr(const CFX_ByteStringC& qName) const; | 79 FX_BOOL HasAttr(const CFX_ByteStringC& qName) const; |
| 80 FX_BOOL GetAttrValue(const CFX_ByteStringC& name, | 80 FX_BOOL GetAttrValue(const CFX_ByteStringC& name, |
| 81 CFX_WideString& attribute) const; | 81 CFX_WideString& attribute) const; |
| 82 CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const { | 82 CFX_WideString GetAttrValue(const CFX_ByteStringC& name) const { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 CFX_ByteString m_QSpaceName; | 160 CFX_ByteString m_QSpaceName; |
| 161 CFX_ByteString m_TagName; | 161 CFX_ByteString m_TagName; |
| 162 CXML_AttrMap m_AttrMap; | 162 CXML_AttrMap m_AttrMap; |
| 163 std::vector<ChildRecord> m_Children; | 163 std::vector<ChildRecord> m_Children; |
| 164 | 164 |
| 165 friend class CXML_Parser; | 165 friend class CXML_Parser; |
| 166 friend class CXML_Composer; | 166 friend class CXML_Composer; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 #endif // CORE_FXCRT_INCLUDE_FX_XML_H_ | 169 #endif // CORE_FXCRT_INCLUDE_FX_XML_H_ |
| OLD | NEW |