本文整理汇总了C++中pugi::xml_node::select_single_node方法的典型用法代码示例。如果您正苦于以下问题:C++ xml_node::select_single_node方法的具体用法?C++ xml_node::select_single_node怎么用?C++ xml_node::select_single_node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pugi::xml_node
的用法示例。
在下文中一共展示了xml_node::select_single_node方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseFont
void FontExportSerializer::parseFont(pugi::xml_node _node)
{
DataPtr data = Data::CreateInstance();
data->setType(DataTypeManager::getInstance().getType("Font"));
data->setPropertyValue("Name", _node.attribute("name").value());
std::string value = _node.select_single_node("Property[@key=\"Source\"]/@value").attribute().value();
data->setPropertyValue("Source", value);
value = _node.select_single_node("Property[@key=\"Size\"]/@value").attribute().value();
data->setPropertyValue("Size", MyGUI::utility::parseValue<float>(value));
value = _node.select_single_node("Property[@key=\"Hinting\"]/@value").attribute().value();
if (value.empty())
value = "use_native";
data->setPropertyValue("Hinting", value);
value = _node.select_single_node("Property[@key=\"Resolution\"]/@value").attribute().value();
if (!value.empty())
data->setPropertyValue("Resolution", MyGUI::utility::parseValue<int>(value));
value = _node.select_single_node("Property[@key=\"Antialias\"]/@value").attribute().value();
if (!value.empty())
data->setPropertyValue("Antialias", MyGUI::utility::parseValue<bool>(value));
value = _node.select_single_node("Property[@key=\"TabWidth\"]/@value").attribute().value();
if (!value.empty())
data->setPropertyValue("TabWidth", MyGUI::utility::parseValue<float>(value));
value = _node.select_single_node("Property[@key=\"OffsetHeight\"]/@value").attribute().value();
if (!value.empty())
data->setPropertyValue("OffsetHeight", MyGUI::utility::parseValue<int>(value));
value = _node.select_single_node("Property[@key=\"SubstituteCode\"]/@value").attribute().value();
if (!value.empty())
data->setPropertyValue("SubstituteCode", MyGUI::utility::parseValue<int>(value));
value = _node.select_single_node("Property[@key=\"Distance\"]/@value").attribute().value();
if (!value.empty())
data->setPropertyValue("Distance", MyGUI::utility::parseValue<int>(value));
value = "";
pugi::xpath_node_set codes = _node.select_nodes("Codes/Code/@range");
for (pugi::xpath_node_set::const_iterator code = codes.begin(); code != codes.end(); code ++)
{
if (!value.empty())
value += "|";
std::vector<std::string> values = MyGUI::utility::split((*code).attribute().value());
if (values.size() == 1)
value += MyGUI::utility::toString(values[0], " ", values[0]);
else if (values.size() == 2)
value += MyGUI::utility::toString(values[0], " ", values[1]);
}
data->setPropertyValue("FontCodeRanges", value);
DataManager::getInstance().getRoot()->addChild(data);
}
示例2: parse_first_path
std::string base_parser::parse_first_path(
const pugi::xml_node &node,
const char *xpath,
const char *att)
{
pugi::xpath_node res = node.select_single_node(xpath);
return res.node().attribute(att).value();
}
示例3: deserialization
void DataTypeProperty::deserialization(pugi::xml_node _node)
{
mName = _node.select_single_node("Name").node().child_value();
mType = _node.select_single_node("Type").node().child_value();
mDefaultValue = _node.select_single_node("Default").node().child_value();
mInitialisator = _node.select_single_node("Initialisator").node().child_value();
mReadOnly = MyGUI::utility::parseValue<bool>(_node.select_single_node("ReadOnly").node().child_value());
mVisible = MyGUI::utility::parseValue<bool>(_node.select_single_node("Visible").node().child_value());
mAction = _node.select_single_node("Action").node().child_value();
}
示例4: deserialization
void DataInfo::deserialization(pugi::xml_node _node)
{
mType = _node.select_single_node("Type").node().child_value();
pugi::xpath_node_set childs = _node.select_nodes("Childs/Child/Type");
for (pugi::xpath_node_set::const_iterator child = childs.begin(); child != childs.end(); child ++)
mChilds.push_back((*child).node().child_value());
pugi::xpath_node_set properties = _node.select_nodes("Properties/Property");
for (pugi::xpath_node_set::const_iterator property = properties.begin(); property != properties.end(); property ++)
{
DataPropertyInfo* info = new DataPropertyInfo();
info->deserialization((*property).node());
mProperties.push_back(info);
}
}
示例5: parse_post_node
/* Return a subnode div which contains the rest of the post,
* 4chan devs seem to call this postContainter. */
pugi::xml_node fourchan_parser::parse_post_node(const pugi::xml_node &node)
{
return node.select_single_node(
"(div[@class='post op'] | div[@class='post reply'])").node();
}
示例6: fillRegionData
void SkinExportSerializer::fillRegionData(DataPtr _data, pugi::xml_node _node)
{
pugi::xpath_node_set regions = _node.select_nodes("BasisSkin[@type=\"SubSkin\"[email protected]=\"TileRect\"]");
for (pugi::xpath_node_set::const_iterator region = regions.begin(); region != regions.end(); region ++)
{
DataPtr regionData = NULL;
MyGUI::Align align = MyGUI::Align::parse((*region).node().attribute("align").value());
if (align.isLeft() && align.isTop())
regionData = getChildData(_data, "Region", "Left Top");
else if (align.isLeft() && align.isVStretch())
regionData = getChildData(_data, "Region", "Left");
else if (align.isLeft() && align.isBottom())
regionData = getChildData(_data, "Region", "Left Bottom");
else if (align.isHStretch() && align.isTop())
regionData = getChildData(_data, "Region", "Top");
else if (align.isHStretch() && align.isVStretch())
regionData = getChildData(_data, "Region", "Center");
else if (align.isHStretch() && align.isBottom())
regionData = getChildData(_data, "Region", "Bottom");
else if (align.isRight() && align.isTop())
regionData = getChildData(_data, "Region", "Right Top");
else if (align.isRight() && align.isVStretch())
regionData = getChildData(_data, "Region", "Right");
else if (align.isRight() && align.isBottom())
regionData = getChildData(_data, "Region", "Right Bottom");
if (regionData == nullptr)
continue;
regionData->setPropertyValue("Visible", "True");
std::string type = (*region).node().attribute("type").value();
if (type == "TileRect")
{
bool vert = MyGUI::utility::parseValue<bool>((*region).node().select_single_node("State/Property[@key=\"TileV\"]/@value").attribute().value());
bool horz = MyGUI::utility::parseValue<bool>((*region).node().select_single_node("State/Property[@key=\"TileH\"]/@value").attribute().value());
if (vert && !horz)
type = "TileRect Vert";
else if (!vert && horz)
type = "TileRect Horz";
}
regionData->setPropertyValue("Type", type);
}
pugi::xpath_node regionText = _node.select_single_node("BasisSkin[@type=\"SimpleText\"[email protected]=\"EditText\"]");
if (!regionText.node().empty())
{
DataPtr regionData = getChildData(_data, "RegionText", "Text");
if (regionData != nullptr)
{
regionData->setPropertyValue("Visible", "True");
std::string type = regionText.node().attribute("type").value();
regionData->setPropertyValue("Type", type);
MyGUI::IntCoord offset = MyGUI::IntCoord::parse(regionText.node().attribute("offset").value());
regionData->setPropertyValue("Coord", offset);
MyGUI::Align align = MyGUI::Align::parse(regionText.node().attribute("align").value());
regionData->setPropertyValue("Align", align);
}
}
}