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.cpp

22 lines
814 B
C++
Raw Permalink Normal View History

2021-02-04 16:59:58 +08:00
#include "DoricContextManager.h"
DoricContext *DoricContextManager::createContext(QString script, QString source,
QString extra) {
int contextId = counter->fetchAndAddOrdered(1);
DoricContext *context =
new DoricContext(QString::number(contextId), source, extra);
contextMap->insert(QString::number(contextId), context);
context->getDriver()->createContext(QString::number(contextId), script,
source);
return context;
}
DoricContext *DoricContextManager::getContext(QString contextId) {
2021-04-06 16:33:01 +08:00
return contextMap->value(contextId);
2021-02-04 16:59:58 +08:00
}
2021-04-09 16:39:43 +08:00
void DoricContextManager::destroyContext(DoricContext *context) {
context->getDriver()->destroyContext(context->getContextId());
contextMap->remove(context->getContextId());
}