diff options
Diffstat (limited to '')
-rw-r--r-- | src/formatter.cpp | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/formatter.cpp b/src/formatter.cpp index 5ab1b3f..14f70ed 100644 --- a/src/formatter.cpp +++ b/src/formatter.cpp | |||
@@ -111,6 +111,11 @@ void Bu::Formatter::writeAligned( const char *sStr, int iLen ) | |||
111 | usedFormat(); | 111 | usedFormat(); |
112 | } | 112 | } |
113 | 113 | ||
114 | void Bu::Formatter::read( void *sStr, int iLen ) | ||
115 | { | ||
116 | rStream.read( sStr, iLen ); | ||
117 | } | ||
118 | |||
114 | Bu::FString Bu::Formatter::readToken() | 119 | Bu::FString Bu::Formatter::readToken() |
115 | { | 120 | { |
116 | Bu::FString sRet; | 121 | Bu::FString sRet; |
@@ -362,3 +367,101 @@ Bu::Formatter &Bu::operator>>( Bu::Formatter &f, Bu::FString &sStr ) | |||
362 | return f; | 367 | return f; |
363 | } | 368 | } |
364 | 369 | ||
370 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, signed char &c ) | ||
371 | { | ||
372 | f.read( &c, 1 ); | ||
373 | return f; | ||
374 | } | ||
375 | |||
376 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, char &c ) | ||
377 | { | ||
378 | f.read( &c, 1 ); | ||
379 | return f; | ||
380 | } | ||
381 | |||
382 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, unsigned char &c ) | ||
383 | { | ||
384 | f.read( &c, 1 ); | ||
385 | return f; | ||
386 | } | ||
387 | |||
388 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, signed short &i ) | ||
389 | { | ||
390 | f.iparse( i, f.readToken() ); | ||
391 | return f; | ||
392 | } | ||
393 | |||
394 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, unsigned short &i ) | ||
395 | { | ||
396 | f.uparse( i, f.readToken() ); | ||
397 | return f; | ||
398 | } | ||
399 | |||
400 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, signed int &i ) | ||
401 | { | ||
402 | f.iparse( i, f.readToken() ); | ||
403 | return f; | ||
404 | } | ||
405 | |||
406 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, unsigned int &i ) | ||
407 | { | ||
408 | f.uparse( i, f.readToken() ); | ||
409 | return f; | ||
410 | } | ||
411 | |||
412 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, signed long &i ) | ||
413 | { | ||
414 | f.iparse( i, f.readToken() ); | ||
415 | return f; | ||
416 | } | ||
417 | |||
418 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, unsigned long &i ) | ||
419 | { | ||
420 | f.uparse( i, f.readToken() ); | ||
421 | return f; | ||
422 | } | ||
423 | |||
424 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, signed long long &i ) | ||
425 | { | ||
426 | f.iparse( i, f.readToken() ); | ||
427 | return f; | ||
428 | } | ||
429 | |||
430 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, unsigned long long &i ) | ||
431 | { | ||
432 | f.uparse( i, f.readToken() ); | ||
433 | return f; | ||
434 | } | ||
435 | |||
436 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, float &flt ) | ||
437 | { | ||
438 | f.fparse( flt, f.readToken() ); | ||
439 | return f; | ||
440 | } | ||
441 | |||
442 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, double &flt ) | ||
443 | { | ||
444 | f.fparse( flt, f.readToken() ); | ||
445 | return f; | ||
446 | } | ||
447 | |||
448 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, long double &flt ) | ||
449 | { | ||
450 | f.fparse( flt, f.readToken() ); | ||
451 | return f; | ||
452 | } | ||
453 | |||
454 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, bool &b ) | ||
455 | { | ||
456 | Bu::FString sStr = f.readToken(); | ||
457 | if( !sStr ) | ||
458 | return f; | ||
459 | char c = *sStr.begin(); | ||
460 | if( c == 'y' || c == 'Y' || c == 't' || c == 'T' ) | ||
461 | b = true; | ||
462 | else if( c == 'n' || c == 'N' || c == 'f' || c == 'F' ) | ||
463 | b = false; | ||
464 | |||
465 | return f; | ||
466 | } | ||
467 | |||