properties_util : template apply static method on value type

This commit is contained in:
artemp 2014-09-22 11:23:57 +01:00
parent 5df668d126
commit 5db32ab2e2

View file

@ -44,10 +44,11 @@ struct is_mapnik_enumeration<T, typename std::enable_if<std::is_enum<typename T:
static constexpr bool value = true;
};
template <typename T0, typename T1, bool is_mapnik_enumeration = false>
template <typename T0, bool is_mapnik_enumeration = false>
struct set_property_from_xml_impl
{
using target_type = T0;
template <typename T1>
static void apply(T1 & val, char const* name, xml_node const& node)
{
try
@ -67,10 +68,11 @@ struct set_property_from_xml_impl
}
};
template <typename T0, typename T1>
struct set_property_from_xml_impl<T0, T1, true>
template <typename T0>
struct set_property_from_xml_impl<T0, true>
{
using target_enum_type = T0;
template <typename T1>
static void apply(T1 & val, char const* name, xml_node const& node)
{
try
@ -100,7 +102,7 @@ struct set_property_from_xml_impl<T0, T1, true>
template <typename T0, typename T1>
void set_property_from_xml(T1 & val, char const* name, xml_node const& node)
{
detail::set_property_from_xml_impl<T0, T1, detail::is_mapnik_enumeration<T0>::value>::apply(val, name, node);
detail::set_property_from_xml_impl<T0, detail::is_mapnik_enumeration<T0>::value>::apply(val, name, node);
}
void serialize_property(std::string const& name, symbolizer_base::value_type const& val, boost::property_tree::ptree & node);