[ create a new paste ] login | about

Link: http://codepad.org/l5mfhWMh    [ raw code | fork ]

rizzuhjj - C++, pasted on Mar 30:
#define COMPONENT(__componentClass)                                            \
    __COMPONENT_GETTYPE_FUNCTIONS(__componentClass, COMPONENT)                 \
private:                                                                       \

//------------------------------------------------------------------------------
#define COMPONENT_DERIVED(__componentClass, __baseComponentClass)              \
    __COMPONENT_GETTYPE_FUNCTIONS(__componentClass, COMPONENT_DERIVED)         \
    __COMPONENT_FULFILL_DERIVED_REQUIREMENTS(__baseComponentClass)             \
private:                                                                       \

//------------------------------------------------------------------------------
#define __COMPONENT_GETTYPE_FUNCTIONS(__componentClass, __componentMacroName)  \
public:                                                                        \
    static Type getType()                                                      \
    {                                                                          \
        return ABUniqueTypeId<__componentClass>::getTypeId();                  \
    }                                                                          \
                                                                               \
    static const char* getTypeName()                                           \
    {                                                                          \
        __componentClass::wrongTypePassedTo ## __componentMacroName();         \
        return #__componentClass;                                              \
    }                                                                          \
                                                                               \
private:                                                                       \
    static void wrongTypePassedTo ## __componentMacroName() { }                \

//------------------------------------------------------------------------------
#define __COMPONENT_FULFILL_DERIVED_REQUIREMENTS(__baseComponentClass)         \
public:                                                                        \
    typedef __baseComponentClass Super;                                        \
                                                                               \
    static Type getBaseType()                                                  \
    {                                                                          \
        return Super::getType();                                               \
    }                                                                          \
                                                                               \
protected:                                                                     \


Create a new paste based on this one


Comments: