本文整理汇总了C++中Option::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ Option::reset方法的具体用法?C++ Option::reset怎么用?C++ Option::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Option
的用法示例。
在下文中一共展示了Option::reset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessOptions
int RestoreScale::ProcessOptions(int argc, char** argv) {
Option option;
int argc_old=argc;
while (*argv[0]=='-' && argc>1) {
option.reset();
switch (argv[0][1]) {
case 'c':
option.option = "-c";
discardImage=true;
break;
default:
throw string("unknown option ")+argv[0];
} // switch
if(!option.option.empty())
addToSwitches(option);
argc--;
argv++;
} // while
return argc_old-argc;
}
示例2: ProcessOptions
int AlignmentMarks::ProcessOptions(int argc, char** argv) {
Option option;
int argc_old=argc;
while (*argv[0]=='-' && argc>1) {
option.reset();
switch (argv[0][1]) {
case 'p':
option.option= "-p";
printIntermediate=true;
break;
default:
throw string("AlignmentMarks:processOptions(): unknown option ")+argv[0];
} // switch
if(!option.option.empty())
addToSwitches(option);
argc--;
argv++;
} // while
return argc_old-argc;
}
示例3: ProcessOptions
int ListAdjacent::ProcessOptions(int argc, char** argv) {
Option option;
int argc_old=argc;
while (*argv[0]=='-' && argc>1) {
option.reset();
switch (argv[0][1]) {
default:
EchoError(string("unknown option ")+argv[0]);
} // switch
if(!option.option.empty())
addToSwitches(option);
argc--;
argv++;
} // while
return argc_old-argc;
}
示例4: ProcessOptions
int TestInterface::ProcessOptions(int argc, char** argv)
{
Option option;
int argc_old=argc;
while (argc>1 && *argv[0]=='-') {
option.reset();
switch (argv[0][1]) {
case 't':
if (argc<6){
EchoError("Not enough commandline arguments for switch -t");
break;
}
option.option = "-t";
option.addArgument(argv[1]);
option.addArgument(argv[2]);
option.addArgument(argv[3]);
option.addArgument(argv[4]);
if(sscanf(argv[1],"%d",&tileX1) != 1)
EchoError("switch -t requires an integer specifier.");
if(sscanf(argv[2],"%d",&tileY1) != 1)
EchoError("switch -t requires an integer specifier.");
if(sscanf(argv[3],"%d",&tileX2) != 1)
EchoError("switch -t requires an integer specifier.");
if(sscanf(argv[4],"%d",&tileY2) != 1)
EchoError("switch -t requires an integer specifier.");
argc-=4;
argv+=4;
break;
case 'f':
if (argc<5){
EchoError("Not enough commandline arguments for switch -f");
break;
}
option.option = "-f";
{
int nr_opts=featureInterface.parseFeatureSpec(argv+1);
int nrargs=3+2*nr_opts;
int j;
for(j=1;j<=nrargs;j++)
option.addArgument(argv[j]);
argc -= nrargs;
argv += nrargs;
}
break;
default:
throw string("TestInterface::processOptions(): unknown option ")+argv[0];
} // switch
if(!option.option.empty())
addToSwitches(option);
argc--;
argv++;
} // while
return argc_old-argc;
}
示例5: ProcessOptions
int SampleRandom::ProcessOptions(int argc, char** argv) {
Option option;
int argc_old=argc;
while (*argv[0]=='-' && argc>1) {
option.reset();
switch (argv[0][1]) {
case 'r':
if (argc<3){
EchoError("Not enough commandline arguments for switch -r");
break;
}
option.option = "-r";
option.addArgument(argv[1]);
if(sscanf(argv[1],"%d",&numberOfRegions) != 1)
EchoError("switch -r requires an integer specifier.");
argc--;
argv++;
break;
case 's':
if (argc<3){
throw string("Not enough commandline arguments for switch -s");
break;
}
option.option = "-s";
option.addArgument(argv[1]);
if(sscanf(argv[1],"%d",&xSize) != 1)
throw string("switch -s requires an integer specifier.");
if(strchr(argv[1],':')){
if(sscanf(strchr(argv[1],':')+1,"%d",&ySize) != 1)
throw string("switch -s requires an integer specifier after :.");
}
else ySize=xSize;
case 'f':
if (argc<3){
throw string("Not enough commandline arguments for switch -f");
break;
}
option.option = "-s";
option.addArgument(argv[1]);
if(sscanf(argv[1],"%f",&xFrac) != 1)
throw string("switch -f requires a float specifier.");
if(strchr(argv[1],':')){
if(sscanf(strchr(argv[1],':')+1,"%f",&yFrac) != 1)
throw string("switch -f requires a float specifier after :.");
}
else yFrac=xFrac;
argc--;
argv++;
break;
default:
EchoError(string("unknown option ")+argv[0]);
} // switch
if(!option.option.empty())
addToSwitches(option);
argc--;
argv++;
} // while
return argc_old-argc;
}