From 5bbc8cacbd17dff3ec5d7386182f70fe8a5b91ee Mon Sep 17 00:00:00 2001 From: Jean Flach Date: Thu, 27 Aug 2015 15:50:14 +0200 Subject: [PATCH] Add String ToLower, ToUpper, change Trim fixes #9704 #9944 --- lib/base/string.cpp | 5 ----- lib/base/string.hpp | 23 ++++++++++++++++++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/base/string.cpp b/lib/base/string.cpp index 15ff24f3e..fdde209f2 100644 --- a/lib/base/string.cpp +++ b/lib/base/string.cpp @@ -21,7 +21,6 @@ #include "base/value.hpp" #include "base/primitivetype.hpp" #include "base/dictionary.hpp" -#include #include using namespace icinga; @@ -36,7 +35,3 @@ String& String::operator+=(const Value& rhs) return *this; } -void String::Trim(void) -{ - boost::algorithm::trim(m_Data); -} diff --git a/lib/base/string.hpp b/lib/base/string.hpp index 59a317d87..786e7b28b 100644 --- a/lib/base/string.hpp +++ b/lib/base/string.hpp @@ -22,6 +22,8 @@ #include "base/i2-base.hpp" #include "base/object.hpp" +#include +#include #include #include #include @@ -211,7 +213,26 @@ public: m_Data.replace(first, second, str); } - void Trim(void); + inline String Trim(void) const + { + String t = m_Data; + boost::algorithm::trim(t); + return t; + } + + inline String ToLower(void) const + { + String t = m_Data; + boost::algorithm::to_lower(t); + return t; + } + + inline String ToUpper(void) const + { + String t = m_Data; + boost::algorithm::to_upper(t); + return t; + } inline bool Contains(const String& str) const { -- 2.40.0