本文整理汇总了C++中Platform::setRelease方法的典型用法代码示例。如果您正苦于以下问题:C++ Platform::setRelease方法的具体用法?C++ Platform::setRelease怎么用?C++ Platform::setRelease使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Platform
的用法示例。
在下文中一共展示了Platform::setRelease方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parsXml
//.........这里部分代码省略.........
}
/* retrieving dependencies*/
if(root->FirstChild("dependencies"))
for(TiXmlElement* restag = root->FirstChild("dependencies")->FirstChildElement();
restag; restag = restag->NextSiblingElement())
{
Computer computer;
if(compareString(restag->Value(), "computer"))
{
Computer computer;
computer.setXmlFile(szFile);
for(TiXmlElement* comptag = restag->FirstChildElement();
comptag; comptag = comptag->NextSiblingElement())
{
/* retrieving name */
if(compareString(comptag->Value(), "name"))
computer.setName(parser->parseText(comptag->GetText()).c_str());
/* retrieving description */
if(compareString(comptag->Value(), "description"))
computer.setDescription(parser->parseText(comptag->GetText()).c_str());
// platform
if(compareString(comptag->Value(), "platform"))
{
Platform os;
TiXmlElement* element;
if((element = (TiXmlElement*) comptag->FirstChild("name")))
os.setName(parser->parseText(element->GetText()).c_str());
if((element = (TiXmlElement*) comptag->FirstChild("distribution")))
os.setDistribution(parser->parseText(element->GetText()).c_str());
if((element = (TiXmlElement*) comptag->FirstChild("release")))
os.setRelease(parser->parseText(element->GetText()).c_str());
computer.setPlatform(os);
} // end of platform tag
/*
//multiplatform
if(compareString(comptag->Value(), "multiplatform"))
{
MultiPlatform mltPlatform;
for(TiXmlElement* mptag = comptag->FirstChild("multiplatform")->FirstChildElement();
mptag; mptag = mptag->NextSiblingElement())
{
// platform
if(compareString(mptag->Value(), "platform"))
{
Platform os;
TiXmlElement* element;
if((element = (TiXmlElement*) mptag->FirstChild("name")))
os.setName(element->GetText());
if((element = (TiXmlElement*) mptag->FirstChild("distribution")))
os.setDistribution(element->GetText());
if((element = (TiXmlElement*) mptag->FirstChild("release")))
os.setDistribution(element->GetText());
mltPlatform.addPlatform(os);
}
}
module.addResource(mltPlatform);
}
// end of multiplatform tag
*/
// memory
if(compareString(comptag->Value(), "memory"))
{
示例2: parsXml
bool XmlResLoader::parsXml(const char* szFile)
{
computers.clear();
ErrorLogger* logger = ErrorLogger::Instance();
TiXmlDocument doc(szFile);
if(!doc.LoadFile())
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" at line "\
<<doc.ErrorRow()<<": ";
err<<doc.ErrorDesc();
logger->addError(err);
return false;
}
/* retrieving root module */
TiXmlElement *root = doc.RootElement();
if(!root)
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" . ";
err<<"No root element.";
logger->addError(err);
return false;
}
if(!compareString(root->Value(), "resources"))
{
/*
OSTRINGSTREAM msg;
msg<<szFile<<" is not a resource descriptor file.";
logger->addWarning(msg);
*/
return false;
}
/* retrieving all computers descriptions */
for(TiXmlElement* restag = root->FirstChildElement();
restag; restag = restag->NextSiblingElement())
{
/* retrieving a computer resource */
if(compareString(restag->Value(), "computer"))
{
Computer computer;
computer.setXmlFile(szFile);
for(TiXmlElement* comptag = restag->FirstChildElement();
comptag; comptag = comptag->NextSiblingElement())
{
/* retrieving name */
if(compareString(comptag->Value(), "name"))
computer.setName(comptag->GetText());
/* retrieving description */
if(compareString(comptag->Value(), "description"))
computer.setDescription(comptag->GetText());
/* retrieving disablility */
if(compareString(comptag->Value(), "disable"))
{
if(compareString(comptag->GetText(), "yes"))
computer.setDisable(true);
}
// platform
if(compareString(comptag->Value(), "platform"))
{
Platform os;
TiXmlElement* element;
if((element = (TiXmlElement*) comptag->FirstChild("name")))
os.setName(element->GetText());
else
{
OSTRINGSTREAM war;
war<<"Platform from "<<szFile<<" at line "\
<<comptag->Row()<<" has no name.";
logger->addWarning(war);
}
if((element = (TiXmlElement*) comptag->FirstChild("distribution")))
os.setDistribution(element->GetText());
if((element = (TiXmlElement*) comptag->FirstChild("release")))
os.setRelease(element->GetText());
computer.setPlatform(os);
} // end of platform tag
// memory
if(compareString(comptag->Value(), "memory"))
{
Memory mem;
TiXmlElement* element;
if((element = (TiXmlElement*) comptag->FirstChild("total_space")))
mem.setTotalSpace((Capacity)atol(element->GetText()));
computer.setMemory(mem);
} // end of memory tag
// storage
//.........这里部分代码省略.........