aboutsummaryrefslogtreecommitdiff
path: root/src/optparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/optparser.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/optparser.cpp b/src/optparser.cpp
index b81691d..bab93d0 100644
--- a/src/optparser.cpp
+++ b/src/optparser.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2010 Xagasoft, All rights reserved. 2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 * 3 *
4 * This file is part of the libbu++ library and is released under the 4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
@@ -32,9 +32,9 @@ void Bu::OptParser::parse( int argc, char **argv )
32 for( iEPos = 2; argv[j][iEPos] != '\0' && 32 for( iEPos = 2; argv[j][iEPos] != '\0' &&
33 argv[j][iEPos] != '='; iEPos++ ) { } 33 argv[j][iEPos] != '='; iEPos++ ) { }
34 34
35 Bu::FString sOpt; 35 Bu::String sOpt;
36 int iCount = argc-j; 36 int iCount = argc-j;
37 Bu::FString sExtraParam; 37 Bu::String sExtraParam;
38 if( argv[j][iEPos] == '=' ) 38 if( argv[j][iEPos] == '=' )
39 { 39 {
40 sOpt.set( argv[j]+2, iEPos-2 ); 40 sOpt.set( argv[j]+2, iEPos-2 );
@@ -92,7 +92,7 @@ void Bu::OptParser::parse( int argc, char **argv )
92 { 92 {
93 if( !hsOption.has( argv[j][iCPos] ) ) 93 if( !hsOption.has( argv[j][iCPos] ) )
94 { 94 {
95 Bu::FString sOpt("-"); 95 Bu::String sOpt("-");
96 sOpt += argv[j][iCPos]; 96 sOpt += argv[j][iCPos];
97 optionError( sOpt ); 97 optionError( sOpt );
98 } 98 }
@@ -181,17 +181,17 @@ void Bu::OptParser::setOverride( char cOpt, const Bu::Variant &sOverride )
181 hsOption.get( cOpt )->sOverride = sOverride; 181 hsOption.get( cOpt )->sOverride = sOverride;
182} 182}
183 183
184void Bu::OptParser::setOverride( const Bu::FString &sOpt, const Bu::Variant &sOverride ) 184void Bu::OptParser::setOverride( const Bu::String &sOpt, const Bu::Variant &sOverride )
185{ 185{
186 hlOption.get( sOpt )->sOverride = sOverride; 186 hlOption.get( sOpt )->sOverride = sOverride;
187} 187}
188 188
189void Bu::OptParser::setHelpDefault( const Bu::FString &sOpt, const Bu::FString &sTxt ) 189void Bu::OptParser::setHelpDefault( const Bu::String &sOpt, const Bu::String &sTxt )
190{ 190{
191 hlOption.get( sOpt )->sHelpDefault = sTxt; 191 hlOption.get( sOpt )->sHelpDefault = sTxt;
192} 192}
193 193
194void Bu::OptParser::addHelpOption( char c, const Bu::FString &s, const Bu::FString &sHelp ) 194void Bu::OptParser::addHelpOption( char c, const Bu::String &s, const Bu::String &sHelp )
195{ 195{
196 Option o; 196 Option o;
197 o.sUsed = slot( this, &OptParser::optHelp ); 197 o.sUsed = slot( this, &OptParser::optHelp );
@@ -201,7 +201,7 @@ void Bu::OptParser::addHelpOption( char c, const Bu::FString &s, const Bu::FStri
201 addOption( o ); 201 addOption( o );
202} 202}
203 203
204void Bu::OptParser::addHelpBanner( const Bu::FString &sText, bool bFormatted ) 204void Bu::OptParser::addHelpBanner( const Bu::String &sText, bool bFormatted )
205{ 205{
206 Banner b; 206 Banner b;
207 b.sText = sText; 207 b.sText = sText;
@@ -290,7 +290,7 @@ int Bu::OptParser::optHelp( StrArray /*aParams*/ )
290 return 0; 290 return 0;
291} 291}
292 292
293void Bu::OptParser::optionError( const Bu::FString &sOption ) 293void Bu::OptParser::optionError( const Bu::String &sOption )
294{ 294{
295 sio << "Unregcognized option discovered: " << sOption << sio.nl << sio.nl; 295 sio << "Unregcognized option discovered: " << sOption << sio.nl << sio.nl;
296 exit( 1 ); 296 exit( 1 );
@@ -301,11 +301,11 @@ void Bu::OptParser::setNonOption( OptionSignal sSignal )
301 sNonOption = sSignal; 301 sNonOption = sSignal;
302} 302}
303 303
304Bu::FString Bu::OptParser::format( const Bu::FString &sIn, int iWidth, 304Bu::String Bu::OptParser::format( const Bu::String &sIn, int iWidth,
305 int iIndent ) 305 int iIndent )
306{ 306{
307 Bu::FString sOut; 307 Bu::String sOut;
308 Bu::FString sIndent; 308 Bu::String sIndent;
309 for( int j = 0; j < iIndent; j++ ) 309 for( int j = 0; j < iIndent; j++ )
310 sIndent.append(" ", 1); 310 sIndent.append(" ", 1);
311 bool bFirst = true; 311 bool bFirst = true;
@@ -314,8 +314,8 @@ Bu::FString Bu::OptParser::format( const Bu::FString &sIn, int iWidth,
314 int iPrevLineLen; 314 int iPrevLineLen;
315 int iLineLen = 0; 315 int iLineLen = 0;
316 char c; 316 char c;
317 Bu::FString::const_iterator iLastSpace, iStart; 317 Bu::String::const_iterator iLastSpace, iStart;
318 for( Bu::FString::const_iterator i = iLastSpace = iStart = sIn.begin(); i; i++ ) 318 for( Bu::String::const_iterator i = iLastSpace = iStart = sIn.begin(); i; i++ )
319 { 319 {
320 c = *i; 320 c = *i;
321 if( *i == ' ' ) 321 if( *i == ' ' )
@@ -346,7 +346,7 @@ Bu::FString Bu::OptParser::format( const Bu::FString &sIn, int iWidth,
346 float fFill = 0.0; 346 float fFill = 0.0;
347 int iSubSpaceCount = 0; 347 int iSubSpaceCount = 0;
348 float fAdd = ((float)iExtraSpaces/(float)iSpaceCount); 348 float fAdd = ((float)iExtraSpaces/(float)iSpaceCount);
349 for( Bu::FString::const_iterator k = iStart; k != iLastSpace; k++ ) 349 for( Bu::String::const_iterator k = iStart; k != iLastSpace; k++ )
350 { 350 {
351 sOut += *k; 351 sOut += *k;
352 if( *k == ' ' ) 352 if( *k == ' ' )