diff options
author | Vincent Richard <[email protected]> | 2005-05-15 18:05:38 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2005-05-15 18:05:38 +0000 |
commit | 8134a52f56697a51c734e1406d57a05fda77bac7 (patch) | |
tree | dd7fee1a9a7922fcdbaec7592b8ce39e1a031c38 /src/propertySet.cpp | |
parent | Oops... missing ')'. (diff) | |
download | vmime-8134a52f56697a51c734e1406d57a05fda77bac7.tar.gz vmime-8134a52f56697a51c734e1406d57a05fda77bac7.zip |
Service properties enhancement.
Diffstat (limited to 'src/propertySet.cpp')
-rw-r--r-- | src/propertySet.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
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 |