Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | // Common/StdOutStream.h |
michael@0 | 2 | |
michael@0 | 3 | #ifndef __COMMON_STDOUTSTREAM_H |
michael@0 | 4 | #define __COMMON_STDOUTSTREAM_H |
michael@0 | 5 | |
michael@0 | 6 | #include <stdio.h> |
michael@0 | 7 | |
michael@0 | 8 | #include "Types.h" |
michael@0 | 9 | |
michael@0 | 10 | class CStdOutStream |
michael@0 | 11 | { |
michael@0 | 12 | bool _streamIsOpen; |
michael@0 | 13 | FILE *_stream; |
michael@0 | 14 | public: |
michael@0 | 15 | CStdOutStream (): _streamIsOpen(false) {}; |
michael@0 | 16 | CStdOutStream (FILE *stream): _streamIsOpen(false), _stream(stream) {}; |
michael@0 | 17 | ~CStdOutStream (); |
michael@0 | 18 | bool Open(const char *fileName); |
michael@0 | 19 | bool Close(); |
michael@0 | 20 | bool Flush(); |
michael@0 | 21 | |
michael@0 | 22 | CStdOutStream & operator<<(CStdOutStream & (* aFunction)(CStdOutStream &)); |
michael@0 | 23 | CStdOutStream & operator<<(const char *string); |
michael@0 | 24 | CStdOutStream & operator<<(const wchar_t *string); |
michael@0 | 25 | CStdOutStream & operator<<(char c); |
michael@0 | 26 | CStdOutStream & operator<<(int number); |
michael@0 | 27 | CStdOutStream & operator<<(UInt64 number); |
michael@0 | 28 | }; |
michael@0 | 29 | |
michael@0 | 30 | CStdOutStream & endl(CStdOutStream & outStream); |
michael@0 | 31 | |
michael@0 | 32 | extern CStdOutStream g_StdOut; |
michael@0 | 33 | extern CStdOutStream g_StdErr; |
michael@0 | 34 | |
michael@0 | 35 | #endif |