Merge branch 'master' into mapnik-geometry

This commit is contained in:
artemp 2015-03-10 11:17:53 +01:00
commit c3284aa958
3 changed files with 22 additions and 1 deletions

View file

@ -40,7 +40,7 @@ namespace mapnik
// fwd declare // fwd declare
class boolean_type; class boolean_type;
using value_holder_base = util::variant<value_null,value_integer,value_double,std::string>; using value_holder_base = util::variant<value_null,value_integer,value_double,std::string,value_bool>;
struct value_holder : value_holder_base struct value_holder : value_holder_base
{ {
@ -87,6 +87,12 @@ template MAPNIK_DECL
boost::optional<value_integer> parameters::get(std::string const& key, boost::optional<value_integer> parameters::get(std::string const& key,
value_integer const& default_opt_value) const; value_integer const& default_opt_value) const;
template MAPNIK_DECL
boost::optional<value_bool> parameters::get(std::string const& key) const;
template MAPNIK_DECL
boost::optional<value_bool> parameters::get(std::string const& key,
value_bool const& default_opt_value) const;
template MAPNIK_DECL template MAPNIK_DECL
boost::optional<mapnik::boolean_type> parameters::get(std::string const& key) const; boost::optional<mapnik::boolean_type> parameters::get(std::string const& key) const;
template MAPNIK_DECL template MAPNIK_DECL

View file

@ -55,6 +55,18 @@ struct extract_value
} }
}; };
template <>
struct extract_value<value_bool>
{
static inline boost::optional<value_bool> do_extract_from_string(std::string const& source)
{
bool result;
if (mapnik::util::string2bool(source, result))
return boost::optional<value_bool>(result);
return boost::optional<value_bool>();
}
};
template <> template <>
struct extract_value<mapnik::boolean_type> struct extract_value<mapnik::boolean_type>
{ {

View file

@ -34,6 +34,9 @@ template boost::optional<std::string> parameters::get(std::string const& key, st
template boost::optional<value_double> parameters::get(std::string const& key) const; template boost::optional<value_double> parameters::get(std::string const& key) const;
template boost::optional<value_double> parameters::get(std::string const& key, value_double const& default_opt_value) const; template boost::optional<value_double> parameters::get(std::string const& key, value_double const& default_opt_value) const;
template boost::optional<value_bool> parameters::get(std::string const& key) const;
template boost::optional<value_bool> parameters::get(std::string const& key, value_bool const& default_opt_value) const;
template boost::optional<boolean_type> parameters::get(std::string const& key) const; template boost::optional<boolean_type> parameters::get(std::string const& key) const;
template boost::optional<boolean_type> parameters::get(std::string const& key, boolean_type const& default_opt_value) const; template boost::optional<boolean_type> parameters::get(std::string const& key, boolean_type const& default_opt_value) const;