本文整理汇总了C++中ArgvIterator类的典型用法代码示例。如果您正苦于以下问题:C++ ArgvIterator类的具体用法?C++ ArgvIterator怎么用?C++ ArgvIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArgvIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseCommandLineOptions
virtual bool parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
{
usage();
return false;
}
for (; !iter.done(); iter.next())
{
const char *arg = iter.query();
if (*arg!='-')
{
if (optTarget.isEmpty())
optTarget.set(arg);
else
{
fprintf(stderr, "\nunrecognized argument %s\n", arg);
return false;
}
continue;
}
if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
return false;
}
return true;
}
示例2: parseCommandLineOptions
virtual bool parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
{
usage();
return false;
}
for (; !iter.done(); iter.next())
{
const char *arg = iter.query();
if (*arg!='-')
{
optQuerySetName.set(arg);
break;
}
if (iter.matchOption(optPackageMap, ECLOPT_PACKAGEMAP))
continue;
switch (EclCmdCommon::matchCommandLineOption(iter))
{
case EclCmdOptionNoMatch:
fprintf(stderr, "\n%s option not recognized\n", arg);
return false;
case EclCmdOptionCompletion:
return false;
case EclCmdOptionMatch:
break;
}
}
return true;
}
示例3: callExternal
int EclCMDShell::callExternal(ArgvIterator &iter)
{
const char *argv[100];
StringBuffer cmdstr("ecl-");
cmdstr.append(cmd.sget());
int i=0;
argv[i++]=cmdstr.str();
if (optHelp)
argv[i++]="help";
for (; !iter.done(); iter.next())
argv[i++]=iter.query();
argv[i]=NULL;
if (execvp(cmdstr.str(), const_cast<char **>(argv))==-1)
{
switch(errno)
{
case ENOENT:
fprintf(stderr, "ecl '%s' command not found\n", cmd.sget());
return 1;
default:
fprintf(stderr, "ecl '%s' command error %d\n", cmd.sget(), errno);
return 1;
}
}
return 0;
}
示例4: parseCommandLineOptions
virtual bool parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
{
usage();
return false;
}
for (; !iter.done(); iter.next())
{
const char *arg = iter.query();
if (*arg!='-')
{
if (optAlias.length())
{
fprintf(stderr, "\nmultiple aliases not supported\n");
return false;
}
optAlias.set(arg);
continue;
}
if (iter.matchOption(optQuerySet, ECLOPT_QUERYSET))
continue;
if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
return false;
}
return true;
}
示例5: matchCommandLineOption
esdlCmdOptionMatchIndicator EsdlConvertCmd::matchCommandLineOption(ArgvIterator &iter, bool finalAttempt)
{
if (iter.matchOption(optSource, ESDL_CONVERT_SOURCE))
return EsdlCmdOptionMatch;
if (iter.matchOption(optOutDirPath, ESDL_CONVERT_OUTDIR))
return EsdlCmdOptionMatch;
return EsdlCmdCommon::matchCommandLineOption(iter, true);
}
示例6: parseCommandLineOption
bool EsdlConvertCmd::parseCommandLineOption(ArgvIterator &iter)
{
if (iter.matchOption(optSource, ESDL_CONVERT_SOURCE))
return true;
if (iter.matchOption(optOutDirPath, ESDL_CONVERT_OUTDIR))
return true;
return false;
}
示例7: parseCommandLineOption
bool parseCommandLineOption(ArgvIterator &iter)
{
if (iter.matchFlag(optTargetAddress, ESDL_OPTION_TARGET_ESP_ADDRESS))
return true;
if (iter.matchFlag(optTargetPort, ESDL_OPTION_TARGET_ESP_PORT) )
return true;
if (EsdlPublishCmdCommon::parseCommandLineOption(iter))
return true;
return false;
}
示例8: parseCommandLineOptions
virtual bool parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
{
usage();
return false;
}
for (; !iter.done(); iter.next())
{
const char *arg = iter.query();
if (*arg!='-')
{
if (optTarget.isEmpty())
optTarget.set(arg);
else if (optFileName.isEmpty())
optFileName.set(arg);
else
{
fprintf(stderr, "\nunrecognized argument %s\n", arg);
return false;
}
continue;
}
if (iter.matchFlag(optValidateActive, ECLOPT_ACTIVE))
continue;
if (iter.matchOption(optPMID, ECLOPT_PMID) || iter.matchOption(optPMID, ECLOPT_PMID_S))
continue;
if (iter.matchOption(optQueryId, ECLOPT_QUERYID))
continue;
if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
return false;
}
return true;
}
示例9: parseCommandLineOption
bool parseCommandLineOption(ArgvIterator &iter)
{
StringAttr oneOption;
if (iter.matchOption(oneOption, ESDLOPT_INCLUDE_PATH) || iter.matchOption(oneOption, ESDLOPT_INCLUDE_PATH_S))
{
if(optIncludePath.length() > 0)
optIncludePath.append(ENVSEPSTR);
optIncludePath.append(oneOption.get());
return true;
}
if (EsdlPublishCmdCommon::parseCommandLineOption(iter))
return true;
return false;
}
示例10: parseCommandLineOptions
bool EclCMDShell::parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
{
usage();
return false;
}
bool boolValue;
for (; !iter.done(); iter.next())
{
const char * arg = iter.query();
if (iter.matchFlag(optHelp, "help"))
continue;
else if (*arg!='-')
{
cmd.set(arg);
iter.next();
break;
}
else if (iter.matchFlag(boolValue, "--version"))
{
fprintf(stdout, "%s\n", BUILD_TAG);
return false;
}
}
return true;
}
示例11: parseCommandLineOptions
virtual bool parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
{
usage();
return false;
}
for (; !iter.done(); iter.next())
{
if (parseCommandLineOption(iter))
continue;
if (matchCommandLineOption(iter, true)!=EsdlCmdOptionMatch)
return false;
}
return true;
}
示例12: parseCommandLineOption
bool parseCommandLineOption(ArgvIterator &iter)
{
if (iter.matchFlag(optInput, ESDL_OPTION_CONFIG) )
return true;
if (EsdlPublishCmdCommon::parseCommandLineOption(iter))
return true;
return false;
}
示例13: callExternal
int EclCMDShell::callExternal(ArgvIterator &iter)
{
const char *argv[100];
StringBuffer cmdstr("ecl-");
cmdstr.append(cmd.str());
int i=0;
argv[i++]=cmdstr.str();
if (optHelp)
argv[i++]="help";
for (; !iter.done(); iter.next())
argv[i++]=iter.query();
argv[i]=NULL;
//TODO - add common routine or use existing in jlib
// First try in same dir as the ecl executable
StringBuffer local;
splitFilename(queryCurrentProcessPath(), &local, &local, NULL, NULL);
local.append(cmdstr);
errno = 0;
#ifdef _WIN32
if (_spawnvp(_P_WAIT, local.str(), const_cast<char **>(argv))==-1)
return 0;
// If not found, try the path
if (errno!=ENOENT || _spawnvp(_P_WAIT, cmdstr.str(), const_cast<char **>(argv))==-1)
#else
if (execvp(local.str(), const_cast<char **>(argv))!=-1)
return 0;
// If not found, try the path
if (errno!=ENOENT || execvp(cmdstr.str(), const_cast<char **>(argv))==-1)
#endif
{
switch(errno)
{
case ENOENT:
fprintf(stderr, "ecl '%s' command not found\n", cmd.str());
return 1;
default:
fprintf(stderr, "ecl '%s' command error %d\n", cmd.str(), errno);
return 1;
}
}
return 0;
}
示例14: parseCommandLineOptions
virtual bool parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
return false;
for (; !iter.done(); iter.next())
{
const char *arg = iter.query();
if (*arg!='-')
{
if (optTarget.isEmpty())
optTarget.set(arg);
else if (optFileName.isEmpty())
optFileName.set(arg);
else
{
fprintf(stderr, "\nunrecognized argument %s\n", arg);
return false;
}
continue;
}
if (iter.matchFlag(optValidateActive, ECLOPT_ACTIVE))
continue;
if (iter.matchFlag(optCheckDFS, ECLOPT_CHECK_DFS))
continue;
if (iter.matchOption(optPMID, ECLOPT_PMID) || iter.matchOption(optPMID, ECLOPT_PMID_S))
continue;
if (iter.matchFlag(optGlobalScope, ECLOPT_GLOBAL_SCOPE))
continue;
StringAttr queryIds;
if (iter.matchOption(queryIds, ECLOPT_QUERYID))
{
optQueryIds.appendList(queryIds.get(), ",");
continue;
}
if (EclCmdCommon::matchCommandLineOption(iter, true)!=EclCmdOptionMatch)
return false;
}
return true;
}
示例15: parseCommandLineOptions
bool parseCommandLineOptions(ArgvIterator &iter)
{
if (iter.done())
{
usage();
return false;
}
//First 4 parameter's order is fixed.
//TargetESPProcessName
//TargetESPBindingPort | TargetESPServiceName
//ESDLDefinitionId
//ESDLServiceName
for (int cur = 0; cur < 4 && !iter.done(); cur++)
{
const char *arg = iter.query();
if (*arg != '-')
{
switch (cur)
{
case 0:
optTargetESPProcName.set(arg);
break;
case 1:
optPortOrName.set(arg);
break;
case 2:
optESDLDefID.set(arg);
break;
case 3:
optESDLService.set(arg);
break;
default:
fprintf(stderr, "\nUnrecognized positional argument detected : %s\n", arg);
usage();
return false;
}
}
else
{
fprintf(stderr, "\nOption detected before required arguments: %s\n", arg);
usage();
return false;
}
iter.next();
}
for (; !iter.done(); iter.next())
{
if (parseCommandLineOption(iter))
continue;
if (matchCommandLineOption(iter, true)!=EsdlCmdOptionMatch)
return false;
}
return true;
}