aboutsummaryrefslogtreecommitdiff
path: root/src/optparser.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-03-31 14:23:55 +0000
committerMike Buland <eichlan@xagasoft.com>2010-03-31 14:23:55 +0000
commitdb45c881d98f2288aa26960e5eae6070f792b82a (patch)
tree21c3a259c7dcb9312d12acfaef2e76fd910d4de1 /src/optparser.cpp
parent85315f2cc85a0c44055cd94c1b7de8cfe11b46e1 (diff)
downloadlibbu++-db45c881d98f2288aa26960e5eae6070f792b82a.tar.gz
libbu++-db45c881d98f2288aa26960e5eae6070f792b82a.tar.bz2
libbu++-db45c881d98f2288aa26960e5eae6070f792b82a.tar.xz
libbu++-db45c881d98f2288aa26960e5eae6070f792b82a.zip
Removed the bool cast operator from FBasicString. It turns out it was causing
way, way, way more problems than it solved. A number of libbu++ tests were inacurate because of it, there were problems in several other programs, and there may be more that have problems we haven't found yet because of this. This will most likely cause complitaion errors, especially in places we didn't expect, where strings were being stored into or passed as integers and the like. In cases where you were just testing a string, just call the "isSet()" function, which is functionally equivellent to the old bool cast operator.
Diffstat (limited to 'src/optparser.cpp')
-rw-r--r--src/optparser.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/optparser.cpp b/src/optparser.cpp
index bbac9d5..53efe92 100644
--- a/src/optparser.cpp
+++ b/src/optparser.cpp
@@ -53,7 +53,7 @@ void Bu::OptParser::parse( int argc, char **argv )
53 { 53 {
54 Bu::StrArray aParams( iCount ); 54 Bu::StrArray aParams( iCount );
55 aParams.append( sOpt ); 55 aParams.append( sOpt );
56 if( sExtraParam ) 56 if( sExtraParam.isSet() )
57 { 57 {
58 aParams.append( argv[j]+iEPos+1 ); 58 aParams.append( argv[j]+iEPos+1 );
59 } 59 }
@@ -65,11 +65,11 @@ void Bu::OptParser::parse( int argc, char **argv )
65 } 65 }
66 else if( pOpt->pProxy ) 66 else if( pOpt->pProxy )
67 { 67 {
68 if( pOpt->sOverride ) 68 if( pOpt->sOverride.isSet() )
69 { 69 {
70 pOpt->pProxy->setValue( pOpt->sOverride ); 70 pOpt->pProxy->setValue( pOpt->sOverride );
71 } 71 }
72 else if( sExtraParam ) 72 else if( sExtraParam.isSet() )
73 { 73 {
74 pOpt->pProxy->setValue( sExtraParam ); 74 pOpt->pProxy->setValue( sExtraParam );
75 } 75 }
@@ -117,7 +117,7 @@ void Bu::OptParser::parse( int argc, char **argv )
117 } 117 }
118 else if( pOpt->pProxy ) 118 else if( pOpt->pProxy )
119 { 119 {
120 if( pOpt->sOverride ) 120 if( pOpt->sOverride.isSet() )
121 { 121 {
122 pOpt->pProxy->setValue( pOpt->sOverride ); 122 pOpt->pProxy->setValue( pOpt->sOverride );
123 } 123 }
@@ -172,7 +172,7 @@ void Bu::OptParser::addOption( const Option &opt )
172 lOption.append( opt ); 172 lOption.append( opt );
173 if( opt.cOpt != '\0' ) 173 if( opt.cOpt != '\0' )
174 hsOption.insert( opt.cOpt, &lOption.last() ); 174 hsOption.insert( opt.cOpt, &lOption.last() );
175 if( opt.sOpt ) 175 if( opt.sOpt.isSet() )
176 hlOption.insert( opt.sOpt, &lOption.last() ); 176 hlOption.insert( opt.sOpt, &lOption.last() );
177} 177}
178 178
@@ -226,7 +226,7 @@ int Bu::OptParser::optHelp( StrArray /*aParams*/ )
226 if( (*i).cOpt != '\0' ) 226 if( (*i).cOpt != '\0' )
227 bHasShort = true; 227 bHasShort = true;
228 int lOptSize = (*i).sOpt.getSize() + (*i).sHelpDefault.getSize(); 228 int lOptSize = (*i).sOpt.getSize() + (*i).sHelpDefault.getSize();
229 if( (*i).sOpt && iMaxWidth < lOptSize ) 229 if( (*i).sOpt.isSet() && iMaxWidth < lOptSize )
230 iMaxWidth = lOptSize; 230 iMaxWidth = lOptSize;
231 } 231 }
232 int iIndent = 4; 232 int iIndent = 4;
@@ -260,7 +260,7 @@ int Bu::OptParser::optHelp( StrArray /*aParams*/ )
260 } 260 }
261 if( iMaxWidth > 0 ) 261 if( iMaxWidth > 0 )
262 { 262 {
263 if( (*i).sOpt ) 263 if( (*i).sOpt.isSet() )
264 { 264 {
265 sio << "--" << Fmt(iMaxWidth, Fmt::Left) 265 sio << "--" << Fmt(iMaxWidth, Fmt::Left)
266 << (*i).sOpt + (*i).sHelpDefault; 266 << (*i).sOpt + (*i).sHelpDefault;