UtiLite
0.3.1
A lite utilities library
|
#include <UEvent.h>
Inherited by UAudioEvent, UImageEvent, ULogEvent, and UObjDeletedEvent.
Public Member Functions | |
virtual std::string | getClassName () const =0 |
int | getCode () const |
Protected Member Functions | |
UEvent (int code=0) | |
Private Attributes | |
int | code_ |
This is the base class for all events used with the UEventsManager. Inherited classes must redefined the virtual method getClassName() to return their class name.
Example:
class MyEvent : public UEvent { public: MyEvent() {} virtual ~MyEvent() {} std::string getClassName() const {return "MyEvent";} }; int main(int argc, char * argv[]) { ... UEventsManager::post(new MyEvent()); // UEventsManager take ownership of the event (deleted by UEventsManager). ... }
UEvent::UEvent | ( | int | code = 0 | ) | [inline, protected] |
code | the event code. TODO : Remove the code, not required for most of all implemented events |
virtual std::string UEvent::getClassName | ( | ) | const [pure virtual] |
This method is used to get the class name of the event. For example, if a class MouseEvent inherits from UEvent, it must return the "MouseEvent" string.
Implemented in ULogEvent, UImageEvent, UAudioEvent, and UObjDeletedEvent.
int UEvent::getCode | ( | ) | const [inline] |
Get event's code.
int UEvent::code_ [private] |
The event's code.