本文整理汇总了C++中XMLNode::Children方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLNode::Children方法的具体用法?C++ XMLNode::Children怎么用?C++ XMLNode::Children使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLNode
的用法示例。
在下文中一共展示了XMLNode::Children方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
std::map<std::string, Status*> Status::GetAllStatusses()
{
if (s_allStatusses.size() == 0)
{
IImageManager* imageManager = PlatformSpecific::GetImageManager();
//otherwise open status XML file
typedef vector<XMLNode*>::const_iterator SI;
vector<XMLNode*> statusNodes = BmeClient::GetPreferences()->GetIconPrefs()->GetStatusNodes();
for (SI s = statusNodes.begin(); s != statusNodes.end(); ++s)
{
XMLNode* statusNode = *s;
if (statusNode->Name() == "status")
{
vector<XMLNode*> children = statusNode->Children();
Status* status = new Status();
for (SI c = children.begin(); c != children.end(); ++c)
{
XMLNode* statusChild = *c;
if (statusChild->Name() == "icon")
{
std::string iconPath = statusChild->StringValue();
IPath* iconFullPath = PlatformSpecific::GetPathManager()->GetIconPrefsPath()->Append(iconPath);
Image* statusIcon = imageManager->GetImageFromFile(iconFullPath->ToString());
status->AddIcon(statusIcon);
delete iconFullPath;
}
else if (statusChild->Name() == "message")
{
status->SetStatusName(statusChild->StringValue());
}
else if (statusChild->Name() == "protocol")
{
status->SetAbbreviation(statusChild->StringValue());
}
else if (statusChild->Name() == "visible")
{
bool userChoice = atoi(statusChild->StringValue().c_str());
status->SetUserChoice(userChoice);
}
else if (statusChild->Name() == "color")
{
}
}
s_allStatusses[status->GetAbbreviation()] = (status);
}
}
delete imageManager;
}
return s_allStatusses;
}
示例2:
XMLNode*
resource_to_xmb_msg(const StringResource& res)
{
// the msg element
vector<XMLAttribute> attrs;
string name = res.pos.file;
name += ":";
name += res.TypedID();
attrs.push_back(XMLAttribute("", "name", name));
attrs.push_back(XMLAttribute("", "desc", strip_newlines(res.comment)));
attrs.push_back(XMLAttribute(XMLNS_XMLNS, "space", "preserve"));
XMLNode* msg = XMLNode::NewElement(res.pos, "", "msg", attrs, XMLNode::EXACT);
// the contents are in xliff/html, convert it to xliff
int err = 0;
XMLNode* value = res.value;
string tag = value->Name();
int phID = 0;
for (vector<XMLNode*>::const_iterator it=value->Children().begin();
it!=value->Children().end(); it++) {
err |= convert_html_to_xliff(*it, tag, msg, &phID);
}
if (err != 0) {
return NULL;
}
// and then convert that to xmb
for (vector<XMLNode*>::iterator it=msg->EditChildren().begin();
it!=msg->EditChildren().end(); it++) {
err |= convert_xliff_to_ph(*it, &phID);
}
if (err == 0) {
return msg;
} else {
return NULL;
}
}