From 4337d270db9db997d5c0dea6751f5b07cfc2657f Mon Sep 17 00:00:00 2001 From: mes5k Date: Fri, 13 Feb 2004 23:20:08 +0000 Subject: [PATCH] reworked how we add args to list --- src/Arg.cpp | 8 ++++++++ src/CmdLine.cpp | 6 ++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Arg.cpp b/src/Arg.cpp index 8f38181..92cb82f 100644 --- a/src/Arg.cpp +++ b/src/Arg.cpp @@ -290,4 +290,12 @@ void Arg::xorSet() _xorSet = true; } +/** + * Overridden by Args that need to added to the end of the list. + */ +void Arg::addToList( list& argList ) const +{ + argList.push_front( (Arg*)this ); +} + } diff --git a/src/CmdLine.cpp b/src/CmdLine.cpp index bf82f09..030889a 100644 --- a/src/CmdLine.cpp +++ b/src/CmdLine.cpp @@ -101,10 +101,7 @@ void CmdLine::add( Arg* a ) return; } - if ( a->getFlag() == "" ) - _argList.push_back( a ); - else - _argList.push_front( a ); + a->addToList( _argList ); if ( a->isRequired() ) _numRequired++; @@ -201,4 +198,5 @@ bool CmdLine::_emptyCombined(const string& s) return true; } + }