Updated param to allow value_boolean
This commit is contained in:
parent
e7843ba471
commit
7ee9745a8f
3 changed files with 22 additions and 1 deletions
|
@ -40,7 +40,7 @@ namespace mapnik
|
|||
// fwd declare
|
||||
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
|
||||
{
|
||||
|
@ -87,6 +87,12 @@ template MAPNIK_DECL
|
|||
boost::optional<value_integer> parameters::get(std::string const& key,
|
||||
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
|
||||
boost::optional<mapnik::boolean_type> parameters::get(std::string const& key) const;
|
||||
template MAPNIK_DECL
|
||||
|
|
|
@ -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 <>
|
||||
struct extract_value<mapnik::boolean_type>
|
||||
{
|
||||
|
|
|
@ -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, 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, boolean_type const& default_opt_value) const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue