00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_STREAM_H_
00028 #define CEYLAN_STREAM_H_
00029
00030
00031 #include "CeylanTextDisplayable.h"
00032 #include "CeylanSystem.h"
00033
00034
00035 #include <string>
00036
00037
00038
00039
00040 namespace Ceylan
00041 {
00042
00043
00044 namespace System
00045 {
00046
00047
00048
00055 typedef int StreamID ;
00056
00057
00058
00065 class CEYLAN_DLL Stream : public Ceylan::TextDisplayable
00066 {
00067
00068
00069 public:
00070
00071
00072
00074 class StreamException : public Ceylan::System::IOException
00075 {
00076 public:
00077
00078 explicit StreamException(
00079 const std::string & reason ) :
00080 IOException( reason )
00081 {
00082
00083 }
00084
00085 } ;
00086
00087
00088
00090 class CloseException : public StreamException
00091 {
00092 public:
00093
00094 explicit CloseException(
00095 const std::string & reason ) :
00096 StreamException( reason )
00097 {
00098
00099 }
00100
00101 } ;
00102
00103
00104
00110 class NonBlockingNotSupportedException:
00111 public StreamException
00112 {
00113 public:
00114
00115 explicit NonBlockingNotSupportedException(
00116 const std::string & reason ) :
00117 StreamException( reason )
00118 {
00119
00120 }
00121
00122 } ;
00123
00124
00125
00126
00135 explicit Stream( bool blocking = true ) ;
00136
00137
00138
00140 virtual ~Stream() throw() ;
00141
00142
00143
00149 bool isBlocking() const ;
00150
00151
00152
00161 virtual bool close() = 0 ;
00162
00163
00164
00177 virtual const std::string toString(
00178 Ceylan::VerbosityLevels level = Ceylan::high ) const = 0 ;
00179
00180
00181
00192 static bool Close( FileDescriptor & fd ) ;
00193
00194
00195
00196
00197
00198 protected:
00199
00200
00201
00217 virtual void setBlocking( bool newStatus ) ;
00218
00219
00221 bool _isBlocking ;
00222
00223
00224
00225
00226 private:
00227
00228
00229
00238 Stream( const Stream & source ) ;
00239
00240
00249 Stream & operator = ( const Stream & source ) ;
00250
00251
00252 } ;
00253
00254
00255 }
00256
00257 }
00258
00259
00260
00261 #endif // CEYLAN_STREAM_H_
00262