|
|
|
@ -1,5 +1,3 @@
|
|
|
|
|
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* file: CmdLine.h
|
|
|
|
@ -46,7 +44,7 @@
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
#include <stdlib.h> // Needed for exit(), which isn't defined in some envs.
|
|
|
|
|
#include <cstdlib> // Needed for exit(), which isn't defined in some envs.
|
|
|
|
|
|
|
|
|
|
namespace TCLAP
|
|
|
|
|
{
|
|
|
|
@ -229,7 +227,7 @@ namespace TCLAP
|
|
|
|
|
* \param argc - Number of arguments.
|
|
|
|
|
* \param argv - Array of arguments.
|
|
|
|
|
*/
|
|
|
|
|
void parse(int argc, const char*const *argv);
|
|
|
|
|
void parse(int argc, const char* const *argv);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Parses the command line.
|
|
|
|
@ -304,11 +302,6 @@ namespace TCLAP
|
|
|
|
|
void reset();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//Begin CmdLine.cpp
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
inline CmdLine::CmdLine(const std::string &m, char delim, const std::string &v, bool help) :
|
|
|
|
|
_progName("not_set_yet"), _message(m), _version(v), _numRequired(0), _delimiter(delim),
|
|
|
|
|
_handleExceptions(true), _userSetOutput(false), _helpAndVersion(help)
|
|
|
|
@ -354,9 +347,8 @@ namespace TCLAP
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
v = new IgnoreRestVisitor();
|
|
|
|
|
SwitchArg *ignore = new SwitchArg(Arg::flagStartString(),
|
|
|
|
|
Arg::ignoreNameString(), "Ignores the rest of the labeled arguments following this flag.", false,
|
|
|
|
|
v);
|
|
|
|
|
SwitchArg *ignore = new SwitchArg(Arg::flagStartString(), Arg::ignoreNameString(),
|
|
|
|
|
"Ignores the rest of the labeled arguments following this flag.", false, v);
|
|
|
|
|
add(ignore);
|
|
|
|
|
deleteOnExit(ignore);
|
|
|
|
|
deleteOnExit(v);
|
|
|
|
@ -394,8 +386,7 @@ namespace TCLAP
|
|
|
|
|
{
|
|
|
|
|
if (*a == *(*it))
|
|
|
|
|
{
|
|
|
|
|
throw (SpecificationException(
|
|
|
|
|
"Argument with same flag/name already exists!", a->longID()));
|
|
|
|
|
throw (SpecificationException("Argument with same flag/name already exists!", a->longID()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -407,7 +398,7 @@ namespace TCLAP
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void CmdLine::parse(int argc, const char*const *argv)
|
|
|
|
|
inline void CmdLine::parse(int argc, const char* const *argv)
|
|
|
|
|
{
|
|
|
|
|
// this step is necessary so that we have easy access to
|
|
|
|
|
// mutable strings.
|
|
|
|
@ -435,8 +426,7 @@ namespace TCLAP
|
|
|
|
|
for (int i = 0; static_cast<unsigned int>(i) < args.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
bool matched = false;
|
|
|
|
|
for (ArgListIterator it = _argList.begin();
|
|
|
|
|
it != _argList.end(); it++)
|
|
|
|
|
for (ArgListIterator it = _argList.begin(); it != _argList.end(); it++)
|
|
|
|
|
{
|
|
|
|
|
if ((*it)->processArg(&i, args))
|
|
|
|
|
{
|
|
|
|
@ -455,8 +445,7 @@ namespace TCLAP
|
|
|
|
|
|
|
|
|
|
if (!matched && !Arg::ignoreRest())
|
|
|
|
|
{
|
|
|
|
|
throw (CmdLineParseException("Couldn't find match "
|
|
|
|
|
"for argument", args[i]));
|
|
|
|
|
throw (CmdLineParseException("Couldn't find match for argument", args[i]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -630,10 +619,6 @@ namespace TCLAP
|
|
|
|
|
|
|
|
|
|
_progName.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//End CmdLine.cpp
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
} //namespace TCLAP
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|