[icinga-checkins] icinga.org: icinga2/master: Implement String::ToDouble().

git at icinga.org git at icinga.org
Mon Jan 21 13:45:41 CET 2013


Module: icinga2
Branch: master
Commit: 9c74bfd5be7dcba7bf8dc592f218eb117d1e598a
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=9c74bfd5be7dcba7bf8dc592f218eb117d1e598a

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Mon Jan 21 13:44:17 2013 +0100

Implement String::ToDouble().

Fixes #3544.

---

 lib/base/qstring.cpp |    5 +++++
 lib/base/qstring.h   |    2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/base/qstring.cpp b/lib/base/qstring.cpp
index 4ac2d20..30538c5 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<std::string>(str);
diff --git a/lib/base/qstring.h b/lib/base/qstring.h
index 07b7f04..298b9e1 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:





More information about the icinga-checkins mailing list