#include <vpropertyfactorymanager.h>
Public Member Functions | |
VPropertyFactoryManager (QObject *parent=nullptr) | |
Constructor. More... | |
virtual | ~VPropertyFactoryManager () Q_DECL_OVERRIDE |
Destructor. More... | |
void | registerFactory (const QString &type, VAbstractPropertyFactory *factory) |
Register a factory to the factory manager Note that the manager takes ownership of the factory, so don't delete it. You can unregister a factory using unregisterFactory() More... | |
void | unregisterFactory (VAbstractPropertyFactory *factory, const QString &type=QString(), bool delete_if_unused=true) |
Removes a factory from the manager. More... | |
bool | isRegistered (VAbstractPropertyFactory *factory) |
Returns whether a factory is registered (and thus owned) by this factory manager. More... | |
VAbstractPropertyFactory * | getFactory (const QString &type) |
Returns a pointer to a factory registered for a certain type. More... | |
VProperty * | createProperty (const QString &type, const QString &name, const QString &description=QString(), const QString &default_value=QString()) |
Creates a new property of a certain type and assigns a name and description (otionally) More... | |
QStringList | getSupportedTypes () |
Returns the default manager. More... | |
Protected Attributes | |
VPropertyFactoryManagerPrivate * | d_ptr |
Static Protected Attributes | |
static VPropertyFactoryManager * | DefaultManager = NULL |
The default manager. More... | |
Definition at line 37 of file vpropertyfactorymanager.h.
|
explicit |
Constructor.
Definition at line 35 of file vpropertyfactorymanager.cpp.
|
virtual |
Destructor.
Definition at line 41 of file vpropertyfactorymanager.cpp.
VPE::VProperty * VPE::VPropertyFactoryManager::createProperty | ( | const QString & | type, |
const QString & | name, | ||
const QString & | description = QString() , |
||
const QString & | default_value = QString() |
||
) |
Creates a new property of a certain type and assigns a name and description (otionally)
type | The type of the property as string |
name | The name of the property |
description | The property's description. Optional. |
default_value | The properties initial value as string. Optional. |
Definition at line 120 of file vpropertyfactorymanager.cpp.
References VPE::VAbstractPropertyFactory::createProperty(), VPE::VProperty::deserialize(), and VPE::VProperty::setDescription().
VPE::VAbstractPropertyFactory * VPE::VPropertyFactoryManager::getFactory | ( | const QString & | type | ) |
Returns a pointer to a factory registered for a certain type.
type | The type to return the factory for |
Definition at line 114 of file vpropertyfactorymanager.cpp.
QStringList VPE::VPropertyFactoryManager::getSupportedTypes | ( | ) |
Returns the default manager.
Returns a list of all supported property types
Definition at line 156 of file vpropertyfactorymanager.cpp.
bool VPE::VPropertyFactoryManager::isRegistered | ( | VAbstractPropertyFactory * | factory | ) |
Returns whether a factory is registered (and thus owned) by this factory manager.
Definition at line 109 of file vpropertyfactorymanager.cpp.
void VPE::VPropertyFactoryManager::registerFactory | ( | const QString & | type, |
VAbstractPropertyFactory * | factory | ||
) |
Register a factory to the factory manager Note that the manager takes ownership of the factory, so don't delete it. You can unregister a factory using unregisterFactory()
Definition at line 60 of file vpropertyfactorymanager.cpp.
Referenced by VPE::VStandardPropertyFactory::VStandardPropertyFactory().
void VPE::VPropertyFactoryManager::unregisterFactory | ( | VAbstractPropertyFactory * | factory, |
const QString & | type = QString() , |
||
bool | delete_if_unused = true |
||
) |
Removes a factory from the manager.
factory | The factory to unregister |
type | The type from which to remove the factory. If this is empty, all the types the factory is registered for are being removed |
delete_if_unused | Determines whether the factory should be deleted, if it not used anymore by this manager. Default: true. Otherwise, if the factory is unused by this manager, ownership is being passed on. |
Definition at line 73 of file vpropertyfactorymanager.cpp.
|
protected |
Definition at line 85 of file vpropertyfactorymanager.h.
|
staticprotected |
The default manager.
Definition at line 88 of file vpropertyfactorymanager.h.