11 #include <cmdLine/cmdLine.h>
13 #include "vlutil/vlFilename.h"
23 const char delimiter =
' ',
24 const std::string& version =
"none");
35 inline bool parseInput(
int argc,
char*
const * argv);
44 const char delimiter,
const std::string& version) :
45 CmdLine(message,delimiter,version),
46 myUnlabeledArgument(0)
60 std::vector<std::string> args;
61 int requiredCount = 0;
64 DtFilename progName = argv[0];
66 _progName = progName.c_str();
69 for (i = 1; i < argc; i++)
70 args.push_back(argv[i]);
72 for (i = 0;
static_cast<unsigned>(i) < args.size(); i++)
75 for (DtCmdLine::ArgListIterator it = _argList.begin(); !matched && it != _argList.end(); it++)
77 if ( (*it)->processArg( &i, args ) )
82 throw(DtCmdLine::CmdLineParseException(
"Is not recognized!",
85 requiredCount += _xorHandler.check( *it );
92 if ( !matched && _emptyCombined( args[i] ) )
95 if ( !matched && !DtCmdLine::Arg::ignoreRest() )
96 throw(DtCmdLine::CmdLineParseException(
"Couldn't find match for argument",
100 if ( requiredCount < _numRequired )
101 throw(DtCmdLine::CmdLineParseException(
"One or more required arguments missing!"));
103 if ( requiredCount > _numRequired )
104 throw(DtCmdLine::CmdLineParseException(
"Too many arguments!"));
109 catch ( DtCmdLine::ArgException& e )
112 _output->failure(*
this,e);
114 int oldNotifyLevel = DtNotifyLevel;
119 DtInfo <<
"Press any key to continue" << std::endl;
121 while (DtPollBlockingInputChar() ==
'\0')
127 DtNotifyLevel = oldNotifyLevel;