PUMA Library Reference Manual
Loading...
Searching...
No Matches
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.
 
virtual ~ErrorStream ()
 Destructor.
 
ErrorStreamoperator<< (const char *str)
 Add given string to current error message.
 
ErrorStreamoperator<< (long value)
 Add given long integer value to current error message.
 
ErrorStreamoperator<< (unsigned value)
 Add given unsigned integer value to current error message.
 
ErrorStreamoperator<< (int value)
 Add given signed integer value to current error message.
 
ErrorStreamoperator<< (short value)
 Add given short integer value to current error message.
 
ErrorStreamoperator<< (char c)
 Add given character to current error message.
 
ErrorStreamoperator<< (double value)
 Add given floating point value to current error message.
 
ErrorStreamoperator<< (const ErrorSeverity &sev)
 Change the severity of the current error message.
 
ErrorStreamoperator<< (Location location)
 Set the location the error occurred.
 
ErrorStreamoperator<< (const Printable &obj)
 Add the serialized value of the given object to the current error message.
 
ErrorStreamoperator<< (void(*fct)(ErrorSink &))
 Apply the given stream manipulator.
 
void endMessage ()
 Finish the current error message.
 
void reset ()
 Reset the error stream to its initial state.
 
bool silent ()
 Turn to silent mode.
 
bool loud ()
 Turn to loud mode.
 
ErrorSeverity severity () const
 Get the current error severity.
 
void severity (ErrorSeverity &sev)
 Set a new severity for all following messages.
 
- Public Member Functions inherited from Puma::ErrorSink
virtual ~ErrorSink ()
 Destructor.
 

Constructor & Destructor Documentation

◆ ErrorStream()

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

Constructor.

Parameters
outThe output stream to use. Defaults to std::cerr.

◆ ~ErrorStream()

virtual Puma::ErrorStream::~ErrorStream ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ endMessage()

void Puma::ErrorStream::endMessage ( )
virtual

Finish the current error message.

Implements Puma::ErrorSink.

◆ loud()

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.

◆ operator<<() [1/11]

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.

◆ operator<<() [2/11]

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.

◆ operator<<() [3/11]

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.

◆ operator<<() [4/11]

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.

◆ operator<<() [5/11]

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.

◆ operator<<() [6/11]

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.

◆ operator<<() [7/11]

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.

◆ operator<<() [8/11]

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.

◆ operator<<() [9/11]

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.

◆ operator<<() [10/11]

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.

◆ operator<<() [11/11]

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.

◆ reset()

void Puma::ErrorStream::reset ( )

Reset the error stream to its initial state.

◆ severity() [1/2]

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

Get the current error severity.

Returns
The error severity.

◆ severity() [2/2]

void Puma::ErrorStream::severity ( ErrorSeverity & sev)
inline

Set a new severity for all following messages.

Parameters
sevThe new severity.

◆ silent()

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.