This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/example/doric/DoricRegistry.h
2021-07-21 19:03:29 +08:00

48 lines
906 B
C++

#ifndef REGISTRY_H
#define REGISTRY_H
#include <QDebug>
#include <QString>
#include "DoricExport.h"
#include "utils/DoricObjectFactory.h"
class DoricLibrary;
class DORIC_EXPORT DoricRegistry {
private:
static DoricRegistry *local_instance;
~DoricRegistry() { qDebug() << "DoricRegistry destructor"; }
public:
static DoricRegistry *getInstance() {
static DoricRegistry instance;
return &instance;
}
QSet<DoricLibrary *> doricLibraries;
DoricObjectFactory plugins;
DoricObjectFactory nodes;
DoricRegistry();
template <typename T> void registerNativePlugin(QString name) {
plugins.registerClass<T>(name);
}
template <typename T> void registerViewNode(QString name) {
nodes.registerClass<T>(name);
}
bool acquirePluginInfo(QString name);
bool acquireNodeInfo(QString name);
void registerLibrary(DoricLibrary *doricLibrary);
};
#endif // REGISTRY_H