add asset js loader & export doric classes

This commit is contained in:
王劲鹏
2021-06-10 10:31:23 +08:00
committed by osborn
parent 928a4ab038
commit 0b4b9c2ed6
20 changed files with 92 additions and 19 deletions

View File

@@ -0,0 +1,19 @@
#include "DoricAssetJSLoader.h"
#include "utils/DoricUtils.h"
DoricAssetJSLoader::DoricAssetJSLoader() {}
bool DoricAssetJSLoader::filter(QString source) {
return source.startsWith("assets");
}
std::shared_ptr<DoricAsyncResult> DoricAssetJSLoader::request(QString source) {
QString protocol = "assets://";
QString assetPath = source.mid(protocol.length());
std::shared_ptr<DoricAsyncResult> asyncResult =
std::make_shared<DoricAsyncResult>();
return asyncResult;
}

View File

@@ -0,0 +1,17 @@
#ifndef DORICASSETJSLOADER_H
#define DORICASSETJSLOADER_H
#include "DoricExport.h"
#include "DoricInterfaceLoader.h"
class DORIC_EXPORT DoricAssetJSLoader : public DoricInterfaceLoader {
public:
DoricAssetJSLoader();
virtual bool filter(QString source) override;
virtual std::shared_ptr<DoricAsyncResult> request(QString source) override;
};
#endif // DORICASSETJSLOADER_H

View File

@@ -1,11 +1,13 @@
#ifndef DORICINTERFACELOADER_H
#define DORICINTERFACELOADER_H
#include "async/DoricAsyncResult.h"
#include <QString>
class DoricInterfaceLoader {
#include "DoricExport.h"
#include "async/DoricAsyncResult.h"
class DORIC_EXPORT DoricInterfaceLoader {
public:
virtual bool filter(QString source) = 0;

View File

@@ -1,7 +1,10 @@
#include "DoricJSLoaderManager.h"
#include "DoricAssetJSLoader.h"
DoricJSLoaderManager::DoricJSLoaderManager() {
qDebug() << "DoricJSLoaderManager constructor";
addJSLoader(new DoricAssetJSLoader());
}
void DoricJSLoaderManager::addJSLoader(DoricInterfaceLoader *jsLoader) {

View File

@@ -3,9 +3,11 @@
#include <QDebug>
#include "DoricExport.h"
#include "DoricInterfaceLoader.h"
class DoricJSLoaderManager {
class DORIC_EXPORT DoricJSLoaderManager {
private:
static DoricJSLoaderManager *local_instance;