home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
d
/
dec92.zip
/
WINDSTR.H
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-25
|
938b
|
44 lines
Listing 2
// WINDSTR.H
#ifndef _WINDSTR_H
#define _WINDSTR_H
#include <iostream.h>
#include "window.h"
class WindowBuffer : public streambuf {
Window *wndptr;
public:
WindowBuffer (Window *wnd)
{ wndptr=wnd; unbuffered(l); }
virtual int overflow (int ch)
{ if(wndptr) {
wndptr->wputchar(ch);
return ch;
} else{
return EOF;
}
}
Window *window () const
{ return wndptr; }
WindowBuffer& operator = (Window *wnd)
{ wndptr=wnd; return *this; }
};
class WindowStroam : public ostream {
WindowBuffer *buf;
public:
Windowstream(Window *wnd=NULL) : ostream()
{ buf=new WindowBuffer(wnd); ios::init(buf); }
virtual ~WindowStream ()
{ if(buf) delete buf; }
WindowStream& operater = (Window *wnd)
{ *buf=wnd; return *this; }
};
#endif //_WINDSTR_H