diff options
Diffstat (limited to 'src/fmt.h')
-rw-r--r-- | src/fmt.h | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/src/fmt.h b/src/fmt.h deleted file mode 100644 index 15d8efc..0000000 --- a/src/fmt.h +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | #ifndef BU_FMT_H | ||
2 | #define BU_FMT_H | ||
3 | |||
4 | namespace Bu | ||
5 | { | ||
6 | typedef struct Fmt | ||
7 | { | ||
8 | enum Alignment | ||
9 | { | ||
10 | Left = 0, | ||
11 | Center = 1, | ||
12 | Right = 2 | ||
13 | }; | ||
14 | Fmt() : | ||
15 | uMinWidth( 0 ), | ||
16 | cFillChar(' '), | ||
17 | uRadix( 10 ), | ||
18 | uAlign( Right ), | ||
19 | bPlus( false ), | ||
20 | bCaps( true ), | ||
21 | bTokenize( true ) | ||
22 | { | ||
23 | } | ||
24 | |||
25 | Fmt( unsigned int uMinWidth, unsigned int uRadix=10, | ||
26 | Alignment a=Right, bool bPlus=false, bool bCaps=true, | ||
27 | char cFill=' ') : | ||
28 | uMinWidth( uMinWidth ), | ||
29 | cFillChar(cFill), | ||
30 | uRadix( uRadix ), | ||
31 | uAlign( a ), | ||
32 | bPlus( bPlus ), | ||
33 | bCaps( bCaps ), | ||
34 | bTokenize( true ) | ||
35 | { | ||
36 | } | ||
37 | Fmt( unsigned int uMinWidth, Alignment a, | ||
38 | unsigned int uRadix=10, bool bPlus=false, bool bCaps=true, | ||
39 | char cFill=' ') : | ||
40 | uMinWidth( uMinWidth ), | ||
41 | cFillChar(cFill), | ||
42 | uRadix( uRadix ), | ||
43 | uAlign( a ), | ||
44 | bPlus( bPlus ), | ||
45 | bCaps( bCaps ), | ||
46 | bTokenize( true ) | ||
47 | { | ||
48 | } | ||
49 | |||
50 | static Fmt hex( unsigned int uWidth=0, bool bCaps=true ) | ||
51 | { | ||
52 | return Fmt( uWidth, 16, Right, false, bCaps, '0' ); | ||
53 | } | ||
54 | |||
55 | static Fmt oct( unsigned int uWidth=0 ) | ||
56 | { | ||
57 | return Fmt( uWidth, 8, Right, false, false, '0' ); | ||
58 | } | ||
59 | |||
60 | static Fmt bin( unsigned int uWidth=0 ) | ||
61 | { | ||
62 | return Fmt( uWidth, 1, Right, false, false, '0' ); | ||
63 | } | ||
64 | |||
65 | static Fmt ptr( bool bCaps=true ) | ||
66 | { | ||
67 | return Fmt( sizeof(ptrdiff_t)*2, 16, Right, false, bCaps, '0' ); | ||
68 | } | ||
69 | |||
70 | Fmt &width( unsigned int uWidth ); | ||
71 | Fmt &fill( char cFill='0' ); | ||
72 | Fmt &radix( unsigned int uRadix ); | ||
73 | Fmt &align( Alignment eAlign ); | ||
74 | Fmt &plus( bool bPlus=true ); | ||
75 | Fmt &caps( bool bCaps=true ); | ||
76 | Fmt &tokenize( bool bTokenize=true ); | ||
77 | |||
78 | Fmt &left(); | ||
79 | Fmt &right(); | ||
80 | Fmt ¢er(); | ||
81 | |||
82 | unsigned char uMinWidth; | ||
83 | char cFillChar; | ||
84 | unsigned short uRadix : 6; | ||
85 | unsigned short uAlign : 2; | ||
86 | unsigned short bPlus : 1; | ||
87 | unsigned short bCaps : 1; | ||
88 | unsigned short bTokenize : 1; | ||
89 | } Fmt; | ||
90 | }; | ||
91 | |||
92 | #endif | ||