本文整理汇总了C++中ToolManager::invokeTool方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolManager::invokeTool方法的具体用法?C++ ToolManager::invokeTool怎么用?C++ ToolManager::invokeTool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolManager
的用法示例。
在下文中一共展示了ToolManager::invokeTool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
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;
return -1;
}
// create and invoke tool
try
{
manager.invokeTool(cmdLine.toolName, globalOptions, cmdLine.toolArgc, cmdLine.toolArgv,
cmdLine.inFileNames, cmdLine.outFileNames);
}
catch (std::exception& se)
{
std::cout << "Invocation of tool " << cmdLine.toolName << " failed:" << std::endl;
std::cout << se.what() << std::endl;
return -1;
}
catch (...)
{
std::cout << "Invocation of tool " << cmdLine.toolName << " failed." << std::endl;
return -1;
}
return 0;
}