PUMA Library Reference Manual
Puma::ErrorStream Class Reference

#include <Puma/ErrorStream.h>

+ Inheritance diagram for Puma::ErrorStream:

Description

An error stream is a special ErrorSink that prints out an error message as soon as it is complete.

It also stores the maximum error severity. The error stream can be reset to its initial state.

Public Member Functions

 ErrorStream (std::ostream &out=std::cerr)
 Constructor. More...
 
virtual ~ErrorStream ()
 Destructor. More...
 
ErrorStreamoperator<< (const char *str)
 Add given string to current error message. More...
 
ErrorStreamoperator<< (long value)
 Add given long integer value to current error message. More...
 
ErrorStreamoperator<< (unsigned value)
 Add given unsigned integer value to current error message. More...
 
ErrorStreamoperator<< (int value)
 Add given signed integer value to current error message. More...
 
ErrorStreamoperator<< (short value)
 Add given short integer value to current error message. More...
 
ErrorStreamoperator<< (char c)
 Add given character to current error message. More...
 
ErrorStreamoperator<< (double value)
 Add given floating point value to current error message. More...
 
ErrorStreamoperator<< (const ErrorSeverity &sev)
 Change the severity of the current error message. More...
 
ErrorStreamoperator<< (Location location)
 Set the location the error occurred. More...
 
ErrorStreamoperator<< (const Printable &obj)
 Add the serialized value of the given object to the current error message. More...
 
ErrorStreamoperator<< (void(*fct)(ErrorSink &))
 Apply the given stream manipulator. More...
 
void endMessage ()
 Finish the current error message. More...
 
void reset ()
 Reset the error stream to its initial state. More...
 
bool silent ()
 Turn to silent mode. More...
 
bool loud ()
 Turn to loud mode. More...
 
ErrorSeverity severity () const
 Get the current error severity. More...
 
void severity (ErrorSeverity &sev)
 Set a new severity for all following messages. More...
 
- Public Member Functions inherited from Puma::ErrorSink
virtual ~ErrorSink ()
 Destructor. More...
 

Constructor & Destructor Documentation

Puma::ErrorStream::ErrorStream ( std::ostream &  out = std::cerr)
inline

Constructor.

Parameters
outThe output stream to use. Defaults to std::cerr.
virtual Puma::ErrorStream::~ErrorStream ( )
inlinevirtual

Destructor.

Member Function Documentation

void Puma::ErrorStream::endMessage ( )
virtual

Finish the current error message.

Implements Puma::ErrorSink.

bool Puma::ErrorStream::loud ( )

Turn to loud mode.

In loud mode messages are printed on the output stream. This is the default mode.

Returns
True if the previous mode was loud already.
ErrorStream& Puma::ErrorStream::operator<< ( const char *  str)
virtual

Add given string to current error message.

Parameters
strThe string to add.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

ErrorStream& Puma::ErrorStream::operator<< ( long  value)
virtual

Add given long integer value to current error message.

Parameters
valueThe value to add.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

ErrorStream& Puma::ErrorStream::operator<< ( unsigned  value)
virtual

Add given unsigned integer value to current error message.

Parameters
valueThe value to add.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

ErrorStream& Puma::ErrorStream::operator<< ( int  value)
virtual

Add given signed integer value to current error message.

Parameters
valueThe value to add.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

ErrorStream& Puma::ErrorStream::operator<< ( short  value)
virtual

Add given short integer value to current error message.

Parameters
valueThe value to add.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

ErrorStream& Puma::ErrorStream::operator<< ( char  c)
virtual

Add given character to current error message.

Parameters
cThe character to add.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

ErrorStream& Puma::ErrorStream::operator<< ( double  value)
virtual

Add given floating point value to current error message.

Parameters
valueThe value to add.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

ErrorStream& Puma::ErrorStream::operator<< ( const ErrorSeverity sev)
virtual

Change the severity of the current error message.

Parameters
sevThe new severity.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

ErrorStream& Puma::ErrorStream::operator<< ( Location  location)
virtual

Set the location the error occurred.

Parameters
locationThe error location.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

ErrorStream& Puma::ErrorStream::operator<< ( const Printable obj)
virtual

Add the serialized value of the given object to the current error message.

Parameters
objThe object to serialize.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

ErrorStream& Puma::ErrorStream::operator<< ( void(*)(ErrorSink &)  fct)
virtual

Apply the given stream manipulator.

Parameters
fctThe stream manipulator function.
Returns
A reference to this error stream.

Implements Puma::ErrorSink.

void Puma::ErrorStream::reset ( )

Reset the error stream to its initial state.

ErrorSeverity Puma::ErrorStream::severity ( ) const
inline

Get the current error severity.

Returns
The error severity.
void Puma::ErrorStream::severity ( ErrorSeverity sev)
inline

Set a new severity for all following messages.

Parameters
sevThe new severity.
bool Puma::ErrorStream::silent ( )

Turn to silent mode.

In silent mode no message is printed on the output stream.

Returns
True if the previous mode was silent already.