diff options
author | Lei Zhang <thestig@chromium.org> | 2017-02-27 14:45:56 -0800 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-28 00:35:05 +0000 |
commit | a99de0ec3cda8ff5b0d6383a059dd39c8626e504 (patch) | |
tree | fea2f04aca7aca32fc85c952040cf8593f40a64e /core/fxcrt/fx_xml.h | |
parent | ce32acfa15071e6cd5bcce73280857014e396dd2 (diff) | |
download | pdfium-a99de0ec3cda8ff5b0d6383a059dd39c8626e504.tar.xz |
Clean up CXML_Element.chromium/3026
- Set more members in the ctor
- Remove dead code
- Use more unique_ptrs
Change-Id: Idfe85d07c784a57862f9314bc85f407f817b8f2f
Reviewed-on: https://pdfium-review.googlesource.com/2844
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_xml.h')
-rw-r--r-- | core/fxcrt/fx_xml.h | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/core/fxcrt/fx_xml.h b/core/fxcrt/fx_xml.h index 38a1b60846..87f1915cb1 100644 --- a/core/fxcrt/fx_xml.h +++ b/core/fxcrt/fx_xml.h @@ -54,26 +54,18 @@ class CXML_Element { public: enum ChildType { Invalid, Element, Content }; - static CXML_Element* Parse(const void* pBuffer, - size_t size, - bool bSaveSpaceChars = false, - FX_FILESIZE* pParsedSize = nullptr); - static CXML_Element* Parse(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile, - bool bSaveSpaceChars = false, - FX_FILESIZE* pParsedSize = nullptr); - static CXML_Element* Parse( - const CFX_RetainPtr<IFX_BufferedReadStream>& pBuffer, - bool bSaveSpaceChars = false, - FX_FILESIZE* pParsedSize = nullptr); - - CXML_Element(); + static std::unique_ptr<CXML_Element> Parse(const void* pBuffer, size_t size); + + CXML_Element(const CXML_Element* pParent, + const CFX_ByteStringC& qSpace, + const CFX_ByteStringC& tagname); ~CXML_Element(); void Empty(); CFX_ByteString GetTagName(bool bQualified = false) const; CFX_ByteString GetNamespace(bool bQualified = false) const; CFX_ByteString GetNamespaceURI(const CFX_ByteString& qName) const; - CXML_Element* GetParent() const { return m_pParent; } + const CXML_Element* GetParent() const { return m_pParent; } uint32_t CountAttrs() const { return m_AttrMap.GetSize(); } void GetAttrByIndex(int index, CFX_ByteString& space, @@ -148,7 +140,6 @@ class CXML_Element { int index) const; uint32_t FindElement(CXML_Element* pChild) const; - void SetTag(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagname); void SetTag(const CFX_ByteStringC& qTagName); void RemoveChildren(); void RemoveChild(uint32_t index); @@ -159,7 +150,7 @@ class CXML_Element { void* child; // CXML_Element and CXML_Content lack a common ancestor. }; - CXML_Element* m_pParent; + const CXML_Element* const m_pParent; CFX_ByteString m_QSpaceName; CFX_ByteString m_TagName; CXML_AttrMap m_AttrMap; |