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

35 lines
829 B
C
Raw Normal View History

2021-02-04 16:59:58 +08:00
#ifndef CONTEXTMANAGER_H
#define CONTEXTMANAGER_H
#include <QDebug>
2021-05-18 16:15:28 +08:00
#include "DoricExport.h"
2021-02-04 16:59:58 +08:00
#include "DoricContext.h"
2021-05-18 16:15:28 +08:00
class DORIC_EXPORT DoricContextManager {
2021-02-04 16:59:58 +08:00
private:
static DoricContextManager *local_instance;
DoricContextManager() { qDebug() << "DoricContextManager constructor"; }
2021-02-04 16:59:58 +08:00
~DoricContextManager() { qDebug() << "DoricContextManager destructor"; }
2021-02-04 16:59:58 +08:00
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);
2021-04-09 16:39:43 +08:00
void destroyContext(DoricContext *context);
2021-02-04 16:59:58 +08:00
};
#endif // CONTEXTMANAGER_H