other-licenses/7zstub/src/Common/StdOutStream.h

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 // Common/StdOutStream.h
     3 #ifndef __COMMON_STDOUTSTREAM_H
     4 #define __COMMON_STDOUTSTREAM_H
     6 #include <stdio.h>
     8 #include "Types.h"
    10 class CStdOutStream 
    11 {
    12   bool _streamIsOpen;
    13   FILE *_stream;
    14 public:
    15   CStdOutStream (): _streamIsOpen(false) {};
    16   CStdOutStream (FILE *stream): _streamIsOpen(false), _stream(stream) {};
    17   ~CStdOutStream ();
    18   bool Open(const char *fileName);
    19   bool Close();
    20   bool Flush();
    22   CStdOutStream & operator<<(CStdOutStream & (* aFunction)(CStdOutStream  &));
    23   CStdOutStream & operator<<(const char *string);
    24   CStdOutStream & operator<<(const wchar_t *string);
    25   CStdOutStream & operator<<(char c);
    26   CStdOutStream & operator<<(int number);
    27   CStdOutStream & operator<<(UInt64 number);
    28 };
    30 CStdOutStream & endl(CStdOutStream & outStream);
    32 extern CStdOutStream g_StdOut;
    33 extern CStdOutStream g_StdErr;
    35 #endif

mercurial