#include <include/EDoc/NotificationIFace.h>
Inheritance diagram for EDoc::NotificationIFace:
This provides functionality for notifying users of errors and warnings. It also provides a facility to filter out some warnings/errors by registering a callback function pointer that returns false if the message to be suppressed.
Definition at line 57 of file NotificationIFace.h.
Public Types | |
typedef bool(*) | AllowEventFP (void *filter_data, EventCode code, std::string ev_name, EventType ev_type, const Function *function, const File *file, uint32_t line, const File *rfile, uint32_t rline, const Type *type, const PropogatingException *prop_exc, const FunctionType *function_type, const char *extra) |
Function pointer type for the filter callback function. | |
Public Member Functions | |
NotificationIFace () | |
Constructor. | |
virtual | ~NotificationIFace () |
Destructor. | |
virtual void | Event (EventCode code, const char *source_file, unsigned int source_line, std::string message, const Function *function, const File *file, uint32_t line, const File *rfile, uint32_t rline, const Type *type, const PropogatingException *prop_exc, const FunctionType *function_type, const char *extra)=0 |
Is called upon an event to be displayed to the user. | |
virtual void | RegisterFilter (AllowEventFP fp, void *data) |
Set the filter callback function. | |
Static Public Member Functions | |
static bool | AllowEverythingFilter (void *, EventCode, std::string, EventType, const Function *, const File *, uint32_t, const File *, uint32_t, const Type *, const PropogatingException *, const FunctionType *, const char *) |
The default filter that filters out no events at all. | |
Protected Attributes | |
AllowEventFP | filter |
The currently registered function pointer. | |
void * | filter_data |
Data associated function pointer. |
typedef bool(*) EDoc::NotificationIFace::AllowEventFP(void *filter_data, EventCode code, std::string ev_name, EventType ev_type, const Function *function, const File *file, uint32_t line, const File *rfile, uint32_t rline, const Type *type, const PropogatingException *prop_exc, const FunctionType *function_type, const char *extra) |
Function pointer type for the filter callback function.
Definition at line 117 of file NotificationIFace.h.
EDoc::NotificationIFace::NotificationIFace | ( | ) | [inline] |
Constructor.
By default filter allows ALL events to be shown.
Definition at line 66 of file NotificationIFace.h.
References AllowEverythingFilter(), filter, and filter_data.
EDoc::NotificationIFace::~NotificationIFace | ( | ) | [inline, virtual] |
EDoc::NotificationIFace::Event | ( | EventCode | code, | |
const char * | source_file, | |||
unsigned int | source_line, | |||
std::string | message, | |||
const Function * | function, | |||
const File * | file, | |||
uint32_t | line, | |||
const File * | rfile, | |||
uint32_t | rline, | |||
const Type * | type, | |||
const PropogatingException * | prop_exc, | |||
const FunctionType * | function_type, | |||
const char * | extra | |||
) | [pure virtual] |
Is called upon an event to be displayed to the user.
NOTE Should use the macro EDOC_NOTIFICATION() NOT call this function directly.
The additional parameters are used in filtering. They are not used to generate any message text. Any of these parameters can be NULL, but it is preferrable that if data is associated with the event then it should be passed along so that the filtering functions can better identify individual events for filtering purposes.
As an example while running EDoc it may produce anumber of WUNIMPL warning events for a series of functions that are used but not implemented. You may wish to suppress all these WUNIMPL messages for a certain list of function names, in which case the filter function would check the function parameter, or it could choose to filter out all WUNIMPL messages where the function was declared in the <builtin> file. This would allow those WUNIMPL's to be suppressed but all others would still be emitted.
Implemented in EDoc::StdErrNotifier.
EDoc::NotificationIFace::AllowEverythingFilter | ( | void * | , | |
EDoc::EventCode | , | |||
std::string | , | |||
EDoc::EventType | , | |||
const Function * | , | |||
const File * | , | |||
uint32_t | , | |||
const File * | , | |||
uint32_t | , | |||
const Type * | , | |||
const PropogatingException * | , | |||
const FunctionType * | , | |||
const char * | ||||
) | [inline, static] |
The default filter that filters out no events at all.
Definition at line 136 of file NotificationIFace.h.
Referenced by NotificationIFace().
virtual void EDoc::NotificationIFace::RegisterFilter | ( | AllowEventFP | fp, | |
void * | data | |||
) | [inline, virtual] |
Set the filter callback function.
The callback function should return true if the event is to be processed and false if the event is to be suppressed.
fp | The function pointer that is to be called whenever an event is being generated by the Event() function being called. | |
data | This is some optional additional data that is passed to the function pointer when it is called. This can store anything. It was primarily added because additional data is required for the callback that executes a python function in the suppressions file. |
Definition at line 167 of file NotificationIFace.h.
References filter.
AllowEventFP EDoc::NotificationIFace::filter [protected] |
The currently registered function pointer.
Definition at line 180 of file NotificationIFace.h.
Referenced by EDoc::StdErrNotifier::Event(), NotificationIFace(), and RegisterFilter().
void* EDoc::NotificationIFace::filter_data [protected] |
Data associated function pointer.
Definition at line 185 of file NotificationIFace.h.
Referenced by EDoc::StdErrNotifier::Event(), and NotificationIFace().