本文整理汇总了C++中xml_node::has_attribute方法的典型用法代码示例。如果您正苦于以下问题:C++ xml_node::has_attribute方法的具体用法?C++ xml_node::has_attribute怎么用?C++ xml_node::has_attribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml_node
的用法示例。
在下文中一共展示了xml_node::has_attribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: text_properties_from_xml
void text_symbolizer_properties::text_properties_from_xml(xml_node const& node)
{
// The options 'margin' and 'repeat-distance' replace 'minimum-distance'.
// Only allow one or the other to be defined here.
if (node.has_attribute("margin") || node.has_attribute("repeat-distance"))
{
if (node.has_attribute("minimum-distance"))
{
throw config_error(std::string("Cannot use deprecated option minimum-distance with "
"new options margin and repeat-distance."));
}
set_property_from_xml<value_double>(expressions.margin, "margin", node);
set_property_from_xml<value_double>(expressions.repeat_distance, "repeat-distance", node);
}
else
{
set_property_from_xml<value_double>(expressions.minimum_distance, "minimum-distance", node);
}
set_property_from_xml<label_placement_e>(expressions.label_placement, "placement", node);
set_property_from_xml<value_double>(expressions.label_spacing, "spacing", node);
set_property_from_xml<value_double>(expressions.label_position_tolerance, "label-position-tolerance", node);
set_property_from_xml<value_double>(expressions.minimum_padding, "minimum-padding", node);
set_property_from_xml<value_double>(expressions.minimum_path_length, "minimum-path-length", node);
set_property_from_xml<boolean_type>(expressions.avoid_edges, "avoid-edges", node);
set_property_from_xml<boolean_type>(expressions.allow_overlap, "allow-overlap", node);
set_property_from_xml<boolean_type>(expressions.largest_bbox_only, "largest-bbox-only", node);
set_property_from_xml<value_double>(expressions.max_char_angle_delta, "max-char-angle-delta", node);
set_property_from_xml<text_upright_e>(expressions.upright, "upright", node);
}
示例2: set_symbolizer_property
void set_symbolizer_property(Symbolizer & sym, keys key, xml_node const& node)
{
std::string const& name = std::get<0>(get_meta(key));
if (node.has_attribute(name)) {
detail::set_symbolizer_property_impl<Symbolizer,T, std::is_enum<T>::value>::apply(sym,key,name,node);
}
}
示例3: from_xml
node_ptr layout_node::from_xml(xml_node const& xml, fontset_map const& fontsets)
{
auto n = std::make_shared<layout_node>();
node_ptr child = node::from_xml(xml, fontsets);
n->set_child(child);
if (xml.has_attribute("dx")) set_property_from_xml<double>(n->dx, "dx", xml);
if (xml.has_attribute("dy")) set_property_from_xml<double>(n->dy, "dy", xml);
if (xml.has_attribute("text-ratio")) set_property_from_xml<double>(n->text_ratio, "text-ratio", xml);
if (xml.has_attribute("wrap-width")) set_property_from_xml<double>(n->wrap_width, "wrap-width", xml);
if (xml.has_attribute("wrap-character")) set_property_from_xml<std::string>(n->wrap_char, "wrap-character", xml);
if (xml.has_attribute("wrap-before")) set_property_from_xml<mapnik::value_bool>(n->wrap_before, "wrap-before", xml);
if (xml.has_attribute("repeat-wrap-character")) set_property_from_xml<mapnik::value_bool>(n->repeat_wrap_char, "repeat-wrap-character", xml);
if (xml.has_attribute("rotate-displacement")) set_property_from_xml<mapnik::value_bool>(n->rotate_displacement, "rotate-displacement", xml);
if (xml.has_attribute("orientation")) set_property_from_xml<double>(n->orientation, "orientation", xml);
if (xml.has_attribute("horizontal-alignment")) set_property_from_xml<horizontal_alignment_e>(n->halign, "horizontal-alignment", xml);
if (xml.has_attribute("vertical-alignment")) set_property_from_xml<vertical_alignment_e>(n->valign, "vertical-alignment", xml);
if (xml.has_attribute("justify-alignment")) set_property_from_xml<justify_alignment_e>(n->jalign, "justify-alignment", xml);
return n;
}