GluonCore::GluonObjectFactory Class Reference

Create and manipulate GluonObjects by reference and name. More...

#include <gluonobjectfactory.h>

Inheritance diagram for GluonCore::GluonObjectFactory:
GluonCore::Singleton< GluonObjectFactory > QObject

List of all members.

Public Member Functions

template<class T >
void registerObjectType ()
GluonObjectinstantiateObjectByName (const QString &objectTypeName)
GluonObjectinstantiateObjectByMimetype (const QString &objectMimeType)
QVariant wrapObject (const QVariant &original, GluonObject *newValue)
QVariant wrapObject (const QString &type, GluonObject *newValue)
GluonObjectwrappedObject (const QVariant &wrappedObject)
void loadPlugins ()
QStringList objectTypeNames () const
QStringList objectMimeTypes () const
QHash< QString, const
QMetaObject * > 
objectTypes () const
const QHash< QString, int > objectTypeIDs () const

Detailed Description

Create and manipulate GluonObjects by reference and name.

The GluonObjectFactory provides functionality not just for creating objects, but also assists in extending QVariant with functionality for handling objects with inherited classes.

Definition at line 42 of file gluonobjectfactory.h.


Member Function Documentation

GluonObject * GluonObjectFactory::instantiateObjectByMimetype ( const QString &  objectMimeType  ) 

Create a new object which is capable of handling the passed mime type

Parameters:
objectMimeType The string representation of the mimetype you wish to be able to handle
Returns:
An object of the appropriate type, or null if there is no suitable class in the factory

Definition at line 99 of file gluonobjectfactory.cpp.

GluonObject * GluonObjectFactory::instantiateObjectByName ( const QString &  objectTypeName  ) 

Create a new object with the class name indicated by the passed string

Parameters:
objectTypeName The name of the class you want an instance of
Returns:
An object of the appropriate type, or null if no such class was found in the factory

Definition at line 67 of file gluonobjectfactory.cpp.

void GluonObjectFactory::loadPlugins (  ) 

Request a reload of the factory's plugins

Definition at line 166 of file gluonobjectfactory.cpp.

QStringList GluonObjectFactory::objectMimeTypes (  )  const

A list of all the mimetypes supported by the factory

Returns:
The list of all supported mimetypes

Definition at line 61 of file gluonobjectfactory.cpp.

const QHash< QString, int > GluonObjectFactory::objectTypeIDs (  )  const

A hash containing the QMetaType object IDs for all the classes registered in the factory. The key is the class name, and the value is the ID

Returns:
The hash as described

Definition at line 55 of file gluonobjectfactory.cpp.

QStringList GluonObjectFactory::objectTypeNames (  )  const

A list of all the names of the classes in the factory

Returns:
The list of all the classes the factory can accept

Definition at line 37 of file gluonobjectfactory.cpp.

QHash< QString, const QMetaObject * > GluonObjectFactory::objectTypes (  )  const

A hash containing all the metaobjects of all the classes in the factory. The key is the class name, and the value is the metaobject.

Returns:
The hash as described

Definition at line 49 of file gluonobjectfactory.cpp.

template<class T >
void GluonCore::GluonObjectFactory::registerObjectType (  )  [inline]

Definition at line 48 of file gluonobjectfactory.h.

QVariant GluonObjectFactory::wrapObject ( const QString &  type,
GluonObject newValue 
)

Wrap the passed GluonObject in a QVariant of the named type. This enables a property to retain its type when changing its value along a class inheritance chain.

Parameters:
type The name of the type the QVariant should be
Parameters:
newValue The object you wish to have wrapped in a QVariant of the specified type
Returns:
The appropriate QVariant, or an invalid QVariant if the type was not found in the factory

Definition at line 127 of file gluonobjectfactory.cpp.

QVariant GluonObjectFactory::wrapObject ( const QVariant &  original,
GluonObject newValue 
)

Wrap the passed GluonObject in a QVariant of the same type as the passed QVariant. This enables a property to retain its type when changing its value along a class inheritance chain.

Parameters:
original The original value of the property
Parameters:
newValue The new value of the reference property
Returns:
The object wrapped in a suitably typed QVariant

Definition at line 105 of file gluonobjectfactory.cpp.

GluonObject * GluonObjectFactory::wrappedObject ( const QVariant &  wrappedObject  ) 

Get the GluonObject wrapped inside the passed QVariant

Parameters:
wrappedObject A GluonObject wrapped inside a QVariant
Returns:
The GluonObject wrapped by the QVariant, or null if there is no valid GluonObject inside it

Definition at line 146 of file gluonobjectfactory.cpp.


The documentation for this class was generated from the following files:
Generated on Mon Dec 27 13:13:42 2010 for Gluon by  doxygen 1.6.3