reduce string copying slightly in populate_tree - refs #1055
This commit is contained in:
parent
cb048b92d4
commit
ab776edbf5
3 changed files with 6 additions and 5 deletions
|
@ -51,7 +51,7 @@ public:
|
|||
class node_not_found: public std::exception
|
||||
{
|
||||
public:
|
||||
node_not_found(std::string node_name);
|
||||
node_not_found(std::string const& node_name);
|
||||
virtual const char* what() const throw();
|
||||
~node_not_found() throw ();
|
||||
private:
|
||||
|
@ -84,7 +84,7 @@ class xml_node
|
|||
public:
|
||||
typedef std::list<xml_node>::const_iterator const_iterator;
|
||||
typedef std::map<std::string, xml_attribute> attribute_map;
|
||||
xml_node(xml_tree &tree, std::string name, unsigned line=0, bool text_node = false);
|
||||
xml_node(xml_tree &tree, std::string const& name, unsigned line=0, bool text_node = false);
|
||||
|
||||
std::string const& name() const;
|
||||
std::string const& text() const;
|
||||
|
|
|
@ -185,7 +185,8 @@ private:
|
|||
break;
|
||||
case XML_TEXT_NODE:
|
||||
{
|
||||
std::string trimmed = boost::algorithm::trim_copy(std::string((char*)cur_node->content));
|
||||
std::string trimmed((char*)cur_node->content);
|
||||
boost::algorithm::trim(trimmed);
|
||||
if (trimmed.empty()) break; //Don't add empty text nodes
|
||||
node.add_child(trimmed, cur_node->line, true);
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ xml_attribute::xml_attribute(std::string const& value_)
|
|||
|
||||
/****************************************************************************/
|
||||
|
||||
node_not_found::node_not_found(std::string node_name)
|
||||
node_not_found::node_not_found(std::string const& node_name)
|
||||
: node_name_(node_name)
|
||||
{
|
||||
|
||||
|
@ -255,7 +255,7 @@ more_than_one_child::~more_than_one_child() throw()
|
|||
|
||||
/****************************************************************************/
|
||||
|
||||
xml_node::xml_node(xml_tree &tree, std::string name, unsigned line, bool text_node)
|
||||
xml_node::xml_node(xml_tree &tree, std::string const& name, unsigned line, bool text_node)
|
||||
: tree_(tree),
|
||||
name_(name),
|
||||
text_node_(text_node),
|
||||
|
|
Loading…
Reference in a new issue