/* Copyright 1997 David Coppit. Permission to use and modify this code for research purposes is granted to provided that this copyright statement retained in all derivative software. Many thanks to Dietmar Kuehl for his help. Some of this code is based on his streams examples at: http://www.informatik.uni-konstanz.de/~kuehl/c++/iostream/ This file, along with winbuff.cpp, PromptDialog.h, and PromptDialog.cpp implement a Windows MFC compatible text-based input window for cout and cin. A tutorial and more information can be found at http://www.coppit.org/soft_eng/winbuf/index.html */ #ifndef WINBUF_H #define WINBUF_H #include class PromptDialog; class winBuf: public streambuf { private: PromptDialog* m_dialog; // the I/O Dialog Box void put_buffer(void); void put_char(int); int get_buffer(); // This variable says whether a new line of input is necessary. int needInput; // One can temporarily disable output if needed. int outputEnabled; protected: int overflow(int); int underflow(); int uflow(); int sync(); public: winBuf(PromptDialog *, int = 0, int = 0); ~winBuf(); void enableOutput(); void disableOutput(); }; class winErr: public streambuf { private: void put_char(int); char* errorBuffer; unsigned int m_bufferSize; protected: int overflow(int); int underflow(); int sync(); public: winErr(int); ~winErr(); }; class inWinStream: public istream { public: inWinStream(PromptDialog *, int = 256); ~inWinStream(); private: winBuf *theWinBuf; }; class outWinStream: public ostream { public: outWinStream(PromptDialog*, int = 256); ~outWinStream(); private: winBuf *theWinBuf; }; class errWinStream: public ostream { public: errWinStream(int = 256); ~errWinStream(); private: winErr *theWinErr; }; #endif /* WINBUF_H */