• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FXCRT_XML_CFX_XMLATTRIBUTENODE_H_
8 #define CORE_FXCRT_XML_CFX_XMLATTRIBUTENODE_H_
9 
10 #include <map>
11 #include <memory>
12 
13 #include "core/fxcrt/fx_string.h"
14 #include "core/fxcrt/xml/cfx_xmlnode.h"
15 
16 class CFX_XMLAttributeNode : public CFX_XMLNode {
17  public:
18   explicit CFX_XMLAttributeNode(const WideString& name);
19   ~CFX_XMLAttributeNode() override;
20 
21   // CFX_XMLNode
22   FX_XMLNODETYPE GetType() const override = 0;
23   std::unique_ptr<CFX_XMLNode> Clone() override = 0;
24 
GetName()25   WideString GetName() const { return name_; }
GetAttributes()26   const std::map<WideString, WideString>& GetAttributes() const {
27     return attrs_;
28   }
SetAttributes(const std::map<WideString,WideString> & attrs)29   void SetAttributes(const std::map<WideString, WideString>& attrs) {
30     attrs_ = attrs;
31   }
32   bool HasAttribute(const WideString& name) const;
33 
34   void SetString(const WideString& name, const WideString& value);
35   WideString GetString(const WideString& name) const;
36 
37   void RemoveAttribute(const WideString& name);
38 
39  private:
40   WideString name_;
41   std::map<WideString, WideString> attrs_;
42 };
43 
44 #endif  // CORE_FXCRT_XML_CFX_XMLATTRIBUTENODE_H_
45