Seamly2D
Code documentation
VPE::VPropertyFactoryManager Class Reference

#include <vpropertyfactorymanager.h>

Inheritance diagram for VPE::VPropertyFactoryManager:
Collaboration diagram for VPE::VPropertyFactoryManager:

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...
 
VAbstractPropertyFactorygetFactory (const QString &type)
 Returns a pointer to a factory registered for a certain type. More...
 
VPropertycreateProperty (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

VPropertyFactoryManagerPrivated_ptr
 

Static Protected Attributes

static VPropertyFactoryManagerDefaultManager = NULL
 The default manager. More...
 

Detailed Description

Definition at line 37 of file vpropertyfactorymanager.h.

Constructor & Destructor Documentation

◆ VPropertyFactoryManager()

VPE::VPropertyFactoryManager::VPropertyFactoryManager ( QObject *  parent = nullptr)
explicit

Constructor.

Definition at line 35 of file vpropertyfactorymanager.cpp.

◆ ~VPropertyFactoryManager()

VPE::VPropertyFactoryManager::~VPropertyFactoryManager ( )
virtual

Destructor.

Definition at line 41 of file vpropertyfactorymanager.cpp.

Member Function Documentation

◆ createProperty()

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)

Parameters
typeThe type of the property as string
nameThe name of the property
descriptionThe property's description. Optional.
default_valueThe properties initial value as string. Optional.
Returns
Returns the created property or NULL if it couldn't be be created

Definition at line 120 of file vpropertyfactorymanager.cpp.

References VPE::VAbstractPropertyFactory::createProperty(), VPE::VProperty::deserialize(), and VPE::VProperty::setDescription().

◆ getFactory()

VPE::VAbstractPropertyFactory * VPE::VPropertyFactoryManager::getFactory ( const QString &  type)

Returns a pointer to a factory registered for a certain type.

Parameters
typeThe type to return the factory for
Returns
Returns NULL, if there is none registered for this type

Definition at line 114 of file vpropertyfactorymanager.cpp.

◆ getSupportedTypes()

QStringList VPE::VPropertyFactoryManager::getSupportedTypes ( )

Returns the default manager.

Returns a list of all supported property types

Definition at line 156 of file vpropertyfactorymanager.cpp.

◆ isRegistered()

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.

◆ registerFactory()

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().

◆ unregisterFactory()

void VPE::VPropertyFactoryManager::unregisterFactory ( VAbstractPropertyFactory factory,
const QString &  type = QString(),
bool  delete_if_unused = true 
)

Removes a factory from the manager.

Parameters
factoryThe factory to unregister
typeThe type from which to remove the factory. If this is empty, all the types the factory is registered for are being removed
delete_if_unusedDetermines 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.

Member Data Documentation

◆ d_ptr

VPropertyFactoryManagerPrivate* VPE::VPropertyFactoryManager::d_ptr
protected

Definition at line 85 of file vpropertyfactorymanager.h.

◆ DefaultManager

VPE::VPropertyFactoryManager * VPE::VPropertyFactoryManager::DefaultManager = NULL
staticprotected

The default manager.

Definition at line 88 of file vpropertyfactorymanager.h.


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