本文整理汇总了C++中OptionList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionList::end方法的具体用法?C++ OptionList::end怎么用?C++ OptionList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionList
的用法示例。
在下文中一共展示了OptionList::end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doInvoke
//------------------------------------------------------------------------
void OptimiseTool::doInvoke(const OptionList& toolOptions,
const Ogre::StringVector& inFileNames, const Ogre::StringVector& outFileNamesArg)
{
// Name count has to match, else we have no way to figure out how to apply output
// names to input files.
if (!(outFileNamesArg.empty() || inFileNames.size() == outFileNamesArg.size()))
{
fail("number of output files must match number of input files.");
}
mPosTolerance = mNormTolerance = mUVTolerance = 1e-06f;
mKeepIdentityTracks = OptionsUtil::isOptionSet(toolOptions, "keep-identity-tracks");
for (OptionList::const_iterator it = toolOptions.begin(); it != toolOptions.end(); ++it)
{
if (it->first == "tolerance")
{
mPosTolerance = mNormTolerance = mUVTolerance = static_cast<float>(any_cast<Real>(it->second));
}
else if (it->first == "pos_tolerance")
{
mPosTolerance = static_cast<float>(any_cast<Real>(it->second));
}
else if (it->first == "norm_tolerance")
{
mNormTolerance = static_cast<float>(any_cast<Real>(it->second));
}
else if (it->first == "uv_tolerance")
{
mUVTolerance = static_cast<float>(any_cast<Real>(it->second));
}
}
StringVector outFileNames = outFileNamesArg.empty() ? inFileNames : outFileNamesArg;
// Process the meshes
for (size_t i = 0, end = inFileNames.size(); i < end; ++i)
{
if (StringUtil::endsWith(inFileNames[i], ".mesh", true))
{
processMeshFile(inFileNames[i], outFileNames[i]);
}
else if (StringUtil::endsWith(inFileNames[i], ".skeleton", true))
{
processSkeletonFile(inFileNames[i], outFileNames[i]);
}
else
{
warn("unrecognised name ending for file " + inFileNames[i]);
warn("file skipped.");
}
}
}
示例2: print_allowed_options
static void print_allowed_options(const OptionList &allowed_options)
{
for (OptionList::const_iterator i = allowed_options.begin();
i != allowed_options.end(); ++i) {
std::ostringstream os1(std::ios::binary);
os1 << " --" << i->first;
if (i->second.type != VALUETYPE_FLAG)
os1 << _(" <value>");
dstream << padStringRight(os1.str(), 24);
if (i->second.help != NULL)
dstream << i->second.help;
dstream << std::endl;
}
}
示例3: main
int main(int argc, const char** argv)
{
if (argc < 2)
{
printHelp();
return -1;
}
ToolManager manager;
manager.registerToolFactory(new TransformToolFactory());
manager.registerToolFactory(new InfoToolFactory());
manager.registerToolFactory(new MeshMergeToolFactory());
manager.registerToolFactory(new RenameToolFactory());
manager.registerToolFactory(new OptimiseToolFactory());
OgreEnvironment* ogreEnv = new OgreEnvironment();
ogreEnv->initialize();
CommandLine cmdLine = parseCommandLine(argc, argv);
// Define allowed global arguments
OptionDefinitionSet globalOptionDefs = OptionDefinitionSet();
globalOptionDefs.insert(OptionDefinition("help", OT_STRING, false, false, Any(String())));
globalOptionDefs.insert(OptionDefinition("list"));
globalOptionDefs.insert(OptionDefinition("no-follow-skeleton"));
globalOptionDefs.insert(OptionDefinition("version"));
globalOptionDefs.insert(OptionDefinition("quiet"));
globalOptionDefs.insert(OptionDefinition("verbose"));
OptionList globalOptions;
try
{
globalOptions = OptionsParser::parseOptions(
cmdLine.globalArgc, cmdLine.globalArgv, globalOptionDefs);
}
catch (std::exception& se)
{
std::cout << "Parsing global options failed:" << std::endl;
std::cout << se.what() << std::endl;
return -1;
}
catch (...)
{
std::cout << "Parsing global options failed." << std::endl;
return -1;
}
// Evaluate global options (as far as they are of interest here...)
for (OptionList::const_iterator it = globalOptions.begin(); it != globalOptions.end(); ++it)
{
if (it->first == "version")
{
std::cout << "MeshMagick version "
<< MESHMAGICK_VERSION_MAJOR << "."
<< MESHMAGICK_VERSION_MINOR << "."
<< MESHMAGICK_VERSION_PATCH << std::endl;
std::cout << "using Ogre version "
<< OGRE_VERSION_MAJOR << "."
<< OGRE_VERSION_MINOR << "."
<< OGRE_VERSION_PATCH
<< " (" << OGRE_VERSION_NAME ")"
<< std::endl;
return 0;
}
else if (it->first == "help")
{
String toolName = any_cast<String>(it->second);
if (!toolName.empty())
{
// toolhelp
try
{
manager.printToolHelp(toolName, std::cout);
}
catch (std::exception& se)
{
std::cout << se.what() << std::endl << std::endl;
// global help
printHelp();
}
return 0;
}
else
{
// global help
printHelp();
return 0;
}
}
else if (it->first == "list")
{
manager.printToolList(std::cout);
return 0;
}
}
if (cmdLine.toolName.empty())
{
std::cout << "No tool given." << std::endl << "call \""
<< argv[0] << "\" -h for help" << std::endl;
//.........这里部分代码省略.........