PUMA Library Reference Manual
Loading...
Searching...
No Matches
Puma::ErrorSink Class Referenceabstract

#include <Puma/ErrorSink.h>

+ Inheritance diagram for Puma::ErrorSink:

Description

This is an interface for classes that may be used to consume error messages during a process where many errors can occur like parsing a program.

The error information is handed over to the ErrorSink in stream-like style. Different severities of errors are predefined and can be used to classify error information that follows. Also a location can be handed over to the ErrorSink to specify where the error was found (filename, line, etc.). The error information itself can be of any standard data type or anything that implements the Printable interface. An error message is finished with the Puma::endMessage stream manipulator.

Specializations of this class could either build and print error messages or collect them for a later processing.

Public Member Functions

virtual ~ErrorSink ()
 Destructor.
 
virtual ErrorSinkoperator<< (const char *str)=0
 Add given string to current error message.
 
virtual ErrorSinkoperator<< (long value)=0
 Add given long integer value to current error message.
 
virtual ErrorSinkoperator<< (unsigned value)=0
 Add given unsigned integer value to current error message.
 
virtual ErrorSinkoperator<< (int value)=0
 Add given signed integer value to current error message.
 
virtual ErrorSinkoperator<< (short value)=0
 Add given short integer value to current error message.
 
virtual ErrorSinkoperator<< (char c)=0
 Add given character to current error message.
 
virtual ErrorSinkoperator<< (double value)=0
 Add given floating point value to current error message.
 
virtual ErrorSinkoperator<< (const ErrorSeverity &severity)=0
 Change the severity of the current error message.
 
virtual ErrorSinkoperator<< (Location location)=0
 Set the location the error occurred.
 
virtual ErrorSinkoperator<< (const Printable &obj)=0
 Add the serialized value of the given object to the current error message.
 
virtual ErrorSinkoperator<< (void(*fct)(ErrorSink &))=0
 Apply the given stream manipulator.
 
virtual void endMessage ()=0
 Finish the current error message.
 

Constructor & Destructor Documentation

◆ ~ErrorSink()

virtual Puma::ErrorSink::~ErrorSink ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ endMessage()

virtual void Puma::ErrorSink::endMessage ( )
pure virtual

Finish the current error message.

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.

◆ operator<<() [1/11]

virtual ErrorSink & Puma::ErrorSink::operator<< ( char c)
pure virtual

Add given character to current error message.

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

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.

◆ operator<<() [2/11]

virtual ErrorSink & Puma::ErrorSink::operator<< ( const char * str)
pure virtual

Add given string to current error message.

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

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.

◆ operator<<() [3/11]

virtual ErrorSink & Puma::ErrorSink::operator<< ( const ErrorSeverity & severity)
pure virtual

Change the severity of the current error message.

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

Implemented in Puma::ErrorStream, and Puma::ErrorCollector.

◆ operator<<() [4/11]

virtual ErrorSink & Puma::ErrorSink::operator<< ( const Printable & obj)
pure 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.

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.

◆ operator<<() [5/11]

virtual ErrorSink & Puma::ErrorSink::operator<< ( double value)
pure virtual

Add given floating point value to current error message.

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

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.

◆ operator<<() [6/11]

virtual ErrorSink & Puma::ErrorSink::operator<< ( int value)
pure virtual

Add given signed integer value to current error message.

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

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.

◆ operator<<() [7/11]

virtual ErrorSink & Puma::ErrorSink::operator<< ( Location location)
pure virtual

Set the location the error occurred.

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

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.

◆ operator<<() [8/11]

virtual ErrorSink & Puma::ErrorSink::operator<< ( long value)
pure virtual

Add given long integer value to current error message.

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

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.

◆ operator<<() [9/11]

virtual ErrorSink & Puma::ErrorSink::operator<< ( short value)
pure virtual

Add given short integer value to current error message.

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

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.

◆ operator<<() [10/11]

virtual ErrorSink & Puma::ErrorSink::operator<< ( unsigned value)
pure virtual

Add given unsigned integer value to current error message.

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

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.

◆ operator<<() [11/11]

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

Apply the given stream manipulator.

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

Implemented in Puma::ErrorCollector, and Puma::ErrorStream.