libqutim
0.3.2.0
|
#include <objectgenerator.h>
Public Types | |
typedef QExplicitlySharedDataPointer < ObjectGeneratorHolderData > | Ptr |
Public Member Functions | |
virtual | ~ObjectGenerator () |
ObjectGenerator * | addProperty (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) |
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.
typedef QExplicitlySharedDataPointer<ObjectGeneratorHolderData> qutim_sdk_0_3::ObjectGenerator::Ptr |
qutim_sdk_0_3::ObjectGenerator::ObjectGenerator | ( | ) | [protected] |
Constructor.
virtual qutim_sdk_0_3::ObjectGenerator::~ObjectGenerator | ( | ) | [virtual] |
Destructor.
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
name | Property's name |
value | Property's value |
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.
super | Meta info of superiour class |
bool qutim_sdk_0_3::ObjectGenerator::extends | ( | const char * | id | ) | const [inline] |
Check if object implements interface.
id | Identification of interface |
bool qutim_sdk_0_3::ObjectGenerator::extends | ( | ) | const [inline] |
Check if object extends class T.
QObject* qutim_sdk_0_3::ObjectGenerator::generate | ( | ) | const [inline] |
Generate object.
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
virtual QObject* qutim_sdk_0_3::ObjectGenerator::generateHelper | ( | ) | const [protected, pure virtual] |
Generate object.
This method have to be implemented to enable object generation
Implemented in qutim_sdk_0_3::SingletonGenerator< T, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9 >, qutim_sdk_0_3::GeneralGenerator< T, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9 >, qutim_sdk_0_3::MenuActionGenerator, qutim_sdk_0_3::ActionGenerator, qutim_sdk_0_3::WidgetActionGenerator, and qutim_sdk_0_3::StatusActionGenerator.
bool qutim_sdk_0_3::ObjectGenerator::hasInterface | ( | const char * | id | ) | const |
Check if object implements interface.
id | Identification of interface |
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.
super | Meta info of superiour class |
id | Identification of needed interface |
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.
static GeneratorList qutim_sdk_0_3::ObjectGenerator::module | ( | ) | [inline, static] |
virtual void qutim_sdk_0_3::ObjectGenerator::virtual_hook | ( | int | id, |
void * | data | ||
) | [protected, virtual] |