mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-17 08:05:12 -04:00
minor reformatting
This commit is contained in:
parent
d6f5047688
commit
82d187771b
@ -321,9 +321,9 @@ private:
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
inline CmdLine::CmdLine(const std::string& m,
|
inline CmdLine::CmdLine(const std::string& m,
|
||||||
char delim,
|
char delim,
|
||||||
const std::string& v,
|
const std::string& v,
|
||||||
bool help )
|
bool help )
|
||||||
:
|
:
|
||||||
_argList(std::list<Arg*>()),
|
_argList(std::list<Arg*>()),
|
||||||
_progName("not_set_yet"),
|
_progName("not_set_yet"),
|
||||||
@ -365,16 +365,16 @@ inline void CmdLine::_constructor()
|
|||||||
{
|
{
|
||||||
v = new HelpVisitor( this, &_output );
|
v = new HelpVisitor( this, &_output );
|
||||||
SwitchArg* help = new SwitchArg("h","help",
|
SwitchArg* help = new SwitchArg("h","help",
|
||||||
"Displays usage information and exits.",
|
"Displays usage information and exits.",
|
||||||
false, v);
|
false, v);
|
||||||
add( help );
|
add( help );
|
||||||
deleteOnExit(help);
|
deleteOnExit(help);
|
||||||
deleteOnExit(v);
|
deleteOnExit(v);
|
||||||
|
|
||||||
v = new VersionVisitor( this, &_output );
|
v = new VersionVisitor( this, &_output );
|
||||||
SwitchArg* vers = new SwitchArg("","version",
|
SwitchArg* vers = new SwitchArg("","version",
|
||||||
"Displays version information and exits.",
|
"Displays version information and exits.",
|
||||||
false, v);
|
false, v);
|
||||||
add( vers );
|
add( vers );
|
||||||
deleteOnExit(vers);
|
deleteOnExit(vers);
|
||||||
deleteOnExit(v);
|
deleteOnExit(v);
|
||||||
@ -382,9 +382,9 @@ inline void CmdLine::_constructor()
|
|||||||
|
|
||||||
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.",
|
"Ignores the rest of the labeled arguments following this flag.",
|
||||||
false, v);
|
false, v);
|
||||||
add( ignore );
|
add( ignore );
|
||||||
deleteOnExit(ignore);
|
deleteOnExit(ignore);
|
||||||
deleteOnExit(v);
|
deleteOnExit(v);
|
||||||
@ -398,16 +398,15 @@ inline void CmdLine::xorAdd( std::vector<Arg*>& ors )
|
|||||||
{
|
{
|
||||||
(*it)->forceRequired();
|
(*it)->forceRequired();
|
||||||
(*it)->setRequireLabel( "OR required" );
|
(*it)->setRequireLabel( "OR required" );
|
||||||
|
|
||||||
add( *it );
|
add( *it );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CmdLine::xorAdd( Arg& a, Arg& b )
|
inline void CmdLine::xorAdd( Arg& a, Arg& b )
|
||||||
{
|
{
|
||||||
std::vector<Arg*> ors;
|
std::vector<Arg*> ors;
|
||||||
ors.push_back( &a );
|
ors.push_back( &a );
|
||||||
ors.push_back( &b );
|
ors.push_back( &b );
|
||||||
xorAdd( ors );
|
xorAdd( ors );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,8 +420,8 @@ inline void CmdLine::add( Arg* a )
|
|||||||
for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )
|
for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )
|
||||||
if ( *a == *(*it) )
|
if ( *a == *(*it) )
|
||||||
throw( SpecificationException(
|
throw( SpecificationException(
|
||||||
"Argument with same flag/name already exists!",
|
"Argument with same flag/name already exists!",
|
||||||
a->longID() ) );
|
a->longID() ) );
|
||||||
|
|
||||||
a->addToList( _argList );
|
a->addToList( _argList );
|
||||||
|
|
||||||
@ -453,16 +452,17 @@ inline void CmdLine::parse(std::vector<std::string>& args)
|
|||||||
|
|
||||||
int requiredCount = 0;
|
int requiredCount = 0;
|
||||||
|
|
||||||
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 ) )
|
||||||
{
|
{
|
||||||
requiredCount += _xorHandler.check( *it );
|
requiredCount += _xorHandler.check( *it );
|
||||||
matched = true;
|
matched = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// checks to see if the argument is an empty combined
|
// checks to see if the argument is an empty combined
|
||||||
@ -472,8 +472,8 @@ inline void CmdLine::parse(std::vector<std::string>& args)
|
|||||||
|
|
||||||
if ( !matched && !Arg::ignoreRest() )
|
if ( !matched && !Arg::ignoreRest() )
|
||||||
throw(CmdLineParseException("Couldn't find match "
|
throw(CmdLineParseException("Couldn't find match "
|
||||||
"for argument",
|
"for argument",
|
||||||
args[i]));
|
args[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( requiredCount < _numRequired )
|
if ( requiredCount < _numRequired )
|
||||||
@ -616,9 +616,7 @@ inline bool CmdLine::getExceptionHandling() const
|
|||||||
inline void CmdLine::reset()
|
inline void CmdLine::reset()
|
||||||
{
|
{
|
||||||
for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )
|
for( ArgListIterator it = _argList.begin(); it != _argList.end(); it++ )
|
||||||
{
|
|
||||||
(*it)->reset();
|
(*it)->reset();
|
||||||
}
|
|
||||||
|
|
||||||
_progName.clear();
|
_progName.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user