summaryrefslogtreecommitdiff
path: root/core/fxcrt/xml/cxml_element.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-12-13 14:34:12 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-13 14:34:12 +0000
commit753edfbfa7310241c51c61e2045f0f55971c142a (patch)
treea5af22388e425c089828f96865ab752ab9bc2eb4 /core/fxcrt/xml/cxml_element.cpp
parentf85c43bc73740cc9887da7c790c79469610c9646 (diff)
downloadpdfium-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/xml/cxml_element.cpp')
-rw-r--r--core/fxcrt/xml/cxml_element.cpp74
1 files changed, 14 insertions, 60 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);
}