本文整理汇总了C++中Dispatcher::load_attribute方法的典型用法代码示例。如果您正苦于以下问题:C++ Dispatcher::load_attribute方法的具体用法?C++ Dispatcher::load_attribute怎么用?C++ Dispatcher::load_attribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::load_attribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
static bool load(XMLAttributesIterator xml_attributes_iterator, Dispatcher & dispatcher)
{
typedef typename boost::parameter::value_type<args, tag::xml_attribute_policy,
policy::xml::attribute_iterator<XMLAttributesIterator> >::type xml_policy;
typedef typename boost::parameter::value_type<args, tag::error_policy,
policy::error::default_policy<typename Dispatcher::context_type> >::type error_policy;
detail::required_attributes_check<RequiredAttributes> required_check;
for(; !xml_policy::is_end(xml_attributes_iterator);
xml_policy::advance(xml_attributes_iterator))
{
BOOST_SCOPED_ENUM(detail::namespace_id) ns = xml_policy::get_namespace(xml_attributes_iterator);
if (ns == detail::namespace_id::other)
continue;
typename xml_policy::attribute_name_type attribute_name = xml_policy::get_local_name(xml_attributes_iterator);
detail::attribute_id id = detail::attribute_name_to_id(ns, xml_policy::get_string_range(attribute_name));
switch (id)
{
case detail::unknown_attribute_id:
if (!error_policy::unknown_attribute(dispatcher.context(),
xml_policy::get_attribute(xml_attributes_iterator),
xml_policy::get_string_range(attribute_name), ns, tag::source::attribute()))
return false;
break;
case detail::attribute_id_style:
{
if (ParseStyleAttribute)
{
if (!load_style<xml_policy, error_policy>(xml_attributes_iterator, dispatcher))
return false;
break;
}
}
default:
{
typename xml_policy::attribute_value_type value = xml_policy::get_value(xml_attributes_iterator);
if (!dispatcher.load_attribute(id, xml_policy::get_string_range(value), tag::source::attribute()))
return false;
required_check(id);
}
}
}
detail::missing_attribute_visitor<error_policy> visitor(dispatcher.context());
return required_check.visit_missing(visitor);
}
示例2: load_style
static bool load_style(XMLAttributesIterator const & xml_attributes_iterator, Dispatcher & dispatcher,
typename boost::enable_if_c<ParseStyleAttribute && (true || boost::is_void<XMLAttributesIterator>::value)>::type * = NULL)
{
typename XMLPolicy::attribute_value_type style_value = XMLPolicy::get_value(xml_attributes_iterator);
typename XMLPolicy::string_type style_string = XMLPolicy::get_string_range(style_value);
typedef css_style_iterator<typename boost::range_iterator<typename XMLPolicy::string_type>::type> css_iterator;
for(css_iterator it(boost::begin(style_string), boost::end(style_string)); !it.eof(); ++it)
{
detail::attribute_id style_id = css_name_to_id_policy::find(it->first);
if (style_id == detail::unknown_attribute_id)
{
if (!ErrorPolicy::unknown_attribute(dispatcher.context(),
XMLPolicy::get_attribute(xml_attributes_iterator), it->first, tag::source::css()))
return false;
}
else
if (!dispatcher.load_attribute(style_id, it->second, tag::source::css()))
return false;
}
return true;
}