• 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 #include "core/fxcrt/xml/cfx_xmlattributenode.h"
8 
9 #include "core/fxcrt/fx_extension.h"
10 
CFX_XMLAttributeNode(const WideString & name)11 CFX_XMLAttributeNode::CFX_XMLAttributeNode(const WideString& name)
12     : CFX_XMLNode(), name_(name) {
13   ASSERT(name_.GetLength() > 0);
14 }
15 
~CFX_XMLAttributeNode()16 CFX_XMLAttributeNode::~CFX_XMLAttributeNode() {}
17 
HasAttribute(const WideString & name) const18 bool CFX_XMLAttributeNode::HasAttribute(const WideString& name) const {
19   return attrs_.find(name) != attrs_.end();
20 }
21 
GetString(const WideString & name) const22 WideString CFX_XMLAttributeNode::GetString(const WideString& name) const {
23   auto it = attrs_.find(name);
24   return it != attrs_.end() ? it->second : WideString();
25 }
26 
SetString(const WideString & name,const WideString & value)27 void CFX_XMLAttributeNode::SetString(const WideString& name,
28                                      const WideString& value) {
29   attrs_[name] = value;
30 }
31 
RemoveAttribute(const WideString & name)32 void CFX_XMLAttributeNode::RemoveAttribute(const WideString& name) {
33   attrs_.erase(name);
34 }
35