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

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.