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/DoricContextManager.h
2021-07-21 19:03:29 +08:00

35 lines
829 B
C++

#ifndef CONTEXTMANAGER_H
#define CONTEXTMANAGER_H
#include <QDebug>
#include "DoricExport.h"
#include "DoricContext.h"
class DORIC_EXPORT DoricContextManager {
private:
static DoricContextManager *local_instance;
DoricContextManager() { qDebug() << "DoricContextManager constructor"; }
~DoricContextManager() { qDebug() << "DoricContextManager destructor"; }
QAtomicInt *counter = new QAtomicInt();
QMap<QString, DoricContext *> *contextMap =
new QMap<QString, DoricContext *>();
public:
static DoricContextManager *getInstance() {
static DoricContextManager instance;
return &instance;
}
DoricContext *createContext(QString script, QString source, QString extra);
DoricContext *getContext(QString contextId);
void destroyContext(DoricContext *context);
};
#endif // CONTEXTMANAGER_H