core/gluonobjectfactory.h File Reference

#include "singleton.h"
#include "gluon_core_export.h"
#include "debughelper.h"
#include <QtCore/QSharedData>
#include <QtCore/QHash>
#include <QtCore/QMetaType>

Go to the source code of this file.

Classes

class  GluonCore::GluonObjectFactory
 Create and manipulate GluonObjects by reference and name. More...
class  GluonObjectRegistration< T >
 Convenience - do not use directly A convenience class used for object registration, which should not be used directly. More...

Namespaces

namespace  GluonCore

Defines

#define REGISTER_OBJECTTYPE(NAMESPACE, NEWOBJECTTYPE)

Define Documentation

#define REGISTER_OBJECTTYPE ( NAMESPACE,
NEWOBJECTTYPE   ) 
Value:
GluonObjectRegistration<NAMESPACE :: NEWOBJECTTYPE> NAMESPACE ## NEWOBJECTTYPE ## _GluonObjectRegistration;\
    GluonCore::GluonObject * \
    NAMESPACE::NEWOBJECTTYPE::instantiate()\
    {\
        return new NAMESPACE :: NEWOBJECTTYPE();\
    }\
    GluonCore::GluonObject * \
    NAMESPACE::NEWOBJECTTYPE::fromVariant(const QVariant &wrappedObject) \
    {\
        return wrappedObject.value< NAMESPACE :: NEWOBJECTTYPE* >();\
    }\
    QVariant \
    NAMESPACE::NEWOBJECTTYPE::toVariant(GluonCore::GluonObject *wrapThis)\
    {\
        return QVariant::fromValue<NAMESPACE :: NEWOBJECTTYPE *>(qobject_cast<NAMESPACE :: NEWOBJECTTYPE*>(wrapThis));\
    }\

Use this macro to register a class with the GluonObjectFactory. It adds a number of functions used by GluonObjectFactory, so please note that you should not be adding functions with the following signatures to your class:

GluonCore::GluonObject *instantiate();

GluonCore::GluonObject *fromVariant(const QVariant &wrappedObject);

QVariant toVariant(GluonCore::GluonObject *wrapThis);

Please make sure to insert this macro at the very top of the file containing your implementation. As an example, the following is the code used to register GluonObject itself into the factory:

REGISTER_OBJECTTYPE(GluonCore, GluonObject);
See also:
GLUON_OBJECT

Definition at line 189 of file gluonobjectfactory.h.

Generated on Mon Dec 27 13:13:40 2010 for Gluon by  doxygen 1.6.3