32#ifndef _QX_FACTORY_X_H_
33#define _QX_FACTORY_X_H_
46#include <QtCore/qhash.h>
47#include <QtCore/qmutex.h>
55inline qx::any create(
const QString & sKey,
bool bRawPointer =
false);
71 friend inline qx::any create(
const QString & sKey,
bool bRawPointer);
72 template <
typename T>
friend inline T *
create_nude_ptr(
const QString & sKey);
85 QHash<QString, IxFactory *> *
getAllFactory() {
return (& m_mapFactoryX); }
94 const std::type_info &
typeInfo(
const QString & sKey)
const;
97 static inline qx::any createInstance(
const QString & sKey,
bool bRawPointer =
false) {
return QxFactoryX::getSingleton()->createObject(sKey, bRawPointer); }
98 static inline void *
createInstanceNudePtr(
const QString & sKey) {
return QxFactoryX::getSingleton()->createObjectNudePtr(sKey); }
101 static inline const std::type_info &
getTypeInfo(
const QString & sKey) {
return QxFactoryX::getSingleton()->typeInfo(sKey); }
Common interface for all classes that can be created dynamically using the class name.
#define QX_DLL_EXPORT_QX_SINGLETON_HPP(x)
Concrete class to define a thread-safe singleton of QxOrm library.
qx::IxFactory : common interface for all classes that can be created dynamically using the class name
qx::QxClassX : list of all classes registered into QxOrm context (this container is a singleton)
qx::QxFactoryX : list of all classes registered with QxOrm library factory pattern to create object i...
void * createObjectNudePtr(const QString &sKey) const
qx::any createObject(const QString &sKey, bool bRawPointer=false) const
QMutex m_oMutexFactoryX
Mutex -> 'QxFactoryX' is thread-safe.
void unregisterFactory(const QString &sKey)
void registerFactory(const QString &sKey, IxFactory *pFactory)
static const std::type_info & getTypeInfo(const QString &sKey)
static void * createInstanceNudePtr(const QString &sKey)
static qx::any createInstance(const QString &sKey, bool bRawPointer=false)
const std::type_info & typeInfo(const QString &sKey) const
QHash< QString, IxFactory * > m_mapFactoryX
Collection of all 'IxFactory' pointer.
QHash< QString, IxFactory * > * getAllFactory()
qx::QxSingleton<T> : concrete class to define a thread-safe singleton of type T
T * create_nude_ptr(const QString &sKey)
Return a nude pointer (be careful with memory leak) of type T associated by key sKey,...
qx::any create(const QString &sKey, bool bRawPointer=false)
Return a smart-pointer new instance of object (std::shared_ptr<T>) associated by key sKey using qx::a...
void * create_void_ptr(const QString &sKey)
Return a void * pointer (be careful with memory leak) associated by key sKey, or return NULL if sKey ...
Root namespace for all QxOrm library features.