11 #include <cmdLine/cmdLine.h>
13 #include "vlutil/vlFilename.h"
23 const char delimiter =
' ',
24 const std::string& version =
"none",
bool allocateConsole=
true);
35 inline bool parseInput(
int argc,
char*
const * argv);
45 const char delimiter,
const std::string& version,
bool allocateConsole)
46 : CmdLine(message,delimiter,version)
47 , myUnlabeledArgument(0)
48 , myAllocateConsole(allocateConsole)
62 std::vector<std::string> args;
63 int requiredCount = 0;
66 DtFilename progName = argv[0];
68 _progName = progName.c_str();
71 for (i = 1; i < argc; i++)
72 args.push_back(argv[i]);
74 for (i = 0;
static_cast<unsigned>(i) < args.size(); i++)
77 for (DtCmdLine::ArgListIterator it = _argList.begin(); !matched && it != _argList.end(); it++)
79 if ( (*it)->processArg( &i, args ) )
84 throw(DtCmdLine::CmdLineParseException(
"Is not recognized!",
87 requiredCount += _xorHandler.check( *it );
94 if ( !matched && _emptyCombined( args[i] ) )
97 if ( !matched && !DtCmdLine::Arg::ignoreRest() )
98 throw(DtCmdLine::CmdLineParseException(
"Couldn't find match for argument",
102 if ( requiredCount < _numRequired )
103 throw(DtCmdLine::CmdLineParseException(
"One or more required arguments missing!"));
105 if ( requiredCount > _numRequired )
106 throw(DtCmdLine::CmdLineParseException(
"Too many arguments!"));
111 catch ( DtCmdLine::ArgException& e )
118 _output->failure(*
this,e);
120 int oldNotifyLevel = DtNotifyLevel;
125 DtInfo <<
"Press any key to continue" << std::endl;
127 while (DtPollBlockingInputChar() ==
'\0')
133 DtNotifyLevel = oldNotifyLevel;
Contains the MAKLogger::DtLgrConsole subclass of DtRunnable.
DtCmdLine::Arg * myUnlabeledArgument
The unlabeled argument if it exists.
Definition: lgrAppCmdLine.h:40
static void allocateConsole()
void addUnlabeled(DtCmdLine::Arg *a)
Add an unlabeled argument.
Definition: lgrAppCmdLine.h:52
Logger Command line object for parsing command input.
Definition: lgrAppCmdLine.h:19
bool parseInput(int argc, char *const *argv)
Parse the input.
Definition: lgrAppCmdLine.h:58
DtLgrCmdLine(const std::string &message, const char delimiter= ' ', const std::string &version="none", bool allocateConsole=true)
Definition: lgrAppCmdLine.h:44
bool myAllocateConsole
Definition: lgrAppCmdLine.h:41