From 8b0cf76f00c6e89e8bb7bf4bcf2189b27baac31c Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Mon, 16 Apr 2018 21:24:57 +0000 Subject: Merge CFX_XMLElement and CFX_XMLAttributeNode CFX_XMLElement is the only subclass of CFX_XMLAttributeNode. This CL merges the two classes together. The {Set|Get}String method has been renamed to {Set|Get}Attribute to make it clearer what you're retrieving. Change-Id: I158c961d4d8c5f563d937a3e7a35321a33622562 Reviewed-on: https://pdfium-review.googlesource.com/30710 Commit-Queue: dsinclair Reviewed-by: Henrique Nakashima --- core/fxcrt/xml/cfx_xmlelement.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'core/fxcrt/xml/cfx_xmlelement.h') diff --git a/core/fxcrt/xml/cfx_xmlelement.h b/core/fxcrt/xml/cfx_xmlelement.h index f713114eb7..f8533a1445 100644 --- a/core/fxcrt/xml/cfx_xmlelement.h +++ b/core/fxcrt/xml/cfx_xmlelement.h @@ -7,13 +7,14 @@ #ifndef CORE_FXCRT_XML_CFX_XMLELEMENT_H_ #define CORE_FXCRT_XML_CFX_XMLELEMENT_H_ +#include #include #include #include "core/fxcrt/fx_string.h" -#include "core/fxcrt/xml/cfx_xmlattributenode.h" +#include "core/fxcrt/xml/cfx_xmlnode.h" -class CFX_XMLElement : public CFX_XMLAttributeNode { +class CFX_XMLElement : public CFX_XMLNode { public: explicit CFX_XMLElement(const WideString& wsTag); ~CFX_XMLElement() override; @@ -23,6 +24,17 @@ class CFX_XMLElement : public CFX_XMLAttributeNode { std::unique_ptr Clone() override; void Save(const RetainPtr& pXMLStream) override; + WideString GetName() const { return name_; } + + const std::map& GetAttributes() const { + return attrs_; + } + bool HasAttribute(const WideString& name) const; + void SetAttribute(const WideString& name, const WideString& value); + WideString GetAttribute(const WideString& name) const; + + void RemoveAttribute(const WideString& name); + CFX_XMLElement* GetFirstChildNamed(const WideStringView& name) const; CFX_XMLElement* GetNthChildNamed(const WideStringView& name, size_t idx) const; @@ -33,6 +45,12 @@ class CFX_XMLElement : public CFX_XMLAttributeNode { WideString GetTextData() const; void SetTextData(const WideString& wsText); + + private: + WideString AttributeToString(const WideString& name, const WideString& value); + + WideString name_; + std::map attrs_; }; #endif // CORE_FXCRT_XML_CFX_XMLELEMENT_H_ -- cgit v1.2.3