本文整理汇总了C++中PropertiesPtr::parseCommandLineOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertiesPtr::parseCommandLineOptions方法的具体用法?C++ PropertiesPtr::parseCommandLineOptions怎么用?C++ PropertiesPtr::parseCommandLineOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertiesPtr
的用法示例。
在下文中一共展示了PropertiesPtr::parseCommandLineOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: e
void
Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, StringSeq& cmdArgs)
{
assert(_communicator);
string entryPoint;
StringSeq args;
if(!pluginSpec.empty())
{
//
// Split the entire property value into arguments. An entry point containing spaces
// must be enclosed in quotes.
//
try
{
args = IceUtilInternal::Options::split(pluginSpec);
}
catch(const IceUtilInternal::BadOptException& ex)
{
PluginInitializationException e(__FILE__, __LINE__);
e.reason = "invalid arguments for plug-in `" + name + "':\n" + ex.reason;
throw e;
}
assert(!args.empty());
//
// Shift the arguments.
//
entryPoint = args[0];
args.erase(args.begin());
//
// Convert command-line options into properties. First we
// convert the options from the plug-in configuration, then
// we convert the options from the application command-line.
//
PropertiesPtr properties = _communicator->getProperties();
args = properties->parseCommandLineOptions(name, args);
cmdArgs = properties->parseCommandLineOptions(name, cmdArgs);
}
PluginFactory factory = 0;
DynamicLibraryPtr library;
//
// Always check the static plugin factory table first, it takes
// precedence over the the entryPoint specified in the plugin
// property value.
//
if(factories)
{
map<string, PluginFactory>::const_iterator p = factories->find(name);
if(p != factories->end())
{
factory = p->second;
}
}
//
// If we didn't find the factory, get the factory using the entry
// point symbol.
//
if(!factory)
{
assert(!entryPoint.empty());
library = new DynamicLibrary();
DynamicLibrary::symbol_type sym = library->loadEntryPoint(entryPoint);
if(sym == 0)
{
ostringstream out;
string msg = library->getErrorMessage();
out << "unable to load entry point `" << entryPoint << "'";
if(!msg.empty())
{
out << ": " + msg;
}
PluginInitializationException ex(__FILE__, __LINE__);
ex.reason = out.str();
throw ex;
}
#ifdef __IBMCPP__
// xlC warns when casting a void* to function pointer
# pragma report(disable, "1540-0216")
#endif
factory = reinterpret_cast<PluginFactory>(sym);
}
//
// Invoke the factory function. No exceptions can be raised
// by the factory function because it's declared extern "C".
//
PluginPtr plugin(factory(_communicator, name, args));
if(!plugin)
{
PluginInitializationException e(__FILE__, __LINE__);
ostringstream out;
out << "failure in entry point `" << entryPoint << "'";
//.........这里部分代码省略.........