Remove unused XMLNode::add_property methods

These are now unused and functionality is replaced by XMLNode::set_property

set_property is a better name as a node can only have properties with unique
names and the property will be set or reset(if it already exists). Changing the
name also makes it easier to transition and test the new API.
This commit is contained in:
Tim Mayberry 2016-08-30 18:59:05 +10:00
parent e4b1ece143
commit 6e467153a0
2 changed files with 4 additions and 28 deletions

View File

@ -141,10 +141,6 @@ public:
bool has_property_with_value (const std::string&, const std::string&) const;
XMLProperty* add_property(const char* name, const std::string& value);
XMLProperty* add_property(const char* name, const char* value = "");
XMLProperty* add_property(const char* name, const long value);
bool set_property (const char* name, const std::string& value);
bool set_property (const char* name, const char* cstr) {

View File

@ -286,7 +286,7 @@ XMLNode::operator= (const XMLNode& from)
const XMLPropertyList& props = from.properties ();
for (XMLPropertyConstIterator prop_iter = props.begin (); prop_iter != props.end (); ++prop_iter) {
add_property ((*prop_iter)->name ().c_str (), (*prop_iter)->value ());
set_property ((*prop_iter)->name ().c_str (), (*prop_iter)->value ());
}
const XMLNodeList& nodes = from.children ();
@ -551,8 +551,8 @@ XMLNode::has_property_with_value (const string& name, const string& value) const
return false;
}
XMLProperty*
XMLNode::add_property(const char* name, const string& value)
bool
XMLNode::set_property(const char* name, const string& value)
{
XMLPropertyIterator iter = _proplist.begin();
@ -575,26 +575,6 @@ XMLNode::add_property(const char* name, const string& value)
return new_property;
}
XMLProperty*
XMLNode::add_property(const char* n, const char* v)
{
string vs(v);
return add_property(n, vs);
}
XMLProperty*
XMLNode::add_property(const char* name, const long value)
{
char str[64];
snprintf(str, sizeof(str), "%ld", value);
return add_property(name, str);
}
bool
XMLNode::set_property(const char* name, const string& str) {
return add_property (name, str);
}
bool
XMLNode::get_property(const char* name, std::string& value) const
{
@ -713,7 +693,7 @@ readnode(xmlNodePtr node)
if (attr->children) {
content = (char*)attr->children->content;
}
tmp->add_property((const char*)attr->name, content);
tmp->set_property((const char*)attr->name, content);
}
if (node->content) {