PUMA Library Reference Manual
Puma::ErrorCollector Class Reference

#include <Puma/ErrorCollector.h>

+ Inheritance diagram for Puma::ErrorCollector:

Description

Error stream implementation that collects all messages in an internal message stack. Messages are finished with the Puma::endMessage stream manipulator. Collected messages can be shifted to another ErrorSink.

Public Member Functions

 ErrorCollector ()
 Constructor. More...
 
virtual ~ErrorCollector ()
 Destructor. More...
 
ErrorCollectoroperator<< (const char *str)
 Add given string to current error message. More...
 
ErrorCollectoroperator<< (long value)
 Add given long integer value to current error message. More...
 
ErrorCollectoroperator<< (unsigned value)
 Add given unsigned integer value to current error message. More...
 
ErrorCollectoroperator<< (int value)
 Add given signed integer value to current error message. More...
 
ErrorCollectoroperator<< (short value)
 Add given short integer value to current error message. More...
 
ErrorCollectoroperator<< (char c)
 Add given character to current error message. More...
 
ErrorCollectoroperator<< (double value)
 Add given floating point value to current error message. More...
 
ErrorCollectoroperator<< (const ErrorSeverity &severity)
 Change the severity of the current error message. More...
 
ErrorCollectoroperator<< (Location location)
 Set the location the error occurred. More...
 
ErrorCollectoroperator<< (const Printable &obj)
 Add the serialized value of the given object to the current error message. More...
 
ErrorCollectoroperator<< (void(*fct)(ErrorSink &))
 Apply the given stream manipulator. More...
 
void endMessage ()
 Finish the current error message. More...
 
int index ()
 Get the index of the current error message on the message stack. More...
 
void index (int idx)
 Set the index of the current error message on the message stack. More...
 
void shift (ErrorSink &dest)
 Shift all collected messages to the destination error sink. More...
 
const ErrorSeverityseverity () const
 Get the current error severity of the stream. More...
 
- Public Member Functions inherited from Puma::ErrorSink
virtual ~ErrorSink ()
 Destructor. More...
 

Constructor & Destructor Documentation

◆ ErrorCollector()

Puma::ErrorCollector::ErrorCollector ( )
inline

Constructor.

◆ ~ErrorCollector()

virtual Puma::ErrorCollector::~ErrorCollector ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ endMessage()

void Puma::ErrorCollector::endMessage ( )
virtual

Finish the current error message.

Implements Puma::ErrorSink.

◆ index() [1/2]

int Puma::ErrorCollector::index ( )

Get the index of the current error message on the message stack.

Returns
The index of the current error message.

◆ index() [2/2]

void Puma::ErrorCollector::index ( int  idx)

Set the index of the current error message on the message stack.

If the new index is less than the current number of messages on the stack, all messages with an index greater than the given index are dropped. If the new index is 0 then all previously collected messages are dropped.

Parameters
idxThe new index.

◆ operator<<() [1/11]

ErrorCollector& Puma::ErrorCollector::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]

ErrorCollector& Puma::ErrorCollector::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]

ErrorCollector& Puma::ErrorCollector::operator<< ( const ErrorSeverity severity)
virtual

Change the severity of the current error message.

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

Implements Puma::ErrorSink.

◆ operator<<() [4/11]

ErrorCollector& Puma::ErrorCollector::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]

ErrorCollector& Puma::ErrorCollector::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]

ErrorCollector& Puma::ErrorCollector::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]

ErrorCollector& Puma::ErrorCollector::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]

ErrorCollector& Puma::ErrorCollector::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]

ErrorCollector& Puma::ErrorCollector::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]

ErrorCollector& Puma::ErrorCollector::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]

ErrorCollector& Puma::ErrorCollector::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.

◆ severity()

const ErrorSeverity& Puma::ErrorCollector::severity ( ) const

Get the current error severity of the stream.

Returns
A reference to the current error severity.

◆ shift()

void Puma::ErrorCollector::shift ( ErrorSink dest)

Shift all collected messages to the destination error sink.

Parameters
destThe destination error sink.