diff options
author | Ilya Zverev <zverik@textual.ru> | 2016-06-27 17:45:27 +0300 |
---|---|---|
committer | Ilya Zverev <zverik@textual.ru> | 2016-06-28 11:13:48 +0300 |
commit | b2b1c5132a3ef3755c051aaa121e1fd478722fb1 (patch) | |
tree | 4e71eabe69f2c8578fa174808bcf4a0201579ace /editor | |
parent | 3238e11b7a82974a47f46809739ba6a1f7b166f4 (diff) |
[editor] Trim name
Diffstat (limited to 'editor')
-rw-r--r-- | editor/xml_feature.cpp | 9 | ||||
-rw-r--r-- | editor/xml_feature.hpp | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/editor/xml_feature.cpp b/editor/xml_feature.cpp index c125725efb..f4a7da6ca6 100644 --- a/editor/xml_feature.cpp +++ b/editor/xml_feature.cpp @@ -105,7 +105,7 @@ bool XMLFeature::operator==(XMLFeature const & other) const vector<XMLFeature> XMLFeature::FromOSM(string const & osmXml) { pugi::xml_document doc; - if (doc.load_string(osmXml.c_str()).status != pugi::status_ok) + if (doc.load_string(osmXml.data()).status != pugi::status_ok) MYTHROW(editor::InvalidXML, ("Not valid XML:", osmXml)); vector<XMLFeature> features; @@ -349,14 +349,15 @@ string XMLFeature::GetTagValue(string const & key) const return tag.attribute("v").value(); } -void XMLFeature::SetTagValue(string const & key, string const & value) +void XMLFeature::SetTagValue(string const & key, string value) { + strings::Trim(value); auto tag = FindTag(m_document, key); if (!tag) { tag = GetRootNode().append_child("tag"); - tag.append_attribute("k").set_value(key.c_str()); - tag.append_attribute("v").set_value(value.c_str()); + tag.append_attribute("k").set_value(key.data()); + tag.append_attribute("v").set_value(value.data()); } else { diff --git a/editor/xml_feature.hpp b/editor/xml_feature.hpp index 5b1c54d99e..d6bbf67985 100644 --- a/editor/xml_feature.hpp +++ b/editor/xml_feature.hpp @@ -155,7 +155,7 @@ public: } string GetTagValue(string const & key) const; - void SetTagValue(string const & key, string const & value); + void SetTagValue(string const & key, string value); string GetAttribute(string const & key) const; void SetAttribute(string const & key, string const & value); |