From 339f1a2919d120bd2a00ee34e7ee1056e19999d3 Mon Sep 17 00:00:00 2001 From: vng Date: Thu, 23 Aug 2012 20:48:01 +0300 Subject: [PATCH] Add strings::Trim. --- base/string_utils.cpp | 8 ++++++++ base/string_utils.hpp | 1 + map/bookmark.cpp | 4 +--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/base/string_utils.cpp b/base/string_utils.cpp index 41862ae82a..d29f24efca 100644 --- a/base/string_utils.cpp +++ b/base/string_utils.cpp @@ -4,6 +4,9 @@ #include "../std/target_os.hpp" #include "../std/iterator.hpp" +#include // boost::trim + + namespace strings { @@ -120,6 +123,11 @@ void AsciiToLower(string & s) transform(s.begin(), s.end(), s.begin(), &ascii_to_lower); } +void Trim(string & s) +{ + boost::trim(s); +} + bool EqualNoCase(string const & s1, string const & s2) { return MakeLowerCase(s1) == MakeLowerCase(s2); diff --git a/base/string_utils.hpp b/base/string_utils.hpp index 7268b8b0c6..ec1f82d5ee 100644 --- a/base/string_utils.hpp +++ b/base/string_utils.hpp @@ -32,6 +32,7 @@ UniString Normalize(UniString const & s); void Normalize(UniString & s); void AsciiToLower(string & s); +void Trim(string & s); void MakeLowerCase(string & s); string MakeLowerCase(string const & s); diff --git a/map/bookmark.cpp b/map/bookmark.cpp index 38f15c090d..ec5ce3c9c4 100644 --- a/map/bookmark.cpp +++ b/map/bookmark.cpp @@ -9,8 +9,6 @@ #include "../std/algorithm.hpp" -#include // boost::trim - void BookmarkCategory::AddBookmark(Bookmark const & bm) { @@ -143,7 +141,7 @@ namespace void CharData(string value) { - boost::trim(value); + strings::Trim(value); if (!value.empty()) switch (m_level)