00001 #ifndef CLASSLIB_IO_CHANNEL_STREAM_BUF_H 00002 # define CLASSLIB_IO_CHANNEL_STREAM_BUF_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "classlib/iotools/CustomStreamBuf.h" 00007 # include "classlib/iotools/ReadBuffer.h" 00008 # include "classlib/iotools/WriteBuffer.h" 00009 00010 namespace lat { 00011 //<<<<<< PUBLIC DEFINES >>>>>> 00012 //<<<<<< PUBLIC CONSTANTS >>>>>> 00013 //<<<<<< PUBLIC TYPES >>>>>> 00014 00015 class IOChannel; 00016 00017 //<<<<<< PUBLIC VARIABLES >>>>>> 00018 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00019 //<<<<<< CLASS DECLARATIONS >>>>>> 00020 00021 class IOChannelStreamBuf : public CustomStreamBuf 00022 { 00023 public: 00024 IOChannelStreamBuf (IOChannel *data = 0); 00025 ~IOChannelStreamBuf (void); 00026 00027 virtual IOChannel * channel (void); 00028 virtual void attach (IOChannel *to); 00029 virtual bool attached (void) const; 00030 virtual void detach (void); 00031 virtual bool close (void); 00032 00033 virtual size_type showmanyc (void); 00034 virtual int_type overflow (int_type c = CLASSLIB_STREAM_EOF); 00035 virtual int_type underflow (void); 00036 virtual int_type uflow (void); 00037 virtual int_type pbackfail (int_type c = CLASSLIB_STREAM_EOF); 00038 virtual int_type sync (void); 00039 00040 virtual size_type xsputn (const char_type *data, size_type length); 00041 virtual size_type xsgetn (char_type *data, size_type length); 00042 00043 private: 00044 bool syncwrite (void); 00045 size_type writable (void); 00046 size_type refill (void); 00047 00048 IOChannel *m_data; 00049 ReadBuffer m_rbuffer; 00050 WriteBuffer m_wbuffer; 00051 }; 00052 00053 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00054 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00055 00056 } // namespace lat 00057 #endif // CLASSLIB_IO_CHANNEL_STREAM_BUF_H