Ceylan::System::Stream Class Reference

Abstract stream class used in IPC. More...

#include <CeylanStream.h>

Inheritance diagram for Ceylan::System::Stream:
Inheritance graph
[legend]
Collaboration diagram for Ceylan::System::Stream:
Collaboration graph
[legend]

List of all members.

Classes

class  CloseException
 Exception thrown when a stream operation failed. More...
class  NonBlockingNotSupportedException
 Exception thrown when a stream is set to non-blocking whereas it failed or is not supported at all. More...
class  StreamException
 Exception thrown when a stream operation failed. More...

Public Types

enum  TextOutputFormat { rawText, html }
 

Defines what text output formats for TextDisplayable instances are available.

More...

Public Member Functions

 Stream (bool blocking=true)
 Basic constructor for stream instances.
virtual ~Stream () throw ()
 Basic virtual destructor.
bool isBlocking () const
 Tells whether this stream is in blocking mode (if true), or in non-blocking mode (if false).
virtual bool close ()=0
 Closes the stream.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const =0
 Returns an user-friendly description of the state of this object.

Static Public Member Functions

static bool Close (FileDescriptor &fd)
 Closes and zeroes the specified file descriptor.
static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Protected Member Functions

virtual void setBlocking (bool newStatus)
 Sets the blocking mode of this stream.

Protected Attributes

bool _isBlocking
 Stores whether the stream is in blocking mode.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

 Stream (const Stream &source)
 Copy constructor made private to ensure that it will be never called.
Streamoperator= (const Stream &source)
 Assignment operator made private to ensure that it will be never called.

Detailed Description

Abstract stream class used in IPC.

See also:
InputStream, Stream.

Definition at line 65 of file CeylanStream.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

Stream::Stream ( bool  blocking = true  )  [explicit]

Basic constructor for stream instances.

Parameters:
blocking tells whether this stream should be created in blocking mode (the default) or in non-blocking mode (if supported).

Definition at line 79 of file CeylanStream.cc.

Stream::~Stream (  )  throw () [virtual]

Basic virtual destructor.

Definition at line 86 of file CeylanStream.cc.

Ceylan::System::Stream::Stream ( const Stream source  )  [private]

Copy constructor made private to ensure that it will be never called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

bool Stream::Close ( FileDescriptor fd  )  [static]

Closes and zeroes the specified file descriptor.

It is passed by address so that this function can set it to zero on successful close.

Returns:
true iff an operation had to be performed.
Exceptions:
CloseException if the close operation failed.

Definition at line 114 of file CeylanStream.cc.

References close(), generalUtils::false, Ceylan::toString(), and generalUtils::true.

Referenced by Ceylan::System::StandardFile::close(), Ceylan::Network::Socket::close(), Ceylan::System::Pipe::close(), and Ceylan::System::LibfatFile::close().

virtual bool Ceylan::System::Stream::close (  )  [pure virtual]

Closes the stream.

Returns:
true iff an operation had to be performed.
Exceptions:
CloseException if the close operation failed.

Implemented in Ceylan::Network::Socket, Ceylan::System::File, Ceylan::System::LibfatFile, Ceylan::System::MemoryStream, Ceylan::System::Pipe, and Ceylan::System::StandardFile.

Referenced by Close().

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]
bool Stream::isBlocking (  )  const

Tells whether this stream is in blocking mode (if true), or in non-blocking mode (if false).

Definition at line 93 of file CeylanStream.cc.

References _isBlocking.

Referenced by Ceylan::Network::StreamSocket::createSocket(), and Ceylan::Network::Socket::toString().

Stream& Ceylan::System::Stream::operator= ( const Stream source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void Stream::setBlocking ( bool  newStatus  )  [protected, virtual]

Sets the blocking mode of this stream.

Parameters:
newStatus if true, sets the stream in blocking mode, if false set to non-blocking mode. If the stream is already in the target state, nothing is done.
Exceptions:
NonBlockingNotSupportedException if the operation failed or is not supported.
Note:
This default implementation always raises its exception, streams that supports non-blocking access have to override it.

Reimplemented in Ceylan::Network::Socket, and Ceylan::Network::StreamSocket.

Definition at line 175 of file CeylanStream.cc.

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const std::string Stream::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [pure virtual]

Member Data Documentation

Stores whether the stream is in blocking mode.

Definition at line 221 of file CeylanStream.h.

Referenced by isBlocking(), Ceylan::Network::StreamSocket::setBlocking(), Ceylan::Network::Socket::setBlocking(), and toString().

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 13:43:10 2010 for Ceylan by  doxygen 1.6.3