本文整理汇总了C++中xml::gcXMLElement::GetChild方法的典型用法代码示例。如果您正苦于以下问题:C++ gcXMLElement::GetChild方法的具体用法?C++ gcXMLElement::GetChild怎么用?C++ gcXMLElement::GetChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml::gcXMLElement
的用法示例。
在下文中一共展示了gcXMLElement::GetChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseMod
void InstalledWizardThread::parseMod(DesuraId parId, DesuraId id, const XML::gcXMLElement &mod, gcRefPtr<WildcardManager> &pWildCard, const XML::gcXMLElement &info)
{
gcString name = mod.GetChild("name");
if (name == "" && info.IsValid())
name = info.GetChild("name");
if (name == "")
return;
if (m_bTriggerNewEvent)
onNewItemEvent(name);
triggerProgress();
m_uiDone++;
UserCore::Misc::InstallInfo temp(id, parId);
try
{
temp.loadXmlData(mod, pWildCard);
if (m_bTriggerNewEvent)
onModFound(temp);
}
catch (gcException &except)
{
Warning("ItemWizard: Error in xml parsing (installed wizard, mods): {0}\n", except);
}
}
示例2: loadXmlData
void InstallInfo::loadXmlData(const XML::gcXMLElement &xmlNode, WildcardManager* pWildCard)
{
WildcardManager lwc(pWildCard);
auto wcNode = xmlNode.FirstChildElement("wcards");
if (wcNode.IsValid())
{
lwc.parseXML(wcNode);
}
xmlNode.GetChild("name", m_szName);
auto icsNode = xmlNode.FirstChildElement("settings").FirstChildElement("installlocations");
if (!icsNode.IsValid())
return;
icsNode.for_each_child("installlocation", [&](const XML::gcXMLElement &xmlChild)
{
if (m_bInstalled)
return;
const std::string path = xmlChild.GetChild("path");
const std::string check = xmlChild.GetChild("check");
if (path.empty() || check.empty())
return;
char* CheckRes = nullptr;
char* PathRes = nullptr;
try
{
lwc.constructPath(check.c_str(), &CheckRes);
lwc.constructPath(path.c_str(), &PathRes);
if (CheckRes && PathRes && UTIL::FS::isValidFile(UTIL::FS::PathWithFile(CheckRes)))
{
m_szPath = PathRes;
m_bInstalled = true;
}
}
catch (gcException &e)
{
Debug(gcString("InstallInfo: Error parsing wildcards for installInfo: {0}\n", e));
}
safe_delete(CheckRes);
safe_delete(PathRes);
});
}
示例3: loadXmlData
void BranchInfo::loadXmlData(const XML::gcXMLElement &xmlNode)
{
xmlNode.GetChild("name", m_szName);
xmlNode.GetChild("price", m_szCost);
xmlNode.GetChild("eula", m_szEulaUrl);
auto eNode = xmlNode.FirstChildElement("eula");
if (eNode.IsValid())
{
const std::string date = eNode.GetAtt("date");
if (!date.empty() && m_szEulaDate != date)
{
m_uiFlags &= ~BF_ACCEPTED_EULA;
m_szEulaDate = date;
}
}
gcString preload;
xmlNode.GetChild("preload", preload);
if (m_szPreOrderDate.size() > 0 && (preload.size() == 0 || preload == "0"))
{
m_szPreOrderDate = "";
m_uiFlags &= ~BF_PREORDER;
onBranchInfoChangedEvent();
}
else if (preload != "0")
{
m_szPreOrderDate = preload;
m_uiFlags |= BF_PREORDER;
onBranchInfoChangedEvent();
}
bool nameon = false;
bool free = false;
bool onaccount = false;
bool regionlock = false;
bool memberlock = false;
bool demo = false;
bool test = false;
bool cdkey = false;
gcString cdkeyType;
xmlNode.GetChild("nameon", nameon);
xmlNode.GetChild("free", free);
xmlNode.GetChild("onaccount", onaccount);
xmlNode.GetChild("regionlock", regionlock);
xmlNode.GetChild("inviteonly", memberlock);
xmlNode.GetChild("demo", demo);
xmlNode.GetChild("test", test);
xmlNode.GetChild("cdkey", cdkey);
xmlNode.FirstChildElement("cdkey").GetAtt("type", cdkeyType);
uint32 global = -1;
xmlNode.GetChild("global", global);
if (global != -1)
m_uiGlobalId = MCFBranch::BranchFromInt(global, true);
if (nameon)
m_uiFlags |= BF_DISPLAY_NAME;
if (free)
m_uiFlags |= BF_FREE;
if (onaccount)
m_uiFlags |= BF_ONACCOUNT;
if (regionlock)
m_uiFlags |= BF_REGIONLOCK;
if (memberlock)
m_uiFlags |= BF_MEMBERLOCK;
if (demo)
m_uiFlags |= BF_DEMO;
if (test)
m_uiFlags |= BF_TEST;
if (cdkey)
m_uiFlags |= BF_CDKEY;
if (cdkeyType == "steam")
m_uiFlags |= BF_STEAMGAME;
//no mcf no release
auto mcfNode = xmlNode.FirstChildElement("mcf");
if (!mcfNode.IsValid())
{
m_uiFlags |= BF_NORELEASES;
}
else
{
m_uiFlags &= ~BF_NORELEASES;
//.........这里部分代码省略.........
示例4: parseGame
void InstalledWizardThread::parseGame(DesuraId id, const XML::gcXMLElement &game, gcRefPtr<WildcardManager> &pWildCard, const XML::gcXMLElement &info)
{
pWildCard->updateInstallWildcard("INSTALL_PATH", "INSTALL_PATH");
pWildCard->updateInstallWildcard("PARENT_INSTALL_PATH", "%INSTALL_PATH%");
gcString name = game.GetChild("name");
if (name == "" && info.IsValid())
name = info.GetChild("name");
if (name == "")
return;
if (m_bTriggerNewEvent)
onNewItemEvent(name);
triggerProgress();
m_uiDone++;
UserCore::Misc::InstallInfo temp(id);
try
{
if (info.IsValid())
temp.loadXmlData(info, pWildCard);
temp.loadXmlData(game, pWildCard);
}
catch (gcException &except)
{
Warning("ItemWizard: Error in xml parsing (installed wizard, games): {0}\n", except);
return;
}
if (m_bTriggerNewEvent)
onGameFound(temp);
else
m_vGameList.push_back(temp);
pWildCard->updateInstallWildcard("INSTALL_PATH", "INSTALL_PATH");
pWildCard->updateInstallWildcard("PARENT_INSTALL_PATH", temp.getPath());
std::map<uint64, XML::gcXMLElement> mModMap;
info.FirstChildElement("mods").for_each_child("mods", [&mModMap, this](const XML::gcXMLElement &mod)
{
if (isStopped())
return;
const std::string szId = mod.GetAtt("siteareaid");
DesuraId internId(szId.c_str(), "mods");
if (internId.isOk())
mModMap[internId.toInt64()] = mod;
});
game.FirstChildElement("mods").for_each_child("mods", [&](const XML::gcXMLElement &mod)
{
if (isStopped())
return;
const std::string szId = mod.GetAtt("siteareaid");
DesuraId internId(szId.c_str(), "mods");
if (internId.isOk())
parseMod(id, internId, mod, pWildCard, mModMap[internId.toInt64()]);
});
}