#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 REGISTER_OBJECTTYPE | ( | NAMESPACE, | |||
NEWOBJECTTYPE | ) |
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);
Definition at line 189 of file gluonobjectfactory.h.