The InstanceFactoryInfo struct contains all the information required to create an object instance using the object manager. The InstanceFactoryInfo struct contains all the information required to create an instance through the Qtilities::Core::Interfaces::IFactoryProvider::createInstance() method.
More...
#include <InstanceFactoryInfo.h>
List of all members.
Public Member Functions |
virtual bool | exportXml (QDomDocument *doc, QDomElement *object_node, Qtilities::ExportVersion version) const |
virtual bool | importXml (QDomDocument *doc, QDomElement *object_node, Qtilities::ExportVersion version) |
| InstanceFactoryInfo (const QString &factory_tag, const QString &instance_tag, const QString &instance_name=QString()) |
bool | isValid () |
| Returns true if this object contains the necessary information to be used during object construction.
|
Public Attributes |
QString | d_description |
| A description for this type of object. This is not part of any exports.
|
QString | d_factory_tag |
| The name of the factory which must be used to create the instance.
|
QString | d_icon_path |
| A path to an icon for this type of object.
|
QString | d_instance_name |
| The name that must be given to the instance once it is created. This is done by calling setObjectName().
|
QString | d_instance_tag |
| The tag that must be used in the factory during instance creation.
|
Detailed Description
The InstanceFactoryInfo struct contains all the information required to create an object instance using the object manager. The InstanceFactoryInfo struct contains all the information required to create an instance through the Qtilities::Core::Interfaces::IFactoryProvider::createInstance() method.
That is:
- The factory which must be used.
- The tag to use in that factory.
- And the name that must be given to the reconstructed object.
InstanceFactoryInfo can also store other information, like a description, for the type of object that it will be used to create.
For more information see the Factories article.
- See also:
- Factory, Interfaces::IFactoryProvider
Constructor & Destructor Documentation
Qtilities::Core::InstanceFactoryInfo::InstanceFactoryInfo |
( |
const QString & |
factory_tag, |
|
|
const QString & |
instance_tag, |
|
|
const QString & |
instance_name = QString() |
|
) |
| |
|
inline |
- Parameters:
-
factory_tag | The factory tag which identifies the factory to be used when constructing the new instance. The Qtilities::Core::Interfaces::IObjectManager::factoryReference() function takes this tag as a parameter. Make sure the factory you want to use is registered in the object manager under this tag name. |
instance_tag | The instance tag which identifies the tag to be used in the factory identified by factory_tag. |
instance_name | The name that must be given to the newly created object. |
Member Function Documentation
bool Qtilities::Core::InstanceFactoryInfo::exportXml |
( |
QDomDocument * |
doc, |
|
|
QDomElement * |
object_node, |
|
|
Qtilities::ExportVersion |
version |
|
) |
| const |
|
virtual |
In the case of InstanceFactoryInfo, this function will add the factory tag, instance tag etc. as attributes on object_node
.
bool Qtilities::Core::InstanceFactoryInfo::importXml |
( |
QDomDocument * |
doc, |
|
|
QDomElement * |
object_node, |
|
|
Qtilities::ExportVersion |
version |
|
) |
| |
|
virtual |
- Note:
- If
object_node
does not have an FactoryTag
attribute associated with it, the Qtilities factory tag is used by default.