Commit 28e15630 authored by Vincent Carrubba's avatar Vincent Carrubba
Browse files

Applying HACKING rules to EffectNodeFactory

parent 9fffeb8d
......@@ -27,9 +27,11 @@
#include "EffectPluginTypeManager.h"
#include "IEffectPluginCreator.h"
EffectPluginTypeManager EffectNodeFactory::m_eptm = EffectPluginTypeManager();
EffectPluginTypeManager EffectNodeFactory::s_eptm = EffectPluginTypeManager();
EffectNodeFactory::EffectNodeFactory() : m_higherFreeId( 1 ), m_mapHoles( 0 ), m_father( NULL )
EffectNodeFactory::EffectNodeFactory( void ) : m_higherFreeId( 1 ),
m_mapHoles( 0 ),
m_father( NULL )
{
}
......@@ -48,59 +50,68 @@ EffectNodeFactory::~EffectNodeFactory()
// SETTING FATHER
void EffectNodeFactory::setFather( EffectNode* father )
void
EffectNodeFactory::setFather( EffectNode* father )
{
m_father = father ;
return ;
}
// EFFECT TYPES INFORMATION
QList<QString> EffectNodeFactory::getEffectNodeTypesNamesList( void ) const
QList<QString>
EffectNodeFactory::getEffectNodeTypesNamesList( void ) const
{
return ( EffectNodeFactory::m_eptm.getEffectPluginTypesNamesList() );
return EffectNodeFactory::s_eptm.getEffectPluginTypesNamesList();
}
QList<quint32> EffectNodeFactory::getEffectNodeTypesIdsList( void ) const
QList<quint32>
EffectNodeFactory::getEffectNodeTypesIdsList( void ) const
{
return ( EffectNodeFactory::m_eptm.getEffectPluginTypesIdsList() );
return EffectNodeFactory::s_eptm.getEffectPluginTypesIdsList();
}
QString const EffectNodeFactory::getEffectNodeTypeNameByTypeId( quint32 typeId ) const
const QString
EffectNodeFactory::getEffectNodeTypeNameByTypeId( quint32 typeId ) const
{
return ( EffectNodeFactory::m_eptm.getEffectPluginTypeNameByTypeId( typeId ) );
return EffectNodeFactory::s_eptm.getEffectPluginTypeNameByTypeId( typeId );
}
quint32 EffectNodeFactory::getEffectNodeTypeIdByTypeName( QString const & typeName ) const
quint32
EffectNodeFactory::getEffectNodeTypeIdByTypeName( const QString & typeName ) const
{
return ( EffectNodeFactory::m_eptm.getEffectPluginTypeIdByTypeName( typeName ) );
return EffectNodeFactory::s_eptm.getEffectPluginTypeIdByTypeName( typeName );
}
// EFFECT INSTANCES INFORMATIONS
QList<QString> EffectNodeFactory::getEffectNodeInstancesNamesList( void ) const
QList<QString>
EffectNodeFactory::getEffectNodeInstancesNamesList( void ) const
{
return ( m_nameById.values() );
return m_nameById.values();
}
QList<quint32> EffectNodeFactory::getEffectNodeInstancesIdsList( void ) const
QList<quint32>
EffectNodeFactory::getEffectNodeInstancesIdsList( void ) const
{
return ( m_nameById.keys() );
return m_nameById.keys();
}
QString const EffectNodeFactory::getEffectNodeInstanceNameByInstanceId( quint32 instanceId ) const
const QString
EffectNodeFactory::getEffectNodeInstanceNameByInstanceId( quint32 instanceId ) const
{
return ( m_nameById.value( instanceId, "" ) );
return m_nameById.value( instanceId, "" );
}
quint32 EffectNodeFactory::getEffectNodeInstanceIdByInstanceName( QString const & instanceName ) const
quint32
EffectNodeFactory::getEffectNodeInstanceIdByInstanceName( const QString & instanceName ) const
{
return ( m_nameById.key( instanceName, 0 ) );
return m_nameById.key( instanceName, 0 );
}
// CREATE AND DELETE EFFECTS
void EffectNodeFactory::createEmptyEffectNodeInstance( void )
void
EffectNodeFactory::createEmptyEffectNodeInstance( void )
{
EffectNode* newNode;
quint32 instanceId;
......@@ -130,10 +141,10 @@ void EffectNodeFactory::createEmptyEffectNodeInstance( vo
m_enById[ instanceId ] = newNode;
m_nameById[ instanceId ] = instanceName;
qDebug() << "New empty EffectNode* created with name : " << instanceName ;
return ;
}
bool EffectNodeFactory::createEmptyEffectNodeInstance( QString const & instanceName )
bool
EffectNodeFactory::createEmptyEffectNodeInstance( const QString & instanceName )
{
if ( m_enByName.find( instanceName ) == m_enByName.end() )
{
......@@ -162,20 +173,22 @@ bool EffectNodeFactory::createEmptyEffectNodeInstance( QS
m_enById[ instanceId ] = newNode;
m_nameById[ instanceId ] = instanceName;
qDebug() << "New empty EffectNode* created with name : " << instanceName ;
return ( true );
return true;
}
qDebug() << "You can't create a new empty EffectNode with name : " << instanceName << ", it already exist!";
return ( false );
qDebug() << "You can't create a new empty EffectNode with name : "
<< instanceName << ", it already exist!";
return false;
}
bool EffectNodeFactory::createEffectNodeInstance( QString const & typeName )
bool
EffectNodeFactory::createEffectNodeInstance( const QString & typeName )
{
IEffectPlugin* newInstance;
EffectNode* newNode;
quint32 instanceId;
QString instanceName;
newInstance = EffectNodeFactory::m_eptm.createIEffectPluginInstance( typeName );
newInstance = EffectNodeFactory::s_eptm.createIEffectPluginInstance( typeName );
if ( newInstance != NULL )
{
newNode = new EffectNode( newInstance );
......@@ -199,21 +212,22 @@ bool EffectNodeFactory::createEffectNodeInstance( QString
m_enByName[ instanceName ] = newNode;
m_enById[ instanceId ] = newNode;
m_nameById[ instanceId ] = instanceName;
return ( true );
return true;
qDebug() << "EffectNode* with typeName[" << typeName << "] created.";
}
qDebug() << "Can't create EffectNode* with typeName[" << typeName << "]!";
return ( false );
return false;
}
bool EffectNodeFactory::createEffectNodeInstance( quint32 typeId )
bool
EffectNodeFactory::createEffectNodeInstance( quint32 typeId )
{
IEffectPlugin* newInstance;
EffectNode* newNode;
quint32 instanceId;
QString instanceName;
newInstance = EffectNodeFactory::m_eptm.createIEffectPluginInstance( typeId );
newInstance = EffectNodeFactory::s_eptm.createIEffectPluginInstance( typeId );
if ( newInstance != NULL )
{
newNode = new EffectNode( newInstance );
......@@ -237,14 +251,14 @@ bool EffectNodeFactory::createEffectNodeInstance( quint32 typeId )
m_enByName[ instanceName ] = newNode;
m_enById[ instanceId ] = newNode;
m_nameById[ instanceId ] = instanceName;
return ( true );
return true;
qDebug() << "EffectNode* with typeId[" << typeId << "] created.";
}
qDebug() << "Can't create EffectNode* with typeId[" << typeId << "]!";
return ( false );
return false;
}
bool EffectNodeFactory::deleteEffectNodeInstance( QString const & instanceName )
bool EffectNodeFactory::deleteEffectNodeInstance( const QString & instanceName )
{
QMap<quint32, EffectNode*>::iterator itid;
quint32 instanceId;
......@@ -280,7 +294,7 @@ bool EffectNodeFactory::deleteEffectNodeInstance( QString const & instanc
qDebug() << "You can't delete the EffectNode* instance with instanceName["
<< instanceName
<< "] it already has been deleted!";
return ( false );
return false;
}
}
else
......@@ -288,12 +302,13 @@ bool EffectNodeFactory::deleteEffectNodeInstance( QString const & instanc
qDebug() << "You can't delete the EffectNode* instance with instanceName["
<< instanceName
<< "] it doesn't exist!";
return ( false );
return false;
}
return ( true );
return true;
}
bool EffectNodeFactory::deleteEffectNodeInstance( quint32 instanceId )
bool
EffectNodeFactory::deleteEffectNodeInstance( quint32 instanceId )
{
QMap<quint32, EffectNode*>::iterator itid;
......@@ -327,7 +342,7 @@ bool EffectNodeFactory::deleteEffectNodeInstance( quint32 instanceId )
qDebug() << "You can't delete the EffectNode* instance with instanceId["
<< instanceId
<< "] it already has been deleted!";
return ( false );
return false;
}
}
else
......@@ -335,30 +350,32 @@ bool EffectNodeFactory::deleteEffectNodeInstance( quint32 instanceId )
qDebug() << "You can't delete the EffectNode* instance with instanceId["
<< instanceId
<< "] it doesn't exist!";
return ( false );
return false;
}
return ( true );
return true;
}
EffectNode* EffectNodeFactory::getEffectNodeInstance( quint32 instanceId ) const
EffectNode*
EffectNodeFactory::getEffectNodeInstance( quint32 instanceId ) const
{
QMap<quint32, EffectNode*>::const_iterator it = m_enById.find( instanceId );
if ( it != m_enById.end() )
return ( it.value() );
return ( NULL );
return it.value();
return NULL;
}
EffectNode* EffectNodeFactory::getEffectNodeInstance( QString const & instanceName ) const
EffectNode*
EffectNodeFactory::getEffectNodeInstance( const QString & instanceName ) const
{
QMap<QString, EffectNode*>::const_iterator it = m_enByName.find( instanceName );
if ( it != m_enByName.end() )
return ( it.value() );
return ( NULL );
return it.value();
return NULL;
}
QList<EffectNode*> EffectNodeFactory::getEffectNodeInstancesList( void ) const
{
return ( m_enByName.values() );
return m_enByName.values();
}
......@@ -39,51 +39,49 @@ class EffectNodeFactory
// CTOR & DTOR
EffectNodeFactory();
EffectNodeFactory( void );
~EffectNodeFactory();
// SETTING FATHER
void setFather( EffectNode* father );
void setFather( EffectNode* father );
// EFFECT TYPES INFORMATION
QList<QString> getEffectNodeTypesNamesList( void ) const;
QList<quint32> getEffectNodeTypesIdsList( void ) const;
QList<QString> getEffectNodeTypesNamesList( void ) const;
QList<quint32> getEffectNodeTypesIdsList( void ) const;
QString const getEffectNodeTypeNameByTypeId( quint32 typeId ) const;
quint32 getEffectNodeTypeIdByTypeName( QString const & typeName ) const;
const QString getEffectNodeTypeNameByTypeId( quint32 typeId ) const;
quint32 getEffectNodeTypeIdByTypeName( const QString & typeName ) const;
// EFFECT INSTANCES INFORMATIONS
QList<QString> getEffectNodeInstancesNamesList( void ) const;
QList<quint32> getEffectNodeInstancesIdsList( void ) const;
QList<QString> getEffectNodeInstancesNamesList( void ) const;
QList<quint32> getEffectNodeInstancesIdsList( void ) const;
QString const getEffectNodeInstanceNameByInstanceId( quint32 instanceId ) const;
quint32 getEffectNodeInstanceIdByInstanceName( QString const & instanceName ) const;
const QString getEffectNodeInstanceNameByInstanceId( quint32 instanceId ) const;
quint32 getEffectNodeInstanceIdByInstanceName( const QString & instanceName ) const;
// CREATE AND DELETE EFFECTS
void createEmptyEffectNodeInstance( void );
bool createEmptyEffectNodeInstance( QString const & instanceName );
void createEmptyEffectNodeInstance( void );
bool createEmptyEffectNodeInstance( const QString & instanceName );
bool createEffectNodeInstance( quint32 typeId );
bool createEffectNodeInstance( QString const & typeName );
bool createEffectNodeInstance( quint32 typeId );
bool createEffectNodeInstance( const QString & typeName );
bool deleteEffectNodeInstance( quint32 instanceId );
bool deleteEffectNodeInstance( QString const & instanceName );
bool deleteEffectNodeInstance( quint32 instanceId );
bool deleteEffectNodeInstance( const QString & instanceName );
// GETTING EFFECTS
EffectNode* getEffectNodeInstance( quint32 instanceId ) const;
EffectNode* getEffectNodeInstance( QString const & instanceName ) const;
EffectNode* getEffectNodeInstance( quint32 instanceId ) const;
EffectNode* getEffectNodeInstance( const QString & instanceName ) const;
QList<EffectNode*> getEffectNodeInstancesList( void ) const;
private:
// NEW COOL
QMap<quint32, EffectNode*> m_enById;
QMap<QString, EffectNode*> m_enByName;
QMap<quint32, QString> m_nameById;
......@@ -92,7 +90,7 @@ private:
EffectNode* m_father;
static EffectPluginTypeManager m_eptm;
static EffectPluginTypeManager s_eptm;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment