summaryrefslogtreecommitdiff
path: root/xfa/fde/xml/cfde_xmlelement.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-05 11:48:21 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-05 16:10:44 +0000
commit5fa4e981ed6c431d86c51a74eba19ea4b816f541 (patch)
tree4bfa4afc2b89e1a423ec4838937042780eaa6191 /xfa/fde/xml/cfde_xmlelement.h
parentddcb6e7f47e2769fb4565bd4430ecb465a1f5417 (diff)
downloadpdfium-5fa4e981ed6c431d86c51a74eba19ea4b816f541.tar.xz
Move XML attribute handling to a base class.
This CL moves the attribute handling out of CFDE_XMLElement and CFDE_XMLInstruction into a common CFDE_XMLAttributeNode. The handling is also converted to a std::map from either a) a vector storing name,value,name,value or b) two vectors one for names and the other for values. The unused Get/Set methods for interger and float are removed and the iteration is converted to use iterators. Change-Id: Icda00ae898a595d58b06af0ced337f55f47c317c Reviewed-on: https://pdfium-review.googlesource.com/3753 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/xml/cfde_xmlelement.h')
-rw-r--r--xfa/fde/xml/cfde_xmlelement.h36
1 files changed, 6 insertions, 30 deletions
diff --git a/xfa/fde/xml/cfde_xmlelement.h b/xfa/fde/xml/cfde_xmlelement.h
index c4c522e8a5..a891ce8928 100644
--- a/xfa/fde/xml/cfde_xmlelement.h
+++ b/xfa/fde/xml/cfde_xmlelement.h
@@ -11,9 +11,9 @@
#include <vector>
#include "core/fxcrt/fx_string.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "xfa/fde/xml/cfde_xmlattributenode.h"
-class CFDE_XMLElement : public CFDE_XMLNode {
+class CFDE_XMLElement : public CFDE_XMLAttributeNode {
public:
explicit CFDE_XMLElement(const CFX_WideString& wsTag);
~CFDE_XMLElement() override;
@@ -22,36 +22,12 @@ class CFDE_XMLElement : public CFDE_XMLNode {
FDE_XMLNODETYPE GetType() const override;
std::unique_ptr<CFDE_XMLNode> Clone() override;
- void GetTagName(CFX_WideString& wsTag) const;
- void GetLocalTagName(CFX_WideString& wsTag) const;
+ CFX_WideString GetLocalTagName() const;
+ CFX_WideString GetNamespacePrefix() const;
+ CFX_WideString GetNamespaceURI() const;
- void GetNamespacePrefix(CFX_WideString& wsPrefix) const;
- void GetNamespaceURI(CFX_WideString& wsNamespace) const;
-
- int32_t CountAttributes() const;
- bool GetAttribute(int32_t index,
- CFX_WideString& wsAttriName,
- CFX_WideString& wsAttriValue) const;
- bool HasAttribute(const wchar_t* pwsAttriName) const;
- void RemoveAttribute(const wchar_t* pwsAttriName);
-
- void GetString(const wchar_t* pwsAttriName,
- CFX_WideString& wsAttriValue,
- const wchar_t* pwsDefValue = nullptr) const;
- void SetString(const CFX_WideString& wsAttriName,
- const CFX_WideString& wsAttriValue);
-
- int32_t GetInteger(const wchar_t* pwsAttriName, int32_t iDefValue = 0) const;
- void SetInteger(const wchar_t* pwsAttriName, int32_t iAttriValue);
-
- float GetFloat(const wchar_t* pwsAttriName, float fDefValue = 0) const;
- void SetFloat(const wchar_t* pwsAttriName, float fAttriValue);
-
- void GetTextData(CFX_WideString& wsText) const;
+ CFX_WideString GetTextData() const;
void SetTextData(const CFX_WideString& wsText);
-
- CFX_WideString m_wsTag;
- std::vector<CFX_WideString> m_Attributes;
};
#endif // XFA_FDE_XML_CFDE_XMLELEMENT_H_