diff options
author | Lei Zhang <thestig@chromium.org> | 2017-12-13 14:34:12 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-13 14:34:12 +0000 |
commit | 753edfbfa7310241c51c61e2045f0f55971c142a (patch) | |
tree | a5af22388e425c089828f96865ab752ab9bc2eb4 /core/fxcrt | |
parent | f85c43bc73740cc9887da7c790c79469610c9646 (diff) | |
download | pdfium-753edfbfa7310241c51c61e2045f0f55971c142a.tar.xz |
Remove dead CXML_Element code.
Move non-trivial implementations into the .cpp file as well.
Change-Id: Iebe7d7284e453c6405cddfe880e2c85aa0c804ab
Reviewed-on: https://pdfium-review.googlesource.com/21050
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/xml/cxml_element.cpp | 74 | ||||
-rw-r--r-- | core/fxcrt/xml/cxml_element.h | 66 |
2 files changed, 23 insertions, 117 deletions
diff --git a/core/fxcrt/xml/cxml_element.cpp b/core/fxcrt/xml/cxml_element.cpp index 42cbdec311..9e595914dd 100644 --- a/core/fxcrt/xml/cxml_element.cpp +++ b/core/fxcrt/xml/cxml_element.cpp @@ -43,10 +43,6 @@ ByteString CXML_Element::GetTagName(bool bQualified) const { return bsTag; } -ByteString CXML_Element::GetNamespace(bool bQualified) const { - return bQualified ? m_QSpaceName : GetNamespaceURI(m_QSpaceName); -} - ByteString CXML_Element::GetNamespaceURI(const ByteString& qName) const { const WideString* pwsSpace; const CXML_Element* pElement = this; @@ -76,13 +72,6 @@ void CXML_Element::GetAttrByIndex(int index, *value = item.m_Value; } -bool CXML_Element::HasAttr(const ByteStringView& name) const { - ByteStringView bsSpace; - ByteStringView bsName; - FX_XML_SplitQualifiedName(name, bsSpace, bsName); - return !!m_AttrMap.Lookup(ByteString(bsSpace), ByteString(bsName)); -} - bool CXML_Element::GetAttrValue(const ByteStringView& name, WideString& attribute) const { ByteStringView bsSpace; @@ -91,6 +80,12 @@ bool CXML_Element::GetAttrValue(const ByteStringView& name, return GetAttrValue(bsSpace, bsName, attribute); } +WideString CXML_Element::GetAttrValue(const ByteStringView& name) const { + WideString attr; + GetAttrValue(name, attr); + return attr; +} + bool CXML_Element::GetAttrValue(const ByteStringView& space, const ByteStringView& name, WideString& attribute) const { @@ -117,36 +112,10 @@ bool CXML_Element::GetAttrInteger(const ByteStringView& name, return true; } -bool CXML_Element::GetAttrInteger(const ByteStringView& space, - const ByteStringView& name, - int& attribute) const { - const WideString* pwsValue = - m_AttrMap.Lookup(ByteString(space), ByteString(name)); - if (!pwsValue) - return false; - - attribute = pwsValue->GetInteger(); - return true; -} - -bool CXML_Element::GetAttrFloat(const ByteStringView& name, - float& attribute) const { - ByteStringView bsSpace; - ByteStringView bsName; - FX_XML_SplitQualifiedName(name, bsSpace, bsName); - return GetAttrFloat(bsSpace, bsName, attribute); -} - -bool CXML_Element::GetAttrFloat(const ByteStringView& space, - const ByteStringView& name, - float& attribute) const { - const WideString* pValue = - m_AttrMap.Lookup(ByteString(space), ByteString(name)); - if (!pValue) - return false; - - attribute = pValue->GetFloat(); - return true; +int CXML_Element::GetAttrInteger(const ByteStringView& name) const { + int attr = 0; + GetAttrInteger(name, attr); + return attr; } uint32_t CXML_Element::CountElements(const ByteStringView& space, @@ -183,23 +152,8 @@ CXML_Element* CXML_Element::GetElement(const ByteStringView& space, return nullptr; } -uint32_t CXML_Element::FindElement(CXML_Element* pElement) const { - int index = 0; - for (const auto& pChild : m_Children) { - CXML_Element* pKid = pChild->AsElement(); - if (pKid && pKid == pElement) - return index; - - ++index; - } - return 0xFFFFFFFF; -} - -void CXML_Element::SetTag(const ByteStringView& qTagName) { - ASSERT(!qTagName.IsEmpty()); - ByteStringView bsSpace; - ByteStringView bsName; - FX_XML_SplitQualifiedName(qTagName, bsSpace, bsName); - m_QSpaceName = bsSpace; - m_TagName = bsName; +void CXML_Element::SetAttribute(const ByteString& space, + const ByteString& name, + const WideString& value) { + m_AttrMap.SetAt(space, name, value); } diff --git a/core/fxcrt/xml/cxml_element.h b/core/fxcrt/xml/cxml_element.h index a851a86f1c..498a0708ad 100644 --- a/core/fxcrt/xml/cxml_element.h +++ b/core/fxcrt/xml/cxml_element.h @@ -28,7 +28,6 @@ class CXML_Element : public CXML_Object { const CXML_Element* AsElement() const override; ByteString GetTagName(bool bQualified = false) const; - ByteString GetNamespace(bool bQualified = false) const; ByteString GetNamespaceURI(const ByteString& qName) const; const CXML_Element* GetParent() const { return m_pParent.Get(); } uint32_t CountAttrs() const { return m_AttrMap.GetSize(); } @@ -36,57 +35,9 @@ class CXML_Element : public CXML_Object { ByteString* space, ByteString* name, WideString* value) const; - bool HasAttr(const ByteStringView& qName) const; - bool GetAttrValue(const ByteStringView& name, WideString& attribute) const; - WideString GetAttrValue(const ByteStringView& name) const { - WideString attr; - GetAttrValue(name, attr); - return attr; - } - - bool GetAttrValue(const ByteStringView& space, - const ByteStringView& name, - WideString& attribute) const; - WideString GetAttrValue(const ByteStringView& space, - const ByteStringView& name) const { - WideString attr; - GetAttrValue(space, name, attr); - return attr; - } - - bool GetAttrInteger(const ByteStringView& name, int& attribute) const; - int GetAttrInteger(const ByteStringView& name) const { - int attr = 0; - GetAttrInteger(name, attr); - return attr; - } + WideString GetAttrValue(const ByteStringView& name) const; - bool GetAttrInteger(const ByteStringView& space, - const ByteStringView& name, - int& attribute) const; - int GetAttrInteger(const ByteStringView& space, - const ByteStringView& name) const { - int attr = 0; - GetAttrInteger(space, name, attr); - return attr; - } - - bool GetAttrFloat(const ByteStringView& name, float& attribute) const; - float GetAttrFloat(const ByteStringView& name) const { - float attr = 0; - GetAttrFloat(name, attr); - return attr; - } - - bool GetAttrFloat(const ByteStringView& space, - const ByteStringView& name, - float& attribute) const; - float GetAttrFloat(const ByteStringView& space, - const ByteStringView& name) const { - float attr = 0; - GetAttrFloat(space, name, attr); - return attr; - } + int GetAttrInteger(const ByteStringView& name) const; void AppendChild(std::unique_ptr<CXML_Object> child) { m_Children.push_back(std::move(child)); @@ -99,17 +50,18 @@ class CXML_Element : public CXML_Object { CXML_Element* GetElement(const ByteStringView& space, const ByteStringView& tag, int nth) const; - uint32_t FindElement(CXML_Element* pElement) const; - void SetTag(const ByteStringView& qTagName); - void RemoveChild(uint32_t index); void SetAttribute(const ByteString& space, const ByteString& name, - const WideString& value) { - m_AttrMap.SetAt(space, name, value); - } + const WideString& value); private: + bool GetAttrValue(const ByteStringView& name, WideString& attribute) const; + bool GetAttrValue(const ByteStringView& space, + const ByteStringView& name, + WideString& attribute) const; + bool GetAttrInteger(const ByteStringView& name, int& attribute) const; + UnownedPtr<const CXML_Element> const m_pParent; ByteString m_QSpaceName; ByteString m_TagName; |