All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions
Qtilities::Core::Interfaces::IFactoryProvider Class Reference

Objects managing instances of factories can implement this interface if they want to expose these factories to the object manager. More...

#include <IFactoryProvider.h>

Inheritance diagram for Qtilities::Core::Interfaces::IFactoryProvider:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual QtilitiesCategory categoryForTag (const QString &factory_name, const QString &factory_tag, bool *ok=0) const =0
 Provides the category of the specified tag.
virtual QObject * createInstance (const InstanceFactoryInfo &ifactory_data)=0
 Constructs an instance in a specified factory and return it.
virtual QStringList providedFactories () const =0
 Provides the names of all the factories exposed through this interface.
virtual QStringList providedFactoryTags (const QString &factory_name, const QtilitiesCategory &category_filter=QtilitiesCategory(), bool *ok=0) const =0
 Provides the tags in a specific factory.
virtual QMap< QString,
QtilitiesCategory
tagCategoryMap (const QString &factory_name, bool *ok=0) const =0
 Provides the full tag and category map for the given factory.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IObjectBase
virtual QObject * objectBase ()=0
 Returns the QObject* base of the interface.
virtual const QObject * objectBase () const =0
 Returns a const QObject* base of the interface.
QString objectOriginID () const
 Allows interfaces to provide some sort of source identification.
void setObjectOriginID (const QString &object_origin_id)
 Allows setting of the object source ID of this interface implementation.

Detailed Description

Objects managing instances of factories can implement this interface if they want to expose these factories to the object manager.

Objects managing instances of factories can implement this interface if they want to expose these factories to the object manager using the Qtilities::Core::Interfaces::IObjectManager::registerIFactoryProvider() function. The interface can be used to represent multiple factories, each represented by a QString values. To get a list of all factories provided through the interface, see the providedFactoryTags() function.

The following example shows how to construct a object through the IFactoryProvider interface:

IFactoryProvider* ifactory = OBJECT_MANAGER->referenceIFactoryProvider("My Factory Tag");
if (ifactory) {
QObject* obj = ifactory->createInstance(instanceFactoryInfo);
if (obj) {
// Do something with the constructed object.
}
}

For more information see the Factories article.


Member Function Documentation

virtual QtilitiesCategory Qtilities::Core::Interfaces::IFactoryProvider::categoryForTag ( const QString &  factory_name,
const QString &  factory_tag,
bool *  ok = 0 
) const
pure virtual

Provides the category of the specified tag.

Parameters:
factory_nameThe factory in which the tag is located.
factory_tagThe tag for which the category must is requested.
okSet to true if the parameters matches a factory in this provider, false otherwise.
Returns:
The QtilitiesCategory for the found tag. If the tag and factory_name combination is not found by this provider, QtilitiesCategory() is returned.

This function was added in Qtilities v1.2.

Implemented in Qtilities::Core::ObjectManager.

virtual QStringList Qtilities::Core::Interfaces::IFactoryProvider::providedFactoryTags ( const QString &  factory_name,
const QtilitiesCategory category_filter = QtilitiesCategory(),
bool *  ok = 0 
) const
pure virtual

Provides the tags in a specific factory.

Parameters:
factory_nameThe factory in which the tag is located.
category_filterAllows you to get tag for a specific category. When empty, all categories are returned.
okSet to true if the parameters matches a factory in this provider, false otherwise.
Returns:
The QtilitiesCategory for the found tag. If the tag and factory_name combination is not found by this provider, QtilitiesCategory() is returned.

Implemented in Qtilities::Core::ObjectManager.

virtual QMap<QString, QtilitiesCategory> Qtilities::Core::Interfaces::IFactoryProvider::tagCategoryMap ( const QString &  factory_name,
bool *  ok = 0 
) const
pure virtual

Provides the full tag and category map for the given factory.

Parameters:
factory_nameThe factory for which the map is requested.
okSet to true if the parameters matches a factory in this provider, false otherwise.
Returns:
A QMap with the keys being the tags and the values their corresponding categories. If the factory_name is not a factory provided by this provider, an empty map is returned.

This function was added in Qtilities v1.2.

Implemented in Qtilities::Core::ObjectManager.



Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé