|
stmm-input-doc
0.17.0
|
Template used to register event classes. More...
Public Member Functions | |
| RegisterClass (const char *const &p0EventClassId) noexcept | |
| Class registration constructor. More... | |
| ~RegisterClass () noexcept | |
| const Class & | getEventClass () noexcept |
| Get the class of the registered type. More... | |
Template used to register event classes.
In a subclass of Event you want to register define (ex. KeyEvent):
class KeyEvent : public Event {
public:
...
static const char* const s_sClassId;
static const Event::Class& getClass()
{
static const Event::Class s_oKeyClass = s_oInstall.getEventClass();
return s_oKeyClass;
}
private:
static RegisterClass<KeyEvent> s_oInstall;
...
}
with the instantiation
const char* const KeyEvent::s_sClassId = "KeyEvent"; // this instance registers the class! Event::RegisterClass<KeyEvent> KeyEvent::s_oInstall(s_sClassId);
Beware! No registered class should be subclass of another registered class!
|
inlineexplicitnoexcept |
Class registration constructor.
The class id must be a statically defined unique ascii string with length > 0.
| p0EventClassId | The class id. Can't be nullptr. |
|
inlinenoexcept |
|
inlinenoexcept |
Get the class of the registered type.
1.8.13