Commit 59a2a3f8 authored by Julien Wintz's avatar Julien Wintz
Browse files

Fixing core factory template.

parent 5c95f509
......@@ -3,9 +3,9 @@
* Author: Julien Wintz
* Created: Thu Feb 28 16:15:02 2013 (+0100)
* Version:
* Last-Updated: Mon Mar 25 10:21:13 2013 (+0100)
* Last-Updated: Mon Mar 25 11:40:29 2013 (+0100)
* By: Julien Wintz
* Update #: 113
* Update #: 115
*/
/* Change Log:
......@@ -66,3 +66,10 @@
#define DTK_DECLARE_PLUGIN_MANAGER(type) \
class type##PluginManager : public dtkCorePluginManager<type##Plugin> {};
// ///////////////////////////////////////////////////////////////////
// DTK_DEFINE_PLUGIN
// ///////////////////////////////////////////////////////////////////
#define DTK_DEFINE_PLUGIN(type) \
Q_PLUGIN_METADATA(IID DTK_DECLARE_PLUGIN_INTERFACE(type))
......@@ -3,9 +3,9 @@
* Author: Julien Wintz
* Created: Thu Feb 28 15:43:06 2013 (+0100)
* Version:
* Last-Updated: Thu Feb 28 15:45:40 2013 (+0100)
* Last-Updated: Mon Mar 25 15:07:41 2013 (+0100)
* By: Julien Wintz
* Update #: 7
* Update #: 9
*/
/* Change Log:
......@@ -23,12 +23,12 @@ public:
~dtkCorePluginFactory(void);
#pragma mark -
#pragma Type creator definition
#pragma mark Type creator definition
typedef T *(*creator) (void);
#pragma mark -
#pragma Type creator registration
#pragma mark Type creator registration
void record(QString key, creator func);
......
......@@ -3,9 +3,9 @@
* Author: Julien Wintz
* Created: Fri Feb 8 16:20:47 2013 (+0100)
* Version:
* Last-Updated: 2013 Thu Feb 28 20:00:19 (+0100)
* By: Thibaud Kloczko
* Update #: 67
* Last-Updated: Mon Mar 25 15:14:51 2013 (+0100)
* By: Julien Wintz
* Update #: 73
*/
/* Change Log:
......@@ -25,7 +25,7 @@ template <typename T> dtkCorePluginFactory<T>::~dtkCorePluginFactory(void)
}
#pragma mark -
#pragma Type creator registration
#pragma mark Type creator registration
template <typename T> void dtkCorePluginFactory<T>::record(QString key, creator func)
{
......@@ -33,17 +33,21 @@ template <typename T> void dtkCorePluginFactory<T>::record(QString key, creator
}
#pragma mark -
#pragma Type creator invokation
#pragma mark Type creator invokation
template <typename T> T *dtkCorePluginFactory<T>::create(const QString& key)
{
if(!this->creators.contains(key))
return NULL;
return this->creators.value(key)();
}
#pragma mark -
#pragma Type creator inspection
#pragma mark Type creator inspection
template <typename T> QStringList dtkCorePluginFactory<T>::keys(void)
{
return this->creators.keys();
}
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