libqutim  0.3.1.0
qutim_sdk_0_3::ObjectGenerator Class Reference

#include <objectgenerator.h>

+ Inheritance diagram for qutim_sdk_0_3::ObjectGenerator:

List of all members.

Public Types

typedef
QExplicitlySharedDataPointer
< ObjectGeneratorHolderData
Ptr

Public Member Functions

virtual ~ObjectGenerator ()
ObjectGeneratoraddProperty (const QByteArray &name, const QVariant &value)
bool extends (const QMetaObject *super) const
bool extends (const char *id) const
template<typename T >
bool extends () const
QObject * generate () const
template<typename T >
T * generate () const
bool hasInterface (const char *id) const
virtual QList< QByteArray > interfaces () const
virtual const QMetaObject * metaObject () const =0
Ptr pointerHolder ()

Static Public Member Functions

static bool isInited ()
static GeneratorList module (const QMetaObject *module)
static GeneratorList module (const char *iid)
template<typename T >
static GeneratorList module ()

Protected Member Functions

 ObjectGenerator ()
virtual QObject * generateHelper () const =0
virtual void virtual_hook (int id, void *data)

Detailed Description

ObjectGenerator is general type for object initiatizations.

It's often needed to automatize process of object creation initialization. For example, it's needed to provide flexible menus for different objects, but some actions should be shown for every Contact instances, other only for every Jabber or may be ICQ contacts. Also it's needed to provide ability for customizing this actions at menu showing moment (i.e. to disable it or to provide subactions).

Another way for using ObjectGenerator is providing meta info for qutIM modules. It's needed to provide QMetaObject for object because it contains most of needed information such as parent classes, invokable methods, properties, signals, slots and so on.


Member Typedef Documentation

typedef QExplicitlySharedDataPointer<ObjectGeneratorHolderData> qutim_sdk_0_3::ObjectGenerator::Ptr

Constructor & Destructor Documentation

qutim_sdk_0_3::ObjectGenerator::ObjectGenerator ( )
protected

Constructor.

virtual qutim_sdk_0_3::ObjectGenerator::~ObjectGenerator ( )
virtual

Destructor.


Member Function Documentation

ObjectGenerator* qutim_sdk_0_3::ObjectGenerator::addProperty ( const QByteArray &  name,
const QVariant &  value 
)

Set value for property of generating objects.

For every new object, created by this generator, property name will set to value

Parameters:
nameProperty's name
valueProperty's value
Returns:
this
Note:
Properties of already created objects won't be changed to this one

Reimplemented in qutim_sdk_0_3::ActionGenerator.

bool qutim_sdk_0_3::ObjectGenerator::extends ( const QMetaObject *  super) const

Check if object extends class, represented by meta info.

Parameters:
superMeta info of superiour class
Returns:
True if generator's class extends superiour one, else false
bool qutim_sdk_0_3::ObjectGenerator::extends ( const char *  id) const
inline

Check if object implements interface.

Parameters:
idIdentification of interface
Returns:
True if object implements interface, else false
template<typename T >
bool qutim_sdk_0_3::ObjectGenerator::extends ( ) const
inline

Check if object extends class T.

Returns:
True if generator's class extends T, else false
QObject* qutim_sdk_0_3::ObjectGenerator::generate ( ) const
inline

Generate object.

template<typename T >
T* qutim_sdk_0_3::ObjectGenerator::generate ( ) const
inline

Generate object of type T.

Generator will check by meta info if generator's class can be casted to type T and only after succesful result of this check it will be created

Returns:
Generated object or null if error
virtual QObject* qutim_sdk_0_3::ObjectGenerator::generateHelper ( ) const
protectedpure virtual
bool qutim_sdk_0_3::ObjectGenerator::hasInterface ( const char *  id) const

Check if object implements interface.

Parameters:
idIdentification of interface
Returns:
True if object implements interface, else false
virtual QList<QByteArray> qutim_sdk_0_3::ObjectGenerator::interfaces ( ) const
virtual
static bool qutim_sdk_0_3::ObjectGenerator::isInited ( )
static

Function to detect if ModuleManager and it's inner data had been initialized.

virtual const QMetaObject* qutim_sdk_0_3::ObjectGenerator::metaObject ( ) const
pure virtual

Generate object.

@param super Meta info of superiour class
@return Generated object or null if object doesn't extends class
represented by superiour meta info error           
Generate object

@param id Identification of needed interface
@return Generated object or null if class doesn't implement interface       

QMetaObject class, which represents object with meta info of generator's object

Returns:
QMetaObject of generator's class

Implemented in qutim_sdk_0_3::GeneralGenerator< T, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9 >, and qutim_sdk_0_3::ActionGenerator.

static GeneratorList qutim_sdk_0_3::ObjectGenerator::module ( const QMetaObject *  module)
static

Returns list of ObjectGenerator's for extensions that match QMetaObject criterion.

static GeneratorList qutim_sdk_0_3::ObjectGenerator::module ( const char *  iid)
static

Returns list of ObjectGenerator's for extensions that match char* interfaceID.

template<typename T >
static GeneratorList qutim_sdk_0_3::ObjectGenerator::module ( )
inlinestatic
Ptr qutim_sdk_0_3::ObjectGenerator::pointerHolder ( )
virtual void qutim_sdk_0_3::ObjectGenerator::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

The documentation for this class was generated from the following file:

Generated by Doxygen