diff --git a/sflphone-common/src/config/yamlnode.cpp b/sflphone-common/src/config/yamlnode.cpp index 508adfce63db5a6664c677ecdbb17368ce3a505d..08de28df992b6a7405c2c847d85915d3d6e58769 100644 --- a/sflphone-common/src/config/yamlnode.cpp +++ b/sflphone-common/src/config/yamlnode.cpp @@ -95,13 +95,13 @@ void MappingNode::addNode (YamlNode *node) map.insert (it, std::pair<std::string, YamlNode *> (tmpKey, node)); } -void MappingNode::setKeyValue (std::string key, YamlNode *value) +void MappingNode::setKeyValue (const std::string &key, YamlNode *value) { Mapping::iterator it = map.end(); map.insert (it, std::pair<std::string, YamlNode *> (key, value)); } -void MappingNode::removeKeyValue (std::string key) +void MappingNode::removeKeyValue (const std::string &key) { Mapping::iterator it = map.find (key); @@ -109,7 +109,7 @@ void MappingNode::removeKeyValue (std::string key) } -YamlNode *MappingNode::getValue (std::string key) +YamlNode *MappingNode::getValue (const std::string &key) { Mapping::iterator it = map.find (key); @@ -122,7 +122,7 @@ YamlNode *MappingNode::getValue (std::string key) } } -void MappingNode::getValue (std::string key, bool *b) +void MappingNode::getValue (const std::string &key, bool *b) { ScalarNode *node = (ScalarNode*)getValue(key); if (!node) @@ -132,7 +132,7 @@ void MappingNode::getValue (std::string key, bool *b) *b = v == "true"; } -void MappingNode::getValue (std::string key, int *i) +void MappingNode::getValue (const std::string &key, int *i) { ScalarNode *node = (ScalarNode*)getValue(key); if (!node) @@ -142,7 +142,7 @@ void MappingNode::getValue (std::string key, int *i) *i = atoi(v.c_str()); } -void MappingNode::getValue (std::string key, std::string *v) +void MappingNode::getValue (const std::string &key, std::string *v) { ScalarNode *node = (ScalarNode*)getValue(key); if (!node) diff --git a/sflphone-common/src/config/yamlnode.h b/sflphone-common/src/config/yamlnode.h index ebfab90f77c77dd58c776042e095f3061e8ae037..393f4e2cdd6cb634b12dbdf145fbfe82fbcb921b 100644 --- a/sflphone-common/src/config/yamlnode.h +++ b/sflphone-common/src/config/yamlnode.h @@ -143,14 +143,14 @@ class MappingNode : public YamlNode tmpKey = key; } - void setKeyValue (std::string key, YamlNode *value); + void setKeyValue (const std::string &key, YamlNode *value); - void removeKeyValue (std::string key); + void removeKeyValue (const std::string &key); - YamlNode *getValue (std::string key); - void getValue (std::string key, bool *b); - void getValue (std::string key, int *i); - void getValue (std::string key, std::string *s); + YamlNode *getValue (const std::string &key); + void getValue (const std::string &key, bool *b); + void getValue (const std::string &key, int *i); + void getValue (const std::string &key, std::string *s); virtual void deleteChildNodes (void);