本文整理汇总了C++中xml::gcXMLElement::FirstChildElement方法的典型用法代码示例。如果您正苦于以下问题:C++ gcXMLElement::FirstChildElement方法的具体用法?C++ gcXMLElement::FirstChildElement怎么用?C++ gcXMLElement::FirstChildElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml::gcXMLElement
的用法示例。
在下文中一共展示了gcXMLElement::FirstChildElement方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseItemsQuick
void InstalledWizardThread::parseItemsQuick(const XML::gcXMLElement &fNode)
{
if (!fNode.IsValid())
return;
auto platforms = fNode.FirstChildElement("platforms");
if (platforms.IsValid())
{
platforms.for_each_child("platform", [&](const XML::gcXMLElement &platform)
{
if (isStopped())
return;
if (getUserCore()->platformFilter(platform, PlatformType::Item))
return;
parseItemsQuick(platform);
});
}
else
{
fNode.FirstChildElement("games").for_each_child("game", [&](const XML::gcXMLElement &game)
{
if (isStopped())
return;
const std::string id = game.GetAtt("siteareaid");
DesuraId gameId(id.c_str(), "games");
if (gameId.isOk())
parseGameQuick(game);
});
}
}
示例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: gameId
void InstalledWizardThread::parseItems1(const XML::gcXMLElement &fNode, gcRefPtr<WildcardManager> &pWildCard, std::map<uint64, XML::gcXMLElement> *vMap)
{
gcAssert(pWildCard);
if (!fNode.IsValid())
return;
fNode.FirstChildElement("games").for_each_child("game", [&](const XML::gcXMLElement &game)
{
if (isStopped())
return;
const std::string szId = game.GetAtt("siteareaid");
DesuraId gameId(szId.c_str(), "games");
if (!gameId.isOk())
return;
XML::gcXMLElement info;
if (vMap)
info = (*vMap)[gameId.toInt64()];
parseGame(gameId, game, pWildCard, info);
});
}
示例4: parseGameQuick
void InstalledWizardThread::parseGameQuick(const XML::gcXMLElement &game)
{
if (!game.IsValid())
return;
m_uiTotal++;
game.FirstChildElement("mods").for_each_child("mod", [&](const XML::gcXMLElement &)
{
m_uiTotal++;
});
}
示例5: parseXml
void ToolManager::parseXml(const XML::gcXMLElement &toolinfoNode)
{
if (!toolinfoNode.IsValid())
return;
auto toolsNode = toolinfoNode.FirstChildElement("tools");
if (!toolsNode.IsValid())
return;
WildcardManager wcm;
wcm.onNeedInstallSpecialEvent += delegate(this, &ToolManager::onSpecialCheck);
wcm.onNeedSpecialEvent += delegate(m_pUser->getNeedWildCardEvent());
auto wildcardNode = toolinfoNode.FirstChildElement("wcards");
if (wildcardNode.IsValid())
wcm.parseXML(wildcardNode);
//clear the java path value
WildcardInfo* temp = wcm.findItem("JAVA_EXE");
if (temp)
{
temp->m_szPath = "";
temp->m_bResolved = true;
}
bool is64OS = UTIL::OS::is64OS();
toolsNode.for_each_child("tool", [this, is64OS, &wcm](const XML::gcXMLElement &toolEl)
{
bool isTool64 = false;
toolEl.GetChild("bit64", isTool64);
if (isTool64 && !is64OS)
return;
const std::string id = toolEl.GetAtt("siteareaid");
if (id.empty())
return;
DesuraId tid(id.c_str(), "tools");
ToolInfo* tool = this->findItem(tid.toInt64());
bool bAdd = false;
if (!tool)
{
tool = new ToolInfo(tid);
bAdd = true;
}
tool->parseXml(toolEl, &wcm, m_pUser->getAppDataPath());
if (bAdd)
this->addItem(tool);
});
postParseXml();
}
示例6: 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;
//.........这里部分代码省略.........
示例7: 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()]);
});
}
示例8: checkAppUpdate
void UpdateThreadOld::checkAppUpdate(const XML::gcXMLElement &uNode, std::function<void(uint32, uint32, bool)> &updateCallback)
{
auto processAppVersion = [&](const char* szNodeName, uint32 &appid, uint32 &mcfversion)
{
appid = 0;
mcfversion = 0;
auto appEl = uNode.FirstChildElement(szNodeName);
if (!appEl.IsValid())
return false;
auto id = appEl.GetAtt("id");
auto ver = appEl.GetText();
if (!id.empty())
appid = Safe::atoi(id.c_str());
if (!ver.empty())
mcfversion = Safe::atoi(ver.c_str());
return appid != 0 && mcfversion != 0;
};
auto isInternalApp = [](uint32 appid)
{
return appid >= 500 && appid < 600;
};
uint32 mcfversion = 0;
uint32 appid = 0;
bool bIsNewerVersion = false;
bool bIsForced = false;
bool bIsQa = false;
#ifdef DESURA_OFFICIAL_BUILD
if (m_bInternalTesting)
{
Msg("Checking internal testing for app update...\n");
if (!processAppVersion("apptesting", appid, mcfversion) || !isInternalApp(appid))
{
Warning("Failed to find qa testing build on update poll");
if (!processAppVersion("app", appid, mcfversion))
return;
}
else
{
Msg(gcString("Found qa app build {0}.{1}\n", appid, mcfversion));
if (m_bForceTestingUpdate)
{
Msg("Forcing testing update..\n");
bIsForced = true;
bIsNewerVersion = true;
}
m_bForceTestingUpdate = false;
bIsQa = true;
}
}
else if (!processAppVersion("app", appid, mcfversion))
{
return;
}
#else
if (!processAppVersion("app", appid, mcfversion))
{
return;
}
#endif
auto bNewerOriginalBranch = (m_uiLastAppId == 0) && (appid == m_iAppId) && (mcfversion > m_iAppVersion);
auto bNewerLastUpdateBranch = (appid == m_uiLastAppId) && (mcfversion > m_uiLastVersion);
auto bDiffBranch = (appid != m_iAppId) && (appid != m_uiLastAppId);
if (bNewerLastUpdateBranch || bNewerOriginalBranch || bDiffBranch)
bIsNewerVersion = true;
if (bIsNewerVersion)
{
#ifdef WIN32
if (bIsQa && mcfversion > 0)
{
//need to set appver back a build otherwise updater will ignore this build due to it being older than current
gcString strAppid("{0}", appid);
gcString strAppVer("{0}", mcfversion - 1);
m_pUser->getInternal()->getServiceMain()->updateRegKey(APPID, strAppid.c_str());
m_pUser->getInternal()->getServiceMain()->updateRegKey(APPBUILD, strAppVer.c_str());
}
#endif
updateCallback(appid, mcfversion, bIsForced);
m_uiLastAppId = appid;
m_uiLastVersion = mcfversion;
//.........这里部分代码省略.........