]> granicus.if.org Git - icinga2/commitdiff
Implement String::ToDouble().
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 21 Jan 2013 12:44:17 +0000 (13:44 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 21 Jan 2013 12:44:17 +0000 (13:44 +0100)
Fixes #3544.

lib/base/qstring.cpp
lib/base/qstring.h

index 4ac2d206a09e8a2d9ae06314ed68b794c1738cee..30538c509c833df0a01dc42d3121f4c6afc83155 100644 (file)
@@ -159,6 +159,11 @@ String::ConstIterator String::End(void) const
        return m_Data.end();
 }
 
+double String::ToDouble(void) const
+{
+       return strtod(CStr(), NULL);
+}
+
 ostream& icinga::operator<<(ostream& stream, const String& str)
 {
        stream << static_cast<std::string>(str);
index 07b7f047436495b0db4e8cfec503fb742bf6bb49..298b9e1fc6ed1e3204dee4202dcc7d13b005b436 100644 (file)
@@ -87,6 +87,8 @@ public:
        Iterator End(void);
        ConstIterator End(void) const;
 
+       double ToDouble(void) const;
+
        static const size_t NPos;
 
 private: