diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-01-20 02:14:08 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-20 02:14:08 +0000 |
| commit | f5aca1a1b402bd7ebc944dc6e6fe65828d863365 (patch) | |
| tree | 4a0fdd8e166d5c4b03543279d332b9a858ef62df /src/tools/mkunit.cpp | |
| parent | 10c557562e1d67c55314c212371ea9cb7f802863 (diff) | |
| download | libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.gz libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.bz2 libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.xz libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.zip | |
Bu::FString is now String, and there's a shell script to fix any other programs
that were using fstring, I hope.
Diffstat (limited to 'src/tools/mkunit.cpp')
| -rw-r--r-- | src/tools/mkunit.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/tools/mkunit.cpp b/src/tools/mkunit.cpp index 12ce65f..c0b7b8b 100644 --- a/src/tools/mkunit.cpp +++ b/src/tools/mkunit.cpp | |||
| @@ -15,7 +15,7 @@ public: | |||
| 15 | { | 15 | { |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | Bu::FString sName; | 18 | Bu::String sName; |
| 19 | bool bExpectPass; | 19 | bool bExpectPass; |
| 20 | }; | 20 | }; |
| 21 | typedef Bu::List<Test> TestList; | 21 | typedef Bu::List<Test> TestList; |
| @@ -23,7 +23,7 @@ typedef Bu::List<Test> TestList; | |||
| 23 | class Suite | 23 | class Suite |
| 24 | { | 24 | { |
| 25 | public: | 25 | public: |
| 26 | Bu::FString sName; | 26 | Bu::String sName; |
| 27 | TestList lTest; | 27 | TestList lTest; |
| 28 | }; | 28 | }; |
| 29 | //typedef Bu::List<Suite> SuiteList; | 29 | //typedef Bu::List<Suite> SuiteList; |
| @@ -66,7 +66,7 @@ Bu::Formatter &operator<<( Bu::Formatter &f, const Suite &s ) | |||
| 66 | class Parser | 66 | class Parser |
| 67 | { | 67 | { |
| 68 | public: | 68 | public: |
| 69 | Parser( const Bu::FString &sFile ) : | 69 | Parser( const Bu::String &sFile ) : |
| 70 | sIn( sFile ), | 70 | sIn( sFile ), |
| 71 | fIn( sFile, File::Read ), | 71 | fIn( sFile, File::Read ), |
| 72 | bIn( fIn ), | 72 | bIn( fIn ), |
| @@ -99,10 +99,10 @@ public: | |||
| 99 | return cBuf; | 99 | return cBuf; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | TokType nextToken( Variant &v, Bu::FString &sWsOut, int &iLineStart, | 102 | TokType nextToken( Variant &v, Bu::String &sWsOut, int &iLineStart, |
| 103 | int &iCharStart ) | 103 | int &iCharStart ) |
| 104 | { | 104 | { |
| 105 | Bu::FString sTok, sWs; | 105 | Bu::String sTok, sWs; |
| 106 | 106 | ||
| 107 | char buf; | 107 | char buf; |
| 108 | try | 108 | try |
| @@ -307,7 +307,7 @@ public: | |||
| 307 | void firstPass() | 307 | void firstPass() |
| 308 | { | 308 | { |
| 309 | Variant v; | 309 | Variant v; |
| 310 | Bu::FString sWs; | 310 | Bu::String sWs; |
| 311 | int iL, iC; | 311 | int iL, iC; |
| 312 | for(;;) | 312 | for(;;) |
| 313 | { | 313 | { |
| @@ -322,7 +322,7 @@ public: | |||
| 322 | if( nextToken( v, sWs, iL, iC ) != tokFluff ) | 322 | if( nextToken( v, sWs, iL, iC ) != tokFluff ) |
| 323 | throw Bu::ExceptionBase("%d:%d: Expected string " | 323 | throw Bu::ExceptionBase("%d:%d: Expected string " |
| 324 | "following suite.", iL, iC ); | 324 | "following suite.", iL, iC ); |
| 325 | s.sName = v.get<Bu::FString>(); | 325 | s.sName = v.get<Bu::String>(); |
| 326 | if( nextToken( v, sWs, iL, iC ) != tokChar || | 326 | if( nextToken( v, sWs, iL, iC ) != tokChar || |
| 327 | v.get<char>() != '{' ) | 327 | v.get<char>() != '{' ) |
| 328 | throw Bu::ExceptionBase("%d:%d: Expected {, got " | 328 | throw Bu::ExceptionBase("%d:%d: Expected {, got " |
| @@ -346,7 +346,7 @@ public: | |||
| 346 | throw Bu::ExceptionBase("%d:%d: Expected " | 346 | throw Bu::ExceptionBase("%d:%d: Expected " |
| 347 | "string following test.", iL, iC ); | 347 | "string following test.", iL, iC ); |
| 348 | Test t; | 348 | Test t; |
| 349 | t.sName = v.get<Bu::FString>(); | 349 | t.sName = v.get<Bu::String>(); |
| 350 | if( nextToken( v, sWs, iL, iC ) != tokBlock ) | 350 | if( nextToken( v, sWs, iL, iC ) != tokBlock ) |
| 351 | throw Bu::ExceptionBase("%d:%d: Expected " | 351 | throw Bu::ExceptionBase("%d:%d: Expected " |
| 352 | "{...} block.", | 352 | "{...} block.", |
| @@ -380,7 +380,7 @@ public: | |||
| 380 | } | 380 | } |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | void secondPass( const Bu::FString &sOut ) | 383 | void secondPass( const Bu::String &sOut ) |
| 384 | { | 384 | { |
| 385 | File fOut( sOut, File::WriteNew ); | 385 | File fOut( sOut, File::WriteNew ); |
| 386 | Formatter f( fOut ); | 386 | Formatter f( fOut ); |
| @@ -393,7 +393,7 @@ public: | |||
| 393 | iChar = 0; | 393 | iChar = 0; |
| 394 | bool bHasIncluded = false; | 394 | bool bHasIncluded = false; |
| 395 | 395 | ||
| 396 | Bu::FString sWs; | 396 | Bu::String sWs; |
| 397 | Variant v; | 397 | Variant v; |
| 398 | int iL, iC; | 398 | int iL, iC; |
| 399 | for(;;) | 399 | for(;;) |
| @@ -408,7 +408,7 @@ public: | |||
| 408 | if( nextToken( v, sWs, iL, iC ) != tokFluff ) | 408 | if( nextToken( v, sWs, iL, iC ) != tokFluff ) |
| 409 | throw Bu::ExceptionBase("%d:%d: Expected string " | 409 | throw Bu::ExceptionBase("%d:%d: Expected string " |
| 410 | "following suite.", iL, iC ); | 410 | "following suite.", iL, iC ); |
| 411 | s.sName = v.get<Bu::FString>(); | 411 | s.sName = v.get<Bu::String>(); |
| 412 | if( nextToken( v, sWs, iL, iC ) != tokChar || | 412 | if( nextToken( v, sWs, iL, iC ) != tokChar || |
| 413 | v.get<char>() != '{' ) | 413 | v.get<char>() != '{' ) |
| 414 | throw Bu::ExceptionBase("%d:%d: Expected {", | 414 | throw Bu::ExceptionBase("%d:%d: Expected {", |
| @@ -421,7 +421,7 @@ public: | |||
| 421 | bHasIncluded = true; | 421 | bHasIncluded = true; |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | Bu::FString sClass = "_UnitSuite_" + s.sName; | 424 | Bu::String sClass = "_UnitSuite_" + s.sName; |
| 425 | f << "class " << sClass | 425 | f << "class " << sClass |
| 426 | << " : public Bu::UnitSuite" << f.nl | 426 | << " : public Bu::UnitSuite" << f.nl |
| 427 | << "{" << f.nl << "public:" << f.nl | 427 | << "{" << f.nl << "public:" << f.nl |
| @@ -441,7 +441,7 @@ public: | |||
| 441 | } | 441 | } |
| 442 | else if( t == tokEof ) | 442 | else if( t == tokEof ) |
| 443 | { | 443 | { |
| 444 | Bu::FString sClass = "_UnitSuite_" + s.sName; | 444 | Bu::String sClass = "_UnitSuite_" + s.sName; |
| 445 | f << sWs << f.nl << "int main( int argc, char *argv[] )" | 445 | f << sWs << f.nl << "int main( int argc, char *argv[] )" |
| 446 | << f.nl << "{" << f.nl << "\treturn " << sClass | 446 | << f.nl << "{" << f.nl << "\treturn " << sClass |
| 447 | << "().run( argc, argv );" << f.nl << "}" << f.nl; | 447 | << "().run( argc, argv );" << f.nl << "}" << f.nl; |
| @@ -458,7 +458,7 @@ public: | |||
| 458 | { | 458 | { |
| 459 | case tokFluff: | 459 | case tokFluff: |
| 460 | fOut.write( sWs ); | 460 | fOut.write( sWs ); |
| 461 | fOut.write( v.get<Bu::FString>() ); | 461 | fOut.write( v.get<Bu::String>() ); |
| 462 | break; | 462 | break; |
| 463 | 463 | ||
| 464 | case tokTest: | 464 | case tokTest: |
| @@ -468,7 +468,7 @@ public: | |||
| 468 | throw Bu::ExceptionBase("%d:%d: Expected " | 468 | throw Bu::ExceptionBase("%d:%d: Expected " |
| 469 | "string following test.", iL, iC ); | 469 | "string following test.", iL, iC ); |
| 470 | Test t; | 470 | Test t; |
| 471 | t.sName = v.get<Bu::FString>(); | 471 | t.sName = v.get<Bu::String>(); |
| 472 | if( nextToken( v, sWs, iL, iC ) != tokBlock ) | 472 | if( nextToken( v, sWs, iL, iC ) != tokBlock ) |
| 473 | throw Bu::ExceptionBase("%d:%d: Expected " | 473 | throw Bu::ExceptionBase("%d:%d: Expected " |
| 474 | "{...} block.", | 474 | "{...} block.", |
| @@ -499,7 +499,7 @@ public: | |||
| 499 | fOut.write( sWs ); | 499 | fOut.write( sWs ); |
| 500 | f << f.nl << "#line " << iL << " \"" << sIn | 500 | f << f.nl << "#line " << iL << " \"" << sIn |
| 501 | << "\"" << f.nl; | 501 | << "\"" << f.nl; |
| 502 | fOut.write( v.get<Bu::FString>() ); | 502 | fOut.write( v.get<Bu::String>() ); |
| 503 | 503 | ||
| 504 | break; | 504 | break; |
| 505 | 505 | ||
| @@ -521,7 +521,7 @@ public: | |||
| 521 | } | 521 | } |
| 522 | 522 | ||
| 523 | private: | 523 | private: |
| 524 | Bu::FString sIn; | 524 | Bu::String sIn; |
| 525 | File fIn; | 525 | File fIn; |
| 526 | Buffer bIn; | 526 | Buffer bIn; |
| 527 | char cBuf; | 527 | char cBuf; |
