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/doric/context_manager.h

36 lines
633 B
C
Raw Normal View History

2021-01-28 17:06:40 +08:00
#ifndef CONTEXTMANAGER_H
#define CONTEXTMANAGER_H
2019-12-04 15:51:46 +08:00
#include <QDebug>
#include "context.h"
class ContextManager
{
private:
static ContextManager *local_instance;
2021-01-28 17:06:40 +08:00
ContextManager()
{
2019-12-04 15:51:46 +08:00
}
2021-01-28 17:06:40 +08:00
~ContextManager()
{
2019-12-04 15:51:46 +08:00
}
QAtomicInt *counter = new QAtomicInt();
2021-01-28 17:06:40 +08:00
QMap<QString, Context*> *contextMap = new QMap<QString, Context*>();
2019-12-04 15:51:46 +08:00
public:
2021-01-28 17:06:40 +08:00
static ContextManager *getInstance()
{
static ContextManager instance;
return &instance;
2019-12-04 15:51:46 +08:00
}
2021-01-28 20:31:06 +08:00
Context *createContext(QString script, QString source, QString extra);
2021-02-04 14:55:36 +08:00
Context *getContext(QString contextId);
2019-12-04 15:51:46 +08:00
};
2021-01-28 17:06:40 +08:00
#endif // CONTEXTMANAGER_H