From 8134a52f56697a51c734e1406d57a05fda77bac7 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sun, 15 May 2005 18:05:38 +0000 Subject: Service properties enhancement. --- src/propertySet.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/propertySet.cpp') diff --git a/src/propertySet.cpp b/src/propertySet.cpp index 67f923ef..88ee4f57 100644 --- a/src/propertySet.cpp +++ b/src/propertySet.cpp @@ -324,6 +324,46 @@ const bool propertySet::property::getValue() const } } + + + +template <> +const string propertySet::valueFromString(const string& value) +{ + return value; +} + + +template <> +const string propertySet::valueToString(const string& value) +{ + return value; +} + + +template <> +const bool propertySet::valueFromString(const string& value) +{ + if (utility::stringUtils::toLower(value) == "true") + return true; + else + { + int val = 0; + + std::istringstream iss(value); + iss >> val; + + return (!iss.fail() && val != 0); + } +} + + +template <> +const string propertySet::valueToString(const bool& value) +{ + return (value ? "true" : "false"); +} + #endif // VMIME_INLINE_TEMPLATE_SPECIALIZATION -- cgit v1.2.3