00001 #ifndef WINCONSOLESTREAMBUF_H_INCLUDED 00002 #define WINCONSOLESTREAMBUF_H_INCLUDED 00003 00004 #include <streambuf> 00005 #include <ostream> 00006 00007 #ifndef _WIN32 00008 #error This file is only designed (and useful) on MsWindows 00009 #endif 00010 00011 namespace loic 00012 { 00013 00014 class WinConsoleStreamBuf: public std::streambuf 00015 { 00016 public: 00017 explicit WinConsoleStreamBuf(std::streambuf *buf); 00018 ~WinConsoleStreamBuf(); 00019 std::streambuf *setUnderlyingBuffer(std::streambuf *newBuf); 00020 00021 private: 00022 WinConsoleStreamBuf(WinConsoleStreamBuf &); 00023 WinConsoleStreamBuf& operator=(WinConsoleStreamBuf&); 00024 virtual std::streambuf* setbuf(char_type* s, std::streamsize n); 00025 00026 virtual int_type overflow(int_type c); 00027 virtual int sync(); 00028 virtual int_type underflow(); 00029 00030 00031 std::streambuf *myBuf; 00032 char myInputBuffer[2]; 00033 }; 00034 00039 struct AccentsInMsWindowsConsoleHandler 00040 { 00041 AccentsInMsWindowsConsoleHandler(); 00042 ~AccentsInMsWindowsConsoleHandler(); 00043 }; 00044 } // namespace loic 00045 00046 #endif // WINCONSOLESTREAMBUF_H_INCLUDED