aboutsummaryrefslogtreecommitdiff
path: root/src/paramproc.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-01-07 16:48:35 +0000
committerMike Buland <eichlan@xagasoft.com>2009-01-07 16:48:35 +0000
commitaba7c45c2c69d402d1b6fc427cde5bfa4661a0e1 (patch)
tree5b3849a8190cdb8742b1f43f4b8bbb43c73ababe /src/paramproc.cpp
parent45e065bc4fc93731ea9a0543462bc7cf9e6084d7 (diff)
downloadlibbu++-aba7c45c2c69d402d1b6fc427cde5bfa4661a0e1.tar.gz
libbu++-aba7c45c2c69d402d1b6fc427cde5bfa4661a0e1.tar.bz2
libbu++-aba7c45c2c69d402d1b6fc427cde5bfa4661a0e1.tar.xz
libbu++-aba7c45c2c69d402d1b6fc427cde5bfa4661a0e1.zip
Corrected a couple of places where std:: classes were being used and shouldn't
have been. Also made the Unit tests actually use expected values, so you can mark a test as "expected fail" and it'll know. It also prints out cute reports at the end of each run.
Diffstat (limited to '')
-rw-r--r--src/paramproc.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/paramproc.cpp b/src/paramproc.cpp
index 7aeb819..819a4da 100644
--- a/src/paramproc.cpp
+++ b/src/paramproc.cpp
@@ -121,13 +121,13 @@ Bu::ParamProc::ParamProc()
121 121
122Bu::ParamProc::~ParamProc() 122Bu::ParamProc::~ParamProc()
123{ 123{
124 for( std::list<ArgSpec *>::iterator i = lArg.begin(); 124 for( Bu::List<ArgSpec *>::iterator i = lArg.begin();
125 i != lArg.end(); i++ ) 125 i != lArg.end(); i++ )
126 { 126 {
127 delete *i; 127 delete *i;
128 } 128 }
129 129
130 for( std::list<Banner *>::iterator i = lBan.begin(); 130 for( Bu::List<Banner *>::iterator i = lBan.begin();
131 i != lBan.end(); i++ ) 131 i != lBan.end(); i++ )
132 { 132 {
133 delete *i; 133 delete *i;
@@ -160,12 +160,12 @@ void Bu::ParamProc::addParam( const char *lpWord, char cChar, Proc proc,
160 if( lpValue ) 160 if( lpValue )
161 as->sValue = lpValue; 161 as->sValue = lpValue;
162 162
163 lArg.push_back( as ); 163 lArg.append( as );
164 164
165 if( !lBan.empty() ) 165 if( !lBan.isEmpty() )
166 { 166 {
167 if( lBan.back()->pBefore == NULL ) 167 if( lBan.last()->pBefore == NULL )
168 lBan.back()->pBefore = as; 168 lBan.last()->pBefore = as;
169 } 169 }
170} 170}
171 171
@@ -395,8 +395,8 @@ void Bu::ParamProc::process( int argc, char *argv[] )
395Bu::ParamProc::ArgSpec *Bu::ParamProc::checkWord( const char *arg ) 395Bu::ParamProc::ArgSpec *Bu::ParamProc::checkWord( const char *arg )
396{ 396{
397 //printf("Checking \"%s\"...\n", arg ); 397 //printf("Checking \"%s\"...\n", arg );
398 std::list<ArgSpec *>::const_iterator i; 398 Bu::List<ArgSpec *>::const_iterator i = lArg.begin();
399 for( i = lArg.begin(); i != lArg.end(); i++ ) 399 for( ; i != lArg.end(); i++ )
400 { 400 {
401 if( (*i)->sWord == "" ) 401 if( (*i)->sWord == "" )
402 continue; 402 continue;
@@ -420,8 +420,8 @@ Bu::ParamProc::ArgSpec *Bu::ParamProc::checkWord( const char *arg )
420Bu::ParamProc::ArgSpec *Bu::ParamProc::checkLetr( const char arg ) 420Bu::ParamProc::ArgSpec *Bu::ParamProc::checkLetr( const char arg )
421{ 421{
422 //printf("Checking \'%c\'...\n", arg ); 422 //printf("Checking \'%c\'...\n", arg );
423 std::list<ArgSpec *>::const_iterator i; 423 Bu::List<ArgSpec *>::const_iterator i = lArg.begin();
424 for( i = lArg.begin(); i != lArg.end(); i++ ) 424 for( ; i != lArg.end(); i++ )
425 { 425 {
426 if( (*i)->cChar == '\0' ) 426 if( (*i)->cChar == '\0' )
427 continue; 427 continue;
@@ -449,10 +449,10 @@ int Bu::ParamProc::unknownParam( int /*argc*/, char *argv[] )
449 449
450int Bu::ParamProc::help( int /*argc*/, char * /*argv*/ [] ) 450int Bu::ParamProc::help( int /*argc*/, char * /*argv*/ [] )
451{ 451{
452 std::list<Banner *>::const_iterator b = lBan.begin(); 452 Bu::List<Banner *>::const_iterator b = lBan.begin();
453 std::list<ArgSpec *>::const_iterator i; 453 Bu::List<ArgSpec *>::const_iterator i = lArg.begin();
454 int len=0; 454 int len=0;
455 for( i = lArg.begin(); i != lArg.end(); i++ ) 455 for( ; i != lArg.end(); i++ )
456 { 456 {
457 if( len < (*i)->sWord.getSize() + (*i)->sExtra.getSize() ) 457 if( len < (*i)->sWord.getSize() + (*i)->sExtra.getSize() )
458 len = (*i)->sWord.getSize() + (*i)->sExtra.getSize(); 458 len = (*i)->sWord.getSize() + (*i)->sExtra.getSize();
@@ -517,6 +517,6 @@ void Bu::ParamProc::addHelpBanner( const char *sHelpBanner )
517 Banner *pBan = new Banner; 517 Banner *pBan = new Banner;
518 pBan->sBanner = sHelpBanner; 518 pBan->sBanner = sHelpBanner;
519 pBan->pBefore = NULL; 519 pBan->pBefore = NULL;
520 lBan.push_back( pBan ); 520 lBan.append( pBan );
521} 521}
522 522