diff --git a/include/mapnik/boolean.hpp b/include/mapnik/boolean.hpp index 122604fc0..171cbd7b8 100644 --- a/include/mapnik/boolean.hpp +++ b/include/mapnik/boolean.hpp @@ -28,10 +28,7 @@ // std #include -#include #include -//#include -//#include namespace mapnik { diff --git a/include/mapnik/util/conversions.hpp b/include/mapnik/util/conversions.hpp index de5bd2f93..8a4c143c5 100644 --- a/include/mapnik/util/conversions.hpp +++ b/include/mapnik/util/conversions.hpp @@ -28,8 +28,7 @@ #include // stl -#include -#include +#include namespace mapnik { namespace util { @@ -39,32 +38,8 @@ to avoid the compile time overhead given it is included by many other headers inside mapnik. */ -MAPNIK_DECL inline bool string2bool(std::string const& value, bool & result) -{ - if (value.empty() || value.size() > 5) { - return false; - } else if (value == "true") { - return result = true; - } else if (value == "false") { - result = false; - return true; - } - std::string val(value); - std::transform(val.begin(), val.end(), val.begin(), ::tolower); - if (val == "true" || val == "yes" || val == "1" || val == "on") { - return result = true; - } else if (val == "false" || val == "no" || val == "0" || val == "off") { - result = false; - return true; - } - return false; -} - -MAPNIK_DECL inline bool string2bool(const char * iter, const char * end, bool & result) -{ - std::string val(iter,end); - return string2bool(val,result); -} +MAPNIK_DECL bool string2bool(std::string const& value, bool & result); +MAPNIK_DECL bool string2bool(const char * iter, const char * end, bool & result); MAPNIK_DECL bool string2int(std::string const& value, int & result); MAPNIK_DECL bool string2int(const char * iter, const char * end, int & result); diff --git a/src/conversions.cpp b/src/conversions.cpp index 250378e0e..83bdd5fae 100644 --- a/src/conversions.cpp +++ b/src/conversions.cpp @@ -56,6 +56,33 @@ auto LONGLONG = qi::long_long_type(); auto FLOAT = qi::float_type(); auto DOUBLE = qi::double_type(); +bool string2bool(std::string const& value, bool & result) +{ + if (value.empty() || value.size() > 5) { + return false; + } else if (value == "true") { + return result = true; + } else if (value == "false") { + result = false; + return true; + } + std::string val(value); + std::transform(val.begin(), val.end(), val.begin(), ::tolower); + if (val == "true" || val == "yes" || val == "1" || val == "on") { + return result = true; + } else if (val == "false" || val == "no" || val == "0" || val == "off") { + result = false; + return true; + } + return false; +} + +bool string2bool(const char * iter, const char * end, bool & result) +{ + std::string val(iter,end); + return string2bool(val,result); +} + bool string2int(const char * iter, const char * end, int & result) { ascii::space_type space;