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