41 if(m_initialized ==
false)
46 if(instance.m_customInstance)
47 return instance.m_customInstance;
56 instance()->m_customInstance = i;
60 void registerExport(std::shared_ptr<I> instance)
62 QString
id =
typeid(I).name();
63 auto it = m_map.find(
id);
66 auto sharedInstance = std::shared_ptr<I>(instance);
73 m_map[id] = {
interface };
76 std::shared_ptr<IModuleExportInterface> doResolvePtrById(
const QString &
id)
78 auto it = m_map.find(
id);
93 std::shared_ptr<I> resolve()
95 QString
id =
typeid(I).name();
96 std::shared_ptr<IModuleExportInterface> service = doResolvePtrById(
id);
97 return std::static_pointer_cast<I>(service);
103 std::shared_ptr<IModuleExportInterface> p;
106 std::map<QString, Service> m_map;
108 inline static bool m_initialized =
false;