本文整理汇总了C++中XMLFile::IsAircraftFile方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLFile::IsAircraftFile方法的具体用法?C++ XMLFile::IsAircraftFile怎么用?C++ XMLFile::IsAircraftFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLFile
的用法示例。
在下文中一共展示了XMLFile::IsAircraftFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: options
//.........这里部分代码省略.........
if (n != string::npos) {
ScriptName = SGPath::fromLocal8Bit(value.c_str());
} else {
gripe;
exit(1);
}
} else if (keyword == "--initfile") {
if (n != string::npos) {
ResetName = SGPath::fromLocal8Bit(value.c_str());
} else {
gripe;
exit(1);
}
} else if (keyword == "--property") {
if (n != string::npos) {
string propName = value.substr(0,value.find("="));
string propValueString = value.substr(value.find("=")+1);
double propValue = atof(propValueString.c_str());
CommandLineProperties.push_back(propName);
CommandLinePropertyValues.push_back(propValue);
} else {
gripe;
exit(1);
}
} else if (keyword.substr(0,5) == "--end") {
if (n != string::npos) {
try {
end_time = atof( value.c_str() );
} catch (...) {
cerr << endl << " Invalid end time given!" << endl << endl;
result = false;
}
} else {
gripe;
exit(1);
}
} else if (keyword == "--simulation-rate") {
if (n != string::npos) {
try {
simulation_rate = atof( value.c_str() );
override_sim_rate = true;
} catch (...) {
cerr << endl << " Invalid simulation rate given!" << endl << endl;
result = false;
}
} else {
gripe;
exit(1);
}
} else if (keyword == "--catalog") {
catalog = true;
if (value.size() > 0) AircraftName=value;
} else if (keyword.substr(0,2) != "--" && value.empty() ) {
// See what kind of files we are specifying on the command line
XMLFile xmlFile;
SGPath path = SGPath::fromLocal8Bit(keyword.c_str());
if (xmlFile.IsScriptFile(path)) ScriptName = path;
else if (xmlFile.IsLogDirectiveFile(path)) LogDirectiveName.push_back(path);
else if (xmlFile.IsAircraftFile(SGPath("aircraft")/keyword/keyword)) AircraftName = keyword;
else if (xmlFile.IsInitFile(path)) ResetName = path;
else if (xmlFile.IsInitFile(SGPath("aircraft")/AircraftName/keyword)) ResetName = SGPath("aircraft")/AircraftName/keyword;
else {
cerr << "The argument \"" << keyword << "\" cannot be interpreted as a file name or option." << endl;
exit(1);
}
}
else //Unknown keyword so print the help file, the bad keyword and abort
{
PrintHelp();
cerr << "The argument \"" << keyword << "\" cannot be interpreted as a file name or option." << endl;
exit(1);
}
}
// Post-processing for script options. check for incompatible options.
if (catalog && !ScriptName.isNull()) {
cerr << "Cannot specify catalog with script option" << endl << endl;
result = false;
}
if (!AircraftName.empty() && ResetName.isNull() && !catalog) {
cerr << "You must specify an initialization file with the aircraft name." << endl << endl;
result = false;
}
if (!ScriptName.isNull() && !AircraftName.empty()) {
cerr << "You cannot specify an aircraft file with a script." << endl;
result = false;
}
return result;
}