From 9c74bfd5be7dcba7bf8dc592f218eb117d1e598a Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 21 Jan 2013 13:44:17 +0100 Subject: [PATCH] Implement String::ToDouble(). Fixes #3544. --- lib/base/qstring.cpp | 5 +++++ lib/base/qstring.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lib/base/qstring.cpp b/lib/base/qstring.cpp index 4ac2d206a..30538c509 100644 --- a/lib/base/qstring.cpp +++ b/lib/base/qstring.cpp @@ -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(str); diff --git a/lib/base/qstring.h b/lib/base/qstring.h index 07b7f0474..298b9e1fc 100644 --- a/lib/base/qstring.h +++ b/lib/base/qstring.h @@ -87,6 +87,8 @@ public: Iterator End(void); ConstIterator End(void) const; + double ToDouble(void) const; + static const size_t NPos; private: -- 2.40.0