From 589e4659555c346148b8ef0837961ba8239811d9 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 13 Dec 2017 14:35:02 +0000 Subject: Inline CXML_Element private methods. Bug: 541 Change-Id: I43bb09312b0d7312207e5c235ba80a2593877d07 Reviewed-on: https://pdfium-review.googlesource.com/21070 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fxcrt/xml/cxml_element.cpp | 39 ++++++++------------------------------- core/fxcrt/xml/cxml_element.h | 6 ------ 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/core/fxcrt/xml/cxml_element.cpp b/core/fxcrt/xml/cxml_element.cpp index 9e595914dd..ee51004b2c 100644 --- a/core/fxcrt/xml/cxml_element.cpp +++ b/core/fxcrt/xml/cxml_element.cpp @@ -72,50 +72,27 @@ void CXML_Element::GetAttrByIndex(int index, *value = item.m_Value; } -bool CXML_Element::GetAttrValue(const ByteStringView& name, - WideString& attribute) const { +WideString CXML_Element::GetAttrValue(const ByteStringView& name) const { ByteStringView bsSpace; ByteStringView bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); - 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 { const WideString* pValue = - m_AttrMap.Lookup(ByteString(space), ByteString(name)); - if (!pValue) - return false; - - attribute = *pValue; - return true; + m_AttrMap.Lookup(ByteString(bsSpace), ByteString(bsName)); + if (pValue) + attr = *pValue; + return attr; } -bool CXML_Element::GetAttrInteger(const ByteStringView& name, - int& attribute) const { +int CXML_Element::GetAttrInteger(const ByteStringView& name) const { ByteStringView bsSpace; ByteStringView bsName; FX_XML_SplitQualifiedName(name, bsSpace, bsName); + const WideString* pwsValue = m_AttrMap.Lookup(ByteString(bsSpace), ByteString(bsName)); - if (!pwsValue) - return false; - - attribute = pwsValue->GetInteger(); - return true; -} - -int CXML_Element::GetAttrInteger(const ByteStringView& name) const { - int attr = 0; - GetAttrInteger(name, attr); - return attr; + return pwsValue ? pwsValue->GetInteger() : 0; } uint32_t CXML_Element::CountElements(const ByteStringView& space, diff --git a/core/fxcrt/xml/cxml_element.h b/core/fxcrt/xml/cxml_element.h index 498a0708ad..220eb7bcad 100644 --- a/core/fxcrt/xml/cxml_element.h +++ b/core/fxcrt/xml/cxml_element.h @@ -56,12 +56,6 @@ class CXML_Element : public CXML_Object { 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 m_pParent; ByteString m_QSpaceName; ByteString m_TagName; -- cgit v1.2.3