]> granicus.if.org Git - icinga2/commitdiff
Add String ToLower, ToUpper, change Trim
authorJean Flach <jean-marcel.flach@netways.de>
Thu, 27 Aug 2015 13:50:14 +0000 (15:50 +0200)
committerJean Flach <jean-marcel.flach@netways.de>
Thu, 27 Aug 2015 15:18:21 +0000 (17:18 +0200)
fixes #9704 #9944

lib/base/string.cpp
lib/base/string.hpp

index 15ff24f3e134f5d77b6dfabd82040d157ad218ec..fdde209f23e4f75f221f165ef9693963eb5403d9 100644 (file)
@@ -21,7 +21,6 @@
 #include "base/value.hpp"
 #include "base/primitivetype.hpp"
 #include "base/dictionary.hpp"
-#include <boost/algorithm/string/trim.hpp>
 #include <ostream>
 
 using namespace icinga;
@@ -36,7 +35,3 @@ String& String::operator+=(const Value& rhs)
        return *this;
 }
 
-void String::Trim(void)
-{
-       boost::algorithm::trim(m_Data);
-}
index 59a317d87384a522260e153eac9bc1ea71fee669..786e7b28b4cd49992e702edcef83b0fd330eea88 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "base/i2-base.hpp"
 #include "base/object.hpp"
+#include <boost/algorithm/string/case_conv.hpp>
+#include <boost/algorithm/string/trim.hpp>
 #include <boost/range/iterator.hpp>
 #include <string.h>
 #include <functional>
@@ -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
        {