本文整理汇总了C++中pugi::xml_node::type方法的典型用法代码示例。如果您正苦于以下问题:C++ xml_node::type方法的具体用法?C++ xml_node::type怎么用?C++ xml_node::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pugi::xml_node
的用法示例。
在下文中一共展示了xml_node::type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: for_each
virtual bool for_each(pugi::xml_node& node) {
Log::log(logModule, level, "XML node type = [%s], name = [%s], value = [%s]",
node_types[node.type()], node.name(),
node.type() == pugi::node_cdata || node.type() == pugi::node_pcdata ? node.text().get() : node.value());
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ait != node.attributes_end(); ++ait) {
Log::log(logModule, level, " attribute name = [%s], value = [%s]",
ait->name(), ait->value());
}
return true;
}
示例2: read_xml_node
void read_xml_node( pugi::xml_node node, Ptree &pt, int flags)
{
typedef typename Ptree::key_type::value_type Ch;
switch ( node.type() )
{
case pugi::node_element:
{
Ptree &tmp = pt.push_back(std::make_pair( node.name(), Ptree()))->second;
for ( pugi::xml_attribute attr = node.first_attribute(); attr; attr = attr.next_attribute() )
tmp.put( xmlattr<Ch>() + "." + attr.name(), attr.value());
for ( pugi::xml_node child = node.first_child(); child; child = child.next_sibling())
read_xml_node(child, tmp, flags);
}
break;
case pugi::node_pcdata:
{
if (flags & no_concat_text)
pt.push_back(std::make_pair(xmltext<Ch>(), Ptree( node.value() )));
else
pt.data() += node.value();
}
break;
case pugi::node_comment:
{
if (!(flags & no_comments))
pt.push_back(std::make_pair(xmlcomment<Ch>(), Ptree( node.value() )));
}
break;
default:
// skip other types
break;
}
}
示例3: for_each
virtual bool for_each(pugi::xml_node &node) {
for (int i = 0; i < depth(); ++i) std::cout << " "; // indentation
std::cout << node_types[node.type()] << ": name='" << node.name() << "', value='" << node.value() << "'\n";
return true; // continue traversal
}
示例4: CombineText
bool XMLFile::CombineText(const pugi::xml_node& patch, const pugi::xml_node& original, bool prepend) const
{
if (!patch || !original)
return false;
if ((patch.type() == pugi::node_pcdata && original.type() == pugi::node_pcdata) ||
(patch.type() == pugi::node_cdata && original.type() == pugi::node_cdata))
{
if (prepend)
const_cast<pugi::xml_node&>(original).set_value(Urho3D::ToString("%s%s", patch.value(), original.value()).CString());
else
const_cast<pugi::xml_node&>(original).set_value(Urho3D::ToString("%s%s", original.value(), patch.value()).CString());
return true;
}
return false;
}
示例5: toString_priv
tiny_string XMLNode::toString_priv(pugi::xml_node outputNode)
{
if(outputNode.type() == pugi::node_null)
return "";
ostringstream buf;
outputNode.print(buf);
tiny_string ret = tiny_string(buf.str());
return ret;
}