Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Andrianov <maksimandrianov1@gmail.com>2019-10-29 13:59:11 +0300
committermpimenov <mpimenov@users.noreply.github.com>2021-01-26 16:48:44 +0300
commit5ed308ed0ed0002e18163ff5b351daad15dbd73a (patch)
treef9c5828ca668bee5c82526d6a6f8e454c3b4ab2b
parent5cbe72368aaf10bcb6b4c4239fc01046ebf7af24 (diff)
[generator] Used trim without locale instead of boost::trim.
-rw-r--r--generator/osm_element.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/generator/osm_element.cpp b/generator/osm_element.cpp
index 2446f6c3ed..6ccc9e24eb 100644
--- a/generator/osm_element.cpp
+++ b/generator/osm_element.cpp
@@ -9,6 +9,27 @@
#include <cstring>
#include <sstream>
+namespace
+{
+std::string & Ltrim(std::string & s)
+{
+ s.erase(s.begin(), std::find_if(s.cbegin(), s.cend(), [](auto c) {return !std::isspace(c); }));
+ return s;
+}
+
+std::string & Rtrim(std::string & s)
+{
+ s.erase(std::find_if(s.crbegin(), s.crend(), [](auto c) {return !std::isspace(c); }).base(),
+ s.end());
+ return s;
+}
+
+std::string & Trim(std::string & s)
+{
+ return Ltrim(Rtrim(s));
+}
+} // namespace
+
std::string DebugPrint(OsmElement::EntityType type)
{
switch (type)
@@ -69,8 +90,7 @@ void OsmElement::AddTag(char const * key, char const * value)
#undef SKIP_KEY_BY_PREFIX
std::string val{value};
- strings::Trim(val);
- m_tags.emplace_back(key, std::move(val));
+ m_tags.emplace_back(key, std::move(Trim(val)));
}
void OsmElement::AddTag(std::string const & key, std::string const & value)