#include <CeylanOutputStream.h>
Classes | |
class | OutputStreamException |
Exception thrown when an operation on an OutputStream failed. More... | |
class | WriteFailedException |
Exception thrown when a write operation failed. More... | |
Public Types | |
enum | TextOutputFormat { rawText, html } |
Defines what text output formats for TextDisplayable instances are available. More... | |
Public Member Functions | |
OutputStream (bool blocking=true) | |
Basic constructor for OutputStream. | |
virtual | ~OutputStream () throw () |
Basic destructor. | |
virtual StreamID | getOutputStreamID () const =0 |
Returns the output stream's unique ID. | |
virtual Size | write (const std::string &message) |
Writes message to this OutputStream. | |
virtual Size | write (const Ceylan::Byte *buffer, Size length) |
Writes up to maxLength bytes from the specified buffer to this OutputStream. | |
virtual void | writeSint8 (Ceylan::Sint8 toWrite) |
Writes a Ceylan::Sint8 to this output stream. | |
virtual void | writeUint8 (Ceylan::Uint8 toWrite) |
Writes a Ceylan::Uint8 to this output stream. | |
virtual void | writeSint16 (Ceylan::Sint16 toWrite) |
Writes a Ceylan::Sint16 to this output stream. | |
virtual void | writeUint16 (Ceylan::Uint16 toWrite) |
Writes a Ceylan::Uint16 to this output stream. | |
virtual void | writeSint32 (Ceylan::Sint32 toWrite) |
Writes a Ceylan::Sint32 to this output stream. | |
virtual void | writeUint32 (Ceylan::Uint32 toWrite) |
Writes a Ceylan::Uint32 to this output stream. | |
virtual void | writeFloat32 (Ceylan::Float32 toWrite) |
Writes a Ceylan::Uint32 to this output stream. | |
virtual void | writeFloat64 (Ceylan::Float64 toWrite) |
Writes a Ceylan::Uint32 to this output stream. | |
virtual void | writeString (const std::string &toWrite) |
Writes a string to this output stream. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
Returns an user-friendly description of the state of this object. | |
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. | |
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 | |
OutputStream (const OutputStream &source) | |
Copy constructor made private to ensure that it will be never called. | |
OutputStream & | operator= (const OutputStream &source) |
Assignment operator made private to ensure that it will be never called. |
Definition at line 57 of file CeylanOutputStream.h.
enum Ceylan::TextDisplayable::TextOutputFormat [inherited] |
Defines what text output formats for TextDisplayable instances are available.
Definition at line 124 of file CeylanTextDisplayable.h.
OutputStream::OutputStream | ( | bool | blocking = true |
) | [explicit] |
Basic constructor for OutputStream.
blocking | tells whether this output stream should be created in blocking mode (the default) or in non-blocking mode (if supported). |
Definition at line 52 of file CeylanOutputStream.cc.
OutputStream::~OutputStream | ( | ) | throw () [virtual] |
Ceylan::System::OutputStream::OutputStream | ( | const OutputStream & | 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.
bool Stream::Close | ( | FileDescriptor & | fd | ) | [static, inherited] |
Closes and zeroes the specified file descriptor.
It is passed by address so that this function can set it to zero on successful close.
CloseException | if the close operation failed. |
Definition at line 114 of file CeylanStream.cc.
References Ceylan::System::Stream::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, inherited] |
Closes the stream.
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 Ceylan::System::Stream::Close().
TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat | ( | ) | [static, inherited] |
Returns the current overall text format to be used by TextDisplayable instances.
Definition at line 63 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::formatStringList(), Ceylan::formatStringMap(), Ceylan::XML::XMLMarkup::toString(), Ceylan::Maths::Linear::Vector3::toString(), Ceylan::Maths::Linear::Vector2::toString(), Ceylan::Maths::Linear::Tripoint::toString(), Ceylan::Module::toString(), Ceylan::Maths::Linear::Matrix3::toString(), Ceylan::Maths::Linear::Matrix2::toString(), Ceylan::Maths::Linear::HomogeneousMatrix3::toString(), and Ceylan::Maths::Linear::Bipoint::toString().
virtual StreamID Ceylan::System::OutputStream::getOutputStreamID | ( | ) | const [pure virtual] |
Returns the output stream's unique ID.
OutputStreamException | if the operation failed, for example if this output stream has not received a valid identifier yet. |
Implemented in Ceylan::Network::Socket, Ceylan::System::File, Ceylan::System::MemoryStream, and Ceylan::System::Pipe.
Referenced by Ceylan::System::Process::RedirectStderr(), Ceylan::System::Process::RedirectStdout(), and toString().
bool Stream::isBlocking | ( | ) | const [inherited] |
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 Ceylan::System::Stream::_isBlocking.
Referenced by Ceylan::Network::StreamSocket::createSocket(), and Ceylan::Network::Socket::toString().
OutputStream& Ceylan::System::OutputStream::operator= | ( | const OutputStream & | 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, inherited] |
Sets the blocking mode of this stream.
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. |
NonBlockingNotSupportedException | if the operation failed or is not supported. |
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.
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.
displayables | a list of pointers to TextDisplayable instances/ | |
level | the requested verbosity level. |
Definition at line 45 of file CeylanTextDisplayable.cc.
References Ceylan::formatStringList().
const std::string OutputStream::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Implements Ceylan::System::Stream.
Reimplemented in Ceylan::Network::AnonymousProtocolAwareStreamSocket, Ceylan::Network::AnonymousStreamSocket, Ceylan::Network::ClientStreamSocket, Ceylan::Network::MultiplexedProtocolBasedStreamServer, Ceylan::Network::MultiplexedServerStreamSocket, Ceylan::Network::SequentialServerStreamSocket, Ceylan::Network::ServerStreamSocket, Ceylan::Network::Socket, Ceylan::Network::StreamSocket, Ceylan::System::AnonymousInputOutputStream, Ceylan::System::File, Ceylan::System::InputOutputStream, Ceylan::System::LibfatFile, Ceylan::System::MemoryStream, and Ceylan::System::StandardFile.
Definition at line 318 of file CeylanOutputStream.cc.
References getOutputStreamID().
Referenced by Ceylan::XML::XMLSavingVisitor::toString().
Size OutputStream::write | ( | const Ceylan::Byte * | buffer, | |
Size | length | |||
) | [virtual] |
Writes up to maxLength bytes from the specified buffer to this OutputStream.
buffer | the buffer where to find bytes that must be written. Its size must be at least 'length' bytes. | |
length | the maximum number of bytes that should be read. |
WriteFailedException | if a write error occurred. |
Reimplemented in Ceylan::Network::Socket, Ceylan::System::File, Ceylan::System::LibfatFile, Ceylan::System::MemoryStream, Ceylan::System::Pipe, and Ceylan::System::StandardFile.
Definition at line 78 of file CeylanOutputStream.cc.
Size OutputStream::write | ( | const std::string & | message | ) | [virtual] |
Writes message to this OutputStream.
message | the message to write. |
WriteFailed | if a write error occurred. |
Reimplemented in Ceylan::Network::Socket, Ceylan::System::File, Ceylan::System::LibfatFile, Ceylan::System::MemoryStream, Ceylan::System::Pipe, and Ceylan::System::StandardFile.
Definition at line 67 of file CeylanOutputStream.cc.
Referenced by Ceylan::XML::XMLSavingVisitor::decrementHeight(), Ceylan::XML::XMLText::saveTo(), Ceylan::XML::XMLMarkup::saveTo(), Ceylan::XML::XMLSavingVisitor::visit(), writeFloat32(), writeFloat64(), writeSint16(), writeSint32(), writeSint8(), writeString(), writeUint16(), writeUint32(), and writeUint8().
void OutputStream::writeFloat32 | ( | Ceylan::Float32 | toWrite | ) | [virtual] |
Writes a Ceylan::Uint32 to this output stream.
WriteFailedException | in case a system error occured. |
Definition at line 219 of file CeylanOutputStream.cc.
References ceylan_bswap_32, and write().
Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeFloat32().
void OutputStream::writeFloat64 | ( | Ceylan::Float64 | toWrite | ) | [virtual] |
Writes a Ceylan::Uint32 to this output stream.
WriteFailedException | in case a system error occured. |
Definition at line 247 of file CeylanOutputStream.cc.
References Ceylan::byteswap(), ceylan_bswap_64, and write().
Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeFloat64().
void OutputStream::writeSint16 | ( | Ceylan::Sint16 | toWrite | ) | [virtual] |
Writes a Ceylan::Sint16 to this output stream.
WriteFailedException | in case a system error occured. |
Definition at line 119 of file CeylanOutputStream.cc.
References ceylan_bswap_16, and write().
Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeSint16().
void OutputStream::writeSint32 | ( | Ceylan::Sint32 | toWrite | ) | [virtual] |
Writes a Ceylan::Sint32 to this output stream.
WriteFailedException | in case a system error occured. |
Definition at line 169 of file CeylanOutputStream.cc.
References ceylan_bswap_32, and write().
Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeSint32().
void OutputStream::writeSint8 | ( | Ceylan::Sint8 | toWrite | ) | [virtual] |
Writes a Ceylan::Sint8 to this output stream.
WriteFailedException | in case a system error occured. |
Definition at line 89 of file CeylanOutputStream.cc.
References write().
Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeSint8().
void OutputStream::writeString | ( | const std::string & | toWrite | ) | [virtual] |
Writes a string to this output stream.
toWrite | the string to write to this output stream. |
WriteFailedException | in case a system error occured. |
Definition at line 286 of file CeylanOutputStream.cc.
References Ceylan::Log::LogPlug::debug(), Ceylan::toString(), Ceylan::Uint16Max, write(), and writeUint16().
Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeString().
void OutputStream::writeUint16 | ( | Ceylan::Uint16 | toWrite | ) | [virtual] |
Writes a Ceylan::Uint16 to this output stream.
WriteFailedException | in case a system error occured. |
Definition at line 144 of file CeylanOutputStream.cc.
References ceylan_bswap_16, and write().
Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeUint16(), and writeString().
void OutputStream::writeUint32 | ( | Ceylan::Uint32 | toWrite | ) | [virtual] |
Writes a Ceylan::Uint32 to this output stream.
WriteFailedException | in case a system error occured. |
Definition at line 194 of file CeylanOutputStream.cc.
References ceylan_bswap_32, and write().
Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeUint32().
void OutputStream::writeUint8 | ( | Ceylan::Uint8 | toWrite | ) | [virtual] |
Writes a Ceylan::Uint8 to this output stream.
WriteFailedException | in case a system error occured. |
Definition at line 104 of file CeylanOutputStream.cc.
References write().
Referenced by Ceylan::Middleware::LightWeightMarshaller::encodeUint8(), and Ceylan::XML::XMLSavingVisitor::visit().
bool Ceylan::System::Stream::_isBlocking [protected, inherited] |
Stores whether the stream is in blocking mode.
Definition at line 221 of file CeylanStream.h.
Referenced by Ceylan::System::Stream::isBlocking(), Ceylan::Network::StreamSocket::setBlocking(), Ceylan::Network::Socket::setBlocking(), and Ceylan::System::Stream::toString().
TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited] |
The text format to be used currently by TextDisplayable instances.
Definition at line 158 of file CeylanTextDisplayable.h.
Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().