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/loader/DoricJSLoaderManager.cpp

33 lines
843 B
C++
Raw Permalink Normal View History

2021-06-09 18:06:56 +08:00
#include "DoricJSLoaderManager.h"
#include "DoricAssetJSLoader.h"
2021-06-09 18:06:56 +08:00
DoricJSLoaderManager::DoricJSLoaderManager() {
qDebug() << "DoricJSLoaderManager constructor";
addJSLoader(new DoricAssetJSLoader());
2021-06-09 18:06:56 +08:00
}
void DoricJSLoaderManager::addJSLoader(DoricInterfaceLoader *jsLoader) {
jsLoaders.insert(jsLoader);
}
QSet<DoricInterfaceLoader *> *DoricJSLoaderManager::getJSLoaders() {
return &jsLoaders;
}
std::shared_ptr<DoricAsyncResult>
DoricJSLoaderManager::request(QString source) {
if (!source.isEmpty()) {
if (source.startsWith("_internal_://")) {
}
foreach (DoricInterfaceLoader *jsLoader, jsLoaders) {
if (jsLoader->filter(source)) {
return jsLoader->request(source);
}
}
}
std::shared_ptr<DoricAsyncResult> asyncResult =
std::make_shared<DoricAsyncResult>();
return asyncResult;
}