Commit d20d8bd9 authored by Christopher Mueller's avatar Christopher Mueller Committed by Hugo Beauzée-Luyssen

dash: node added hasattribute

Signed-off-by: default avatarHugo Beauzée-Luyssen <beauze.h@gmail.com>
parent 998f1619
...@@ -45,7 +45,7 @@ Node::~Node () ...@@ -45,7 +45,7 @@ Node::~Node ()
delete(this->subNodes.at(i)); delete(this->subNodes.at(i));
} }
const std::vector<Node*>& Node::getSubNodes () const const std::vector<Node*>& Node::getSubNodes () const
{ {
return this->subNodes; return this->subNodes;
} }
...@@ -62,6 +62,13 @@ void Node::setName (const std::stri ...@@ -62,6 +62,13 @@ void Node::setName (const std::stri
this->name = name; this->name = name;
} }
bool Node::hasAttribute (const std::string& name)
{
if(this->attributes.find(name) != this->attributes.end())
return true;
return false;
}
const std::string& Node::getAttributeValue (const std::string& key) const const std::string& Node::getAttributeValue (const std::string& key) const
{ {
std::map<std::string, std::string>::const_iterator it = this->attributes.find( key ); std::map<std::string, std::string>::const_iterator it = this->attributes.find( key );
......
...@@ -44,6 +44,7 @@ namespace dash ...@@ -44,6 +44,7 @@ namespace dash
void addSubNode (Node *node); void addSubNode (Node *node);
const std::string& getName () const; const std::string& getName () const;
void setName (const std::string& name); void setName (const std::string& name);
bool hasAttribute (const std::string& name);
void addAttribute (const std::string& key, const std::string& value); void addAttribute (const std::string& key, const std::string& value);
const std::string& getAttributeValue (const std::string& key) const; const std::string& getAttributeValue (const std::string& key) const;
std::vector<std::string> getAttributeKeys () const; std::vector<std::string> getAttributeKeys () const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment