aboutsummaryrefslogtreecommitdiff
path: root/src/formatter.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/formatter.h54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/formatter.h b/src/formatter.h
index db144eb..aec5c5d 100644
--- a/src/formatter.h
+++ b/src/formatter.h
@@ -15,7 +15,7 @@ namespace Bu
15 class Formatter 15 class Formatter
16 { 16 {
17 public: 17 public:
18 Formatter( Stream &rOut ); 18 Formatter( Stream &rStream );
19 virtual ~Formatter(); 19 virtual ~Formatter();
20 20
21 typedef struct Fmt 21 typedef struct Fmt
@@ -103,6 +103,8 @@ namespace Bu
103 void writeAligned( const Bu::FString &sStr ); 103 void writeAligned( const Bu::FString &sStr );
104 void writeAligned( const char *sStr, int iLen ); 104 void writeAligned( const char *sStr, int iLen );
105 105
106 Bu::FString readToken();
107
106 void incIndent(); 108 void incIndent();
107 void decIndent(); 109 void decIndent();
108 void setIndent( uint8_t uLevel ); 110 void setIndent( uint8_t uLevel );
@@ -206,11 +208,11 @@ namespace Bu
206 208
207 void doFlush() 209 void doFlush()
208 { 210 {
209 rOut.flush(); 211 rStream.flush();
210 } 212 }
211 213
212 private: 214 private:
213 Stream &rOut; 215 Stream &rStream;
214 Fmt fLast; 216 Fmt fLast;
215 bool bTempFmt; 217 bool bTempFmt;
216 uint8_t uIndent; 218 uint8_t uIndent;
@@ -219,31 +221,33 @@ namespace Bu
219 221
220 typedef Formatter::Fmt Fmt; 222 typedef Formatter::Fmt Fmt;
221 223
222 Formatter &operator<<( Formatter &rOut, const Formatter::Fmt &f ); 224 Formatter &operator<<( Formatter &f, const Formatter::Fmt &fmt );
223 Formatter &operator<<( Formatter &rOut, Formatter::Special s ); 225 Formatter &operator<<( Formatter &f, Formatter::Special s );
224 Formatter &operator<<( Formatter &rOut, const char *sStr ); 226 Formatter &operator<<( Formatter &f, const char *sStr );
225 Formatter &operator<<( Formatter &rOut, char *sStr ); 227 Formatter &operator<<( Formatter &f, char *sStr );
226 Formatter &operator<<( Formatter &rOut, const Bu::FString &sStr ); 228 Formatter &operator<<( Formatter &f, const Bu::FString &sStr );
227 Formatter &operator<<( Formatter &rOut, signed char c ); 229 Formatter &operator<<( Formatter &f, signed char c );
228 Formatter &operator<<( Formatter &rOut, char c ); 230 Formatter &operator<<( Formatter &f, char c );
229 Formatter &operator<<( Formatter &rOut, unsigned char c ); 231 Formatter &operator<<( Formatter &f, unsigned char c );
230 Formatter &operator<<( Formatter &rOut, signed short i ); 232 Formatter &operator<<( Formatter &f, signed short i );
231 Formatter &operator<<( Formatter &rOut, unsigned short i ); 233 Formatter &operator<<( Formatter &f, unsigned short i );
232 Formatter &operator<<( Formatter &rOut, signed int i ); 234 Formatter &operator<<( Formatter &f, signed int i );
233 Formatter &operator<<( Formatter &rOut, unsigned int i ); 235 Formatter &operator<<( Formatter &f, unsigned int i );
234 Formatter &operator<<( Formatter &rOut, signed long i ); 236 Formatter &operator<<( Formatter &f, signed long i );
235 Formatter &operator<<( Formatter &rOut, unsigned long i ); 237 Formatter &operator<<( Formatter &f, unsigned long i );
236 Formatter &operator<<( Formatter &rOut, signed long long i ); 238 Formatter &operator<<( Formatter &f, signed long long i );
237 Formatter &operator<<( Formatter &rOut, unsigned long long i ); 239 Formatter &operator<<( Formatter &f, unsigned long long i );
238 Formatter &operator<<( Formatter &rOut, float f ); 240 Formatter &operator<<( Formatter &f, float flt );
239 Formatter &operator<<( Formatter &rOut, double f ); 241 Formatter &operator<<( Formatter &f, double flt );
240 Formatter &operator<<( Formatter &rOut, long double f ); 242 Formatter &operator<<( Formatter &f, long double flt );
241 Formatter &operator<<( Formatter &rOut, bool b ); 243 Formatter &operator<<( Formatter &f, bool b );
244
245 Formatter &operator>>( Formatter &f, Bu::FString &sStr );
242 246
243 template<typename type> 247 template<typename type>
244 Formatter &operator<<( Formatter &rOut, const type *p ) 248 Formatter &operator<<( Formatter &f, const type *p )
245 { 249 {
246 return rOut << "0x" << Fmt::hex(sizeof(ptrdiff_t)*2) << (ptrdiff_t)(p); 250 return f << "0x" << Fmt::hex(sizeof(ptrdiff_t)*2) << (ptrdiff_t)(p);
247 } 251 }
248}; 252};
249 253