From 1c979ff4204876698426b95f11636a7668a8932b Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Thu, 12 Mar 2015 12:54:50 +0100 Subject: added methods IniValue::stringValue(), IniValue::numericValue(), etc --- include/inivalue.h | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/include/inivalue.h b/include/inivalue.h index 9f2e44c..fc3bc8f 100644 --- a/include/inivalue.h +++ b/include/inivalue.h @@ -58,7 +58,7 @@ public: */ operator bool () const { - return (bool)numericValue(); + return boolValue(); } /** @@ -67,7 +67,7 @@ public: */ operator std::string () const { - return rawValue(); + return stringValue(); } /** @@ -84,9 +84,7 @@ public: * @return double */ operator double() const; - -private: - + /** * Retrieve the value as number * @@ -98,12 +96,34 @@ private: * @return int64_t */ int64_t numericValue() const; + + /** + * Boolean value + * @return bool + */ + bool boolValue() const + { + return (bool)numericValue(); + } + + /** + * String value + * @return std::string + */ + std::string stringValue() const + { + return std::string(rawValue()); + } /** - * Get access to the raw buffer for read operationrs. + * Get access to the raw buffer for read operations. * @return const char * */ const char *rawValue() const; + + +private: + /** * ini entry name -- cgit v1.2.3