本文整理汇总了C++中pugi::xml_node::first_attribute方法的典型用法代码示例。如果您正苦于以下问题:C++ xml_node::first_attribute方法的具体用法?C++ xml_node::first_attribute怎么用?C++ xml_node::first_attribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pugi::xml_node
的用法示例。
在下文中一共展示了xml_node::first_attribute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _checkSetAttributes
void XmlWalker::_checkSetAttributes(pugi::xml_node node)
{
pugi::xml_attribute attr = node.first_attribute();
while (attr)
{
if (!strcmp(attr.name(), "path"))
{
_path = connectPath(_xmlFolder->c_str(), attr.value());
if (!_path.empty())
_path += "/";
}
else if (!strcmp(attr.name(), "load"))
{
_load = attr.as_bool();
}
else if (!strcmp(attr.name(), "scale_factor"))
{
_scaleFactor = attr.as_float(1.0f);
}
else if (!strcmp(attr.name(), "hit_test"))
{
_alphaHitTest = attr.as_bool(false);
}
attr = attr.next_attribute();
}
}
示例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: InitFromXml
BOOL SObject::InitFromXml( pugi::xml_node xmlNode )
{
if(!xmlNode) return FALSE;
#ifdef _DEBUG
{
pugi::xml_writer_buff writer;
xmlNode.print(writer,L"\t",pugi::format_default,pugi::encoding_utf16);
m_strXml=SStringW(writer.buffer(),writer.size());
}
#endif
//设置当前对象的属性
//优先处理"class"属性
pugi::xml_attribute attrClass=xmlNode.attribute(L"class");
if(attrClass)
{
attrClass.set_userdata(1); //预处理过的属性,给属性增加一个userdata
SetAttribute(attrClass.name(), attrClass.value(), TRUE);
}
for (pugi::xml_attribute attr = xmlNode.first_attribute(); attr; attr = attr.next_attribute())
{
if(attr.get_userdata()) continue; //忽略已经被预处理的属性
SetAttribute(attr.name(), attr.value(), TRUE);
}
if(attrClass)
{
attrClass.set_userdata(0);
}
//调用初始化完成接口
OnInitFinished(xmlNode);
return TRUE;
}
示例4: print_entry
void RainbowTable::print_entry(pugi::xml_node &entry) {
//prints all data associated with node entry
cout << endl;//redability
//print attributes of entry node
for (pugi::xml_attribute attr = entry.first_attribute();
attr;
attr = attr.next_attribute()) {
if (strcmp("key" , attr.name()) != 0 ) { //ignore key
cout << attr.name() << ": " << attr.value() << endl;
}
}
//search through child nodes
for (pugi::xml_node child = entry.first_child();
child;
child = child.next_sibling()) {
cout << child.name() << endl;
//is there text outside of the attrubutes?
if (child.text()) {
cout << '\t' << child.first_child().value() << endl;
}
//print attributes of child
for (pugi::xml_attribute attr = child.first_attribute();
attr;
attr = attr.next_attribute()) {
cout << '\t' << attr.name() << ": " << attr.value() << endl;
}
}
}
示例5: while
DivNode::DivNode(const pugi::xml_node& node)
{
pugi::xml_attribute attr = node.first_attribute();
while (attr)
{
if (!strcmp(attr.name(), "c") ||
!strcmp(attr.name(), "color"))
{
color = hex2color(attr.value());
}
attr = attr.next_attribute();
}
}
示例6: parsePlace
void Walker::parsePlace(pugi::xml_node node, std::string parent, bool verbose) {
map<string, string> params;
params["parent"] = parent;
params["type"] = "";
params["reset"] = "true";
params["coincidence"] = "true";
params["fifo"] = "2";
params["init"] = "false";
for (pugi::xml_attribute attr = node.first_attribute(); attr;
attr = attr.next_attribute()) {
params[attr.name()] = attr.value();
}
TreeCorrelator::get()->createPlace(params, verbose);
}