#include <basicobject.h>
Collaboration diagram for BasicSlot:
Public Types | |
typedef void(*) | Callback (void *sender, BasicObject *reciever, void *data) |
Public Member Functions | |
DECLSPEC | BasicSlot (const char *fname, const char *classname, Callback func) |
virtual DECLSPEC | ~BasicSlot () |
Destructor. Frees the strName. | |
Callback | getFunction () |
| |
const char * | getName () |
| |
bool | matchName (const char *name) |
Static Public Member Functions | |
static BasicSlot * | getFirst () |
static Callback | getFunction (const char *name, const char *classname=NULL) |
Public Attributes | |
BasicSlot * | beNext |
Pointer to the next slot in the global event list. |
This class is used to get a pointer to a function when knowing its name. Slots can be assigned to a classname.
typedef void(*) BasicSlot::Callback(void *sender, BasicObject *reciever, void *data) |
Definition for callback functions. The params might be used different as described here.
sender | a pointer to the object that called the function | |
reciever | a pointer to the object of which the function is called | |
data | a pointer to anywhere, depends on how it is used |
BasicSlot::BasicSlot | ( | const char * | fname, | |
const char * | classname, | |||
Callback | func | |||
) |
Constructor.
fname | the name of the function (must not be NULL, neither contain a '#' nor a dot '.') | |
classname | the name of the class (may be NULL for global methods) | |
func | the function pointer | |
next | pointer to the next slot in the list |
bool BasicSlot::matchName | ( | const char * | name | ) | [inline] |
Checks, whether the slot's name is equal to the given parameter.
name | the name to check for equivalence |
static BasicSlot* BasicSlot::getFirst | ( | ) | [inline, static] |
BasicSlot::Callback BasicSlot::getFunction | ( | const char * | name, | |
const char * | classname = NULL | |||
) | [static] |
name | the function's name (must not be NULL), has the form: [<class>.]<function>
| |
classname | the class's name or NULL, if the function does not belong to any class |