22 #ifndef TITANIC_MESSAGE_TARGET_H 23 #define TITANIC_MESSAGE_TARGET_H 25 #include "titanic/core/saveable_object.h" 32 typedef bool (CMessageTarget::*PMSG)(CMessage *msg);
40 const MSGMAP *(* pFnGetBaseMap)();
44 #define DECLARE_MESSAGE_MAP \ 46 static const MSGMAP *getThisMessageMap(); \ 47 const MSGMAP *getMessageMap() const override 49 #define BEGIN_MESSAGE_MAP(theClass, baseClass) \ 50 const MSGMAP *theClass::getMessageMap() const \ 51 { return getThisMessageMap(); } \ 52 const MSGMAP *theClass::getThisMessageMap() \ 54 typedef theClass ThisClass; \ 55 typedef baseClass TheBaseClass; \ 56 typedef bool (theClass::*FNPTR)(CMessage *msg); \ 57 static const MSGMAP_ENTRY _messageEntries[] = { 59 #define ON_MESSAGE(msgClass) \ 60 { static_cast<PMSG>((FNPTR)&ThisClass::msgClass), &C##msgClass::_type }, 62 #define END_MESSAGE_MAP() \ 63 { (PMSG)nullptr, nullptr } \ 65 static const MSGMAP messageMap = \ 66 { &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \ 70 #define EMPTY_MESSAGE_MAP(theClass, baseClass) \ 71 const MSGMAP *theClass::getMessageMap() const \ 72 { return getThisMessageMap(); } \ 73 const MSGMAP *theClass::getThisMessageMap() \ 75 typedef baseClass TheBaseClass; \ 76 static const MSGMAP_ENTRY _messageEntries[] = { \ 77 { (PMSG)nullptr, nullptr } \ 79 static const MSGMAP messageMap = \ 80 { &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \ 87 static const MSGMAP *getThisMessageMap();
88 virtual const MSGMAP *getMessageMap()
const;
96 void save(
SimpleFile *file,
int indent)
override;
Definition: simple_file.h:49
Definition: saveable_object.h:35
Definition: message_target.h:34
Definition: message_target.h:39
Definition: saveable_object.h:58
Definition: message_target.h:85