diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-04-05 11:48:21 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-05 16:10:44 +0000 |
commit | 5fa4e981ed6c431d86c51a74eba19ea4b816f541 (patch) | |
tree | 4bfa4afc2b89e1a423ec4838937042780eaa6191 /xfa/fde/xml/cfde_xmlinstruction.h | |
parent | ddcb6e7f47e2769fb4565bd4430ecb465a1f5417 (diff) | |
download | pdfium-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_xmlinstruction.h')
-rw-r--r-- | xfa/fde/xml/cfde_xmlinstruction.h | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/xfa/fde/xml/cfde_xmlinstruction.h b/xfa/fde/xml/cfde_xmlinstruction.h index 4e891e1fac..e9c4ad3dfe 100644 --- a/xfa/fde/xml/cfde_xmlinstruction.h +++ b/xfa/fde/xml/cfde_xmlinstruction.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_XMLInstruction : public CFDE_XMLNode { +class CFDE_XMLInstruction : public CFDE_XMLAttributeNode { public: explicit CFDE_XMLInstruction(const CFX_WideString& wsTarget); ~CFDE_XMLInstruction() override; @@ -22,29 +22,13 @@ class CFDE_XMLInstruction : public CFDE_XMLNode { FDE_XMLNODETYPE GetType() const override; std::unique_ptr<CFDE_XMLNode> Clone() override; - void GetTargetName(CFX_WideString& wsTarget) const { wsTarget = m_wsTarget; } - int32_t CountAttributes() const; - bool GetAttribute(int32_t index, - CFX_WideString& wsAttriName, - CFX_WideString& wsAttriValue) const; - bool HasAttribute(const wchar_t* pwsAttriName) const; - 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 RemoveAttribute(const wchar_t* pwsAttriName); - int32_t CountData() const; - bool GetData(int32_t index, CFX_WideString& wsData) const; + const std::vector<CFX_WideString>& GetTargetData() const { + return m_TargetData; + } void AppendData(const CFX_WideString& wsData); void RemoveData(int32_t index); - CFX_WideString m_wsTarget; - std::vector<CFX_WideString> m_Attributes; + private: std::vector<CFX_WideString> m_TargetData; }; |