本文整理汇总了C++中xml::gcXMLElement::GetAtt方法的典型用法代码示例。如果您正苦于以下问题:C++ gcXMLElement::GetAtt方法的具体用法?C++ gcXMLElement::GetAtt怎么用?C++ gcXMLElement::GetAtt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml::gcXMLElement
的用法示例。
在下文中一共展示了gcXMLElement::GetAtt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadSprites
void Theme::LoadSprites(const XML::gcXMLElement &xmlEl)
{
xmlEl.for_each_child("sprite", [this](const XML::gcXMLElement &xmlChild)
{
const std::string name = xmlChild.GetAtt("name");
if (name.empty())
return;
auto sprite = SpriteList::findItem(name.c_str());
if (!sprite)
{
sprite = gcRefPtr<ThemeSpriteInfo>::create(name.c_str());
addItem(sprite);
}
xmlChild.for_each_child("rect", [sprite](const XML::gcXMLElement &xmlRect)
{
const std::string rName = xmlRect.GetAtt("name");
const XML::gcXMLElement pos = xmlRect.FirstChildElement("pos");
const XML::gcXMLElement size = xmlRect.FirstChildElement("size");
if (rName.empty() || !pos.IsValid() || !size.IsValid())
return;
const std::string x = pos.GetAtt("x");
const std::string y = pos.GetAtt("y");
const std::string w = size.GetAtt("w");
const std::string h = size.GetAtt("h");
if (x.empty() || y.empty() || w.empty() || h.empty())
return;
auto rect = sprite->findItem(rName.c_str());
if (!rect)
{
rect = gcRefPtr<SpriteRect>::create(rName.c_str());
sprite->addItem(rect);
}
rect->x = Safe::atoi(x.c_str());
rect->y = Safe::atoi(y.c_str());
rect->w = Safe::atoi(w.c_str());
rect->h = Safe::atoi(h.c_str());
});
});
}
示例2: processInstallScript
void BranchInfo::processInstallScript(const XML::gcXMLElement &xmlElement)
{
uint32 crc = 0;
xmlElement.GetAtt("crc", crc);
if (UTIL::FS::isValidFile(m_szInstallScript))
{
if (crc != 0 && m_uiInstallScriptCRC == (uint32)crc)
return;
}
else
{
m_szInstallScript = UTIL::OS::getAppDataPath(gcWString(L"{0}\\{1}\\install_script.js", m_ItemId.getFolderPathExtension(), getBranchId()).c_str());
}
gcString base64 = xmlElement.GetText();
try
{
UTIL::FS::recMakeFolder(UTIL::FS::Path(m_szInstallScript, "", true));
UTIL::FS::FileHandle fh(m_szInstallScript.c_str(), UTIL::FS::FILE_WRITE);
UTIL::STRING::base64_decode(base64, [&fh](const unsigned char* data, uint32 size) -> bool
{
fh.write((const char*)data, size);
return true;
});
m_uiInstallScriptCRC = crc;
}
catch (gcException &e)
{
Warning("Failed to save install script for {0} branch {1}: {2}\n", m_ItemId.toInt64(), m_uiBranchId, e);
m_szInstallScript = "";
}
}
示例3: platformFilter
bool User::platformFilter(const XML::gcXMLElement &platform, PlatformType type)
{
if (!platform.IsValid())
return true;
uint32 id = 0;
platform.GetAtt("id", id);
if (id == 0)
return true;
#ifdef WIN32
return (id != 100);
#elif defined NIX
if (type == PT_Tool)
return (id != 110 && id != 120);
#ifdef NIX64
if (id == 120)
return false;
#endif
//linux will have windows and nix
return (id != 110); //id != 100 &&
#else
return true;
#endif
}