diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
| commit | ec05778d5718a7912e506764d443a78d6a6179e3 (patch) | |
| tree | 78a9a01532180030c095acefc45763f07c14edb8 /src/stable/fmt.h | |
| parent | b20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff) | |
| download | libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2 libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip | |
Converted tabs to spaces with tabconv.
Diffstat (limited to '')
| -rw-r--r-- | src/stable/fmt.h | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/src/stable/fmt.h b/src/stable/fmt.h index bcc5240..9ecaf80 100644 --- a/src/stable/fmt.h +++ b/src/stable/fmt.h | |||
| @@ -3,92 +3,92 @@ | |||
| 3 | 3 | ||
| 4 | namespace Bu | 4 | namespace Bu |
| 5 | { | 5 | { |
| 6 | typedef struct Fmt | 6 | typedef struct Fmt |
| 7 | { | 7 | { |
| 8 | enum Alignment | 8 | enum Alignment |
| 9 | { | 9 | { |
| 10 | Left = 0, | 10 | Left = 0, |
| 11 | Center = 1, | 11 | Center = 1, |
| 12 | Right = 2 | 12 | Right = 2 |
| 13 | }; | 13 | }; |
| 14 | Fmt() : | 14 | Fmt() : |
| 15 | uMinWidth( 0 ), | 15 | uMinWidth( 0 ), |
| 16 | cFillChar(' '), | 16 | cFillChar(' '), |
| 17 | uRadix( 10 ), | 17 | uRadix( 10 ), |
| 18 | uAlign( Right ), | 18 | uAlign( Right ), |
| 19 | bPlus( false ), | 19 | bPlus( false ), |
| 20 | bCaps( false ), | 20 | bCaps( false ), |
| 21 | bTokenize( true ) | 21 | bTokenize( true ) |
| 22 | { | 22 | { |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | Fmt( unsigned int uMinWidth, unsigned int uRadix=10, | 25 | Fmt( unsigned int uMinWidth, unsigned int uRadix=10, |
| 26 | Alignment a=Right, bool bPlus=false, bool bCaps=true, | 26 | Alignment a=Right, bool bPlus=false, bool bCaps=true, |
| 27 | char cFill=' ') : | 27 | char cFill=' ') : |
| 28 | uMinWidth( uMinWidth ), | 28 | uMinWidth( uMinWidth ), |
| 29 | cFillChar(cFill), | 29 | cFillChar(cFill), |
| 30 | uRadix( uRadix ), | 30 | uRadix( uRadix ), |
| 31 | uAlign( a ), | 31 | uAlign( a ), |
| 32 | bPlus( bPlus ), | 32 | bPlus( bPlus ), |
| 33 | bCaps( bCaps ), | 33 | bCaps( bCaps ), |
| 34 | bTokenize( true ) | 34 | bTokenize( true ) |
| 35 | { | 35 | { |
| 36 | } | 36 | } |
| 37 | Fmt( unsigned int uMinWidth, Alignment a, | 37 | Fmt( unsigned int uMinWidth, Alignment a, |
| 38 | unsigned int uRadix=10, bool bPlus=false, bool bCaps=true, | 38 | unsigned int uRadix=10, bool bPlus=false, bool bCaps=true, |
| 39 | char cFill=' ') : | 39 | char cFill=' ') : |
| 40 | uMinWidth( uMinWidth ), | 40 | uMinWidth( uMinWidth ), |
| 41 | cFillChar(cFill), | 41 | cFillChar(cFill), |
| 42 | uRadix( uRadix ), | 42 | uRadix( uRadix ), |
| 43 | uAlign( a ), | 43 | uAlign( a ), |
| 44 | bPlus( bPlus ), | 44 | bPlus( bPlus ), |
| 45 | bCaps( bCaps ), | 45 | bCaps( bCaps ), |
| 46 | bTokenize( true ) | 46 | bTokenize( true ) |
| 47 | { | 47 | { |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | static Fmt hex( unsigned int uWidth=0, bool bCaps=false ) | 50 | static Fmt hex( unsigned int uWidth=0, bool bCaps=false ) |
| 51 | { | 51 | { |
| 52 | return Fmt( uWidth, 16, Right, false, bCaps, '0' ); | 52 | return Fmt( uWidth, 16, Right, false, bCaps, '0' ); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | static Fmt oct( unsigned int uWidth=0 ) | 55 | static Fmt oct( unsigned int uWidth=0 ) |
| 56 | { | 56 | { |
| 57 | return Fmt( uWidth, 8, Right, false, false, '0' ); | 57 | return Fmt( uWidth, 8, Right, false, false, '0' ); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | static Fmt bin( unsigned int uWidth=0 ) | 60 | static Fmt bin( unsigned int uWidth=0 ) |
| 61 | { | 61 | { |
| 62 | return Fmt( uWidth, 1, Right, false, false, '0' ); | 62 | return Fmt( uWidth, 1, Right, false, false, '0' ); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | static Fmt ptr( bool bCaps=true ) | 65 | static Fmt ptr( bool bCaps=true ) |
| 66 | { | 66 | { |
| 67 | return Fmt( sizeof(ptrdiff_t)*2, 16, Right, false, bCaps, '0' ); | 67 | return Fmt( sizeof(ptrdiff_t)*2, 16, Right, false, bCaps, '0' ); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | Fmt &width( unsigned int uWidth ); | 70 | Fmt &width( unsigned int uWidth ); |
| 71 | Fmt &fill( char cFill='0' ); | 71 | Fmt &fill( char cFill='0' ); |
| 72 | Fmt &radix( unsigned int uRadix ); | 72 | Fmt &radix( unsigned int uRadix ); |
| 73 | Fmt &align( Alignment eAlign ); | 73 | Fmt &align( Alignment eAlign ); |
| 74 | Fmt &plus( bool bPlus=true ); | 74 | Fmt &plus( bool bPlus=true ); |
| 75 | Fmt &caps( bool bCaps=true ); | 75 | Fmt &caps( bool bCaps=true ); |
| 76 | Fmt &upper(); | 76 | Fmt &upper(); |
| 77 | Fmt &lower(); | 77 | Fmt &lower(); |
| 78 | Fmt &tokenize( bool bTokenize=true ); | 78 | Fmt &tokenize( bool bTokenize=true ); |
| 79 | 79 | ||
| 80 | Fmt &left(); | 80 | Fmt &left(); |
| 81 | Fmt &right(); | 81 | Fmt &right(); |
| 82 | Fmt ¢er(); | 82 | Fmt ¢er(); |
| 83 | 83 | ||
| 84 | unsigned char uMinWidth; | 84 | unsigned char uMinWidth; |
| 85 | char cFillChar; | 85 | char cFillChar; |
| 86 | unsigned short uRadix : 6; | 86 | unsigned short uRadix : 6; |
| 87 | unsigned short uAlign : 2; | 87 | unsigned short uAlign : 2; |
| 88 | unsigned short bPlus : 1; | 88 | unsigned short bPlus : 1; |
| 89 | unsigned short bCaps : 1; | 89 | unsigned short bCaps : 1; |
| 90 | unsigned short bTokenize : 1; | 90 | unsigned short bTokenize : 1; |
| 91 | } Fmt; | 91 | } Fmt; |
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| 94 | #endif | 94 | #endif |
