diff options
Diffstat (limited to 'core/fxcrt/xml')
-rw-r--r-- | core/fxcrt/xml/cxml_element.cpp | 39 | ||||
-rw-r--r-- | 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 CXML_Element> const m_pParent; ByteString m_QSpaceName; ByteString m_TagName; |