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
2021-05-20 18:27:45 +08:00

22 lines
814 B
C++

#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) {
return contextMap->value(contextId);
}
void DoricContextManager::destroyContext(DoricContext *context) {
context->getDriver()->destroyContext(context->getContextId());
contextMap->remove(context->getContextId());
}