From 43c04a72bfb40e8fbf1f2e8aa2206dca05341803 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 22 Sep 2014 12:04:05 +0100 Subject: [PATCH] add set_property_from_xml_impl specialization from std::string ( parse as an expression first ) --- include/mapnik/text/properties_util.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/mapnik/text/properties_util.hpp b/include/mapnik/text/properties_util.hpp index aa55e444f..e571318f4 100644 --- a/include/mapnik/text/properties_util.hpp +++ b/include/mapnik/text/properties_util.hpp @@ -68,6 +68,31 @@ struct set_property_from_xml_impl } }; + +template <> +struct set_property_from_xml_impl +{ + using target_type = std::string; + template + static void apply(T1 & val, char const* name, xml_node const& node) + { + try + { + boost::optional val_ = node.get_opt_attr(name); + if (val_) val = *val_; + } + catch (config_error const& ex) + { + boost::optional val_ = node.get_opt_attr(name); + if (val_) val = *val_; + else + { + ex.append_context(std::string("set_property_from_xml'"+ std::string(name) + "'"), node); + } + } + } +}; + template struct set_property_from_xml_impl {