24 #include "parametersettable.h"
26 #include <QStringList>
36 class ParameterSettableCreator;
37 class ConfigurationWidget;
161 template <
class NewClass>
162 void registerClass(QString className, QString parentClassName);
181 QStringList getAllSubclasses(QString className,
int levelToStop = -1,
bool noAbstractClasses =
false);
190 bool isAbstract(QString className);
202 template <
class EditorType>
203 void registerEditorForType(QString type);
231 void cleanupMapsForReRegistration(QString className);
239 template <
class T,
class U>
248 static Type1 Test(U);
249 static Type2 Test(...);
252 enum { exists =
sizeof(Test(MakeT())) ==
sizeof(Type1) };
261 template<
bool canBeCreated,
class H>
262 class RegisterClassHelper {
264 RegisterClassHelper(
Factory* factory, QString className, QString parentClassName);
293 QMap<QString, ParameterSettableCreator*> m_classMap;
298 QMap<QString, QString> m_parentsMap;
303 QMap<QString, QStringList> m_childrenMap;
308 QMap<QString, ConfigurationWidgetCreator*> m_editorsMap;
320 #include "configurationparameters.h"
321 #include "realfactory.h"
332 std::auto_ptr<T> t(
new T(params, terminatedPrefix, parent, f));
338 namespace __Factory_internal {
350 static char check_sig(U (*)[1]);
352 static short check_sig(...);
353 static const bool isAbstract = (
sizeof(check_sig<T>(0))!=
sizeof(char));
355 static const bool canBeCreated = (
sizeof(check_sig<T>(0))==
sizeof(char));
360 class Factory::RegisterClassHelper<true, H> {
362 RegisterClassHelper(
Factory* factory, QString className, QString parentClassName) {
363 factory->cleanupMapsForReRegistration(className);
365 factory->m_parentsMap[className] = parentClassName;
366 factory->m_childrenMap[parentClassName].append( className );
367 H::describe( className );
372 class Factory::RegisterClassHelper<false, H> {
374 RegisterClassHelper(
Factory* factory, QString className, QString parentClassName) {
375 factory->cleanupMapsForReRegistration(className);
376 factory->m_parentsMap[className] = parentClassName;
377 factory->m_childrenMap[parentClassName].append( className );
381 template <
class NewClass>
384 RegisterClassHelper<__Factory_internal::checkClass<NewClass>::canBeCreated, NewClass> registerHelper(
this, className, parentClassName );
387 template <
class EditorType>
396 if (m_editorsMap.contains(type)) {
397 delete m_editorsMap[type];
399 m_editorsMap[type] = NULL;
406 template <
class EditorType>