diff --git a/doric-Qt/example/doric/Doric.h b/doric-Qt/example/doric/Doric.h index b3fa6b94..90486176 100644 --- a/doric-Qt/example/doric/Doric.h +++ b/doric-Qt/example/doric/Doric.h @@ -1,9 +1,11 @@ #ifndef DORIC_H #define DORIC_H +#include "DoricExport.h" + #include "DoricLibrary.h" -class Doric { +class DORIC_EXPORT Doric { public: static void registerLibrary(DoricLibrary *doricLibrary) { DoricRegistry::getInstance()->registerLibrary(doricLibrary); diff --git a/doric-Qt/example/doric/DoricInterfaceDriver.h b/doric-Qt/example/doric/DoricInterfaceDriver.h index 3d304f82..c775e9e0 100644 --- a/doric-Qt/example/doric/DoricInterfaceDriver.h +++ b/doric-Qt/example/doric/DoricInterfaceDriver.h @@ -5,11 +5,13 @@ #include #include +#include "DoricExport.h" + #include "DoricRegistry.h" #include "async/DoricAsyncResult.h" #include "utils/DoricThreadMode.h" -class DoricInterfaceDriver { +class DORIC_EXPORT DoricInterfaceDriver { public: virtual std::shared_ptr invokeContextEntityMethod(QString contextId, QString method, diff --git a/doric-Qt/example/doric/DoricLibrary.h b/doric-Qt/example/doric/DoricLibrary.h index 39d2ae69..de1e4fb2 100644 --- a/doric-Qt/example/doric/DoricLibrary.h +++ b/doric-Qt/example/doric/DoricLibrary.h @@ -1,9 +1,11 @@ #ifndef DORICLIBRARY_H #define DORICLIBRARY_H +#include "DoricExport.h" + #include "DoricRegistry.h" -class DoricLibrary { +class DORIC_EXPORT DoricLibrary { public: virtual void load(DoricRegistry *registry) = 0; }; diff --git a/doric-Qt/example/doric/async/DoricAsyncCall.h b/doric-Qt/example/doric/async/DoricAsyncCall.h index fae4d394..0f6cbc8a 100644 --- a/doric-Qt/example/doric/async/DoricAsyncCall.h +++ b/doric-Qt/example/doric/async/DoricAsyncCall.h @@ -5,9 +5,11 @@ #include #include +#include "DoricExport.h" + #include "DoricAsyncResult.h" -class DoricAsyncCall { +class DORIC_EXPORT DoricAsyncCall { public: template diff --git a/doric-Qt/example/doric/doric.pro b/doric-Qt/example/doric/doric.pro index e5571d0c..557376b5 100644 --- a/doric-Qt/example/doric/doric.pro +++ b/doric-Qt/example/doric/doric.pro @@ -36,6 +36,7 @@ SOURCES += \ engine/native/NativeExecutor.cpp \ engine/v8/JSValueHelper.cpp \ engine/v8/V8Executor.cpp \ + loader/DoricAssetJSLoader.cpp \ loader/DoricJSLoaderManager.cpp \ plugin/DoricModalPlugin.cpp \ plugin/DoricNavigatorPlugin.cpp \ @@ -125,6 +126,7 @@ HEADERS += \ engine/native/NativeExecutor.h \ engine/v8/JSValueHelper.h \ engine/v8/V8Executor.h \ + loader/DoricAssetJSLoader.h \ loader/DoricInterfaceLoader.h \ loader/DoricJSLoaderManager.h \ plugin/DoricModalPlugin.h \ diff --git a/doric-Qt/example/doric/engine/DoricInterfaceJSE.h b/doric-Qt/example/doric/engine/DoricInterfaceJSE.h index 454e1fc4..d1f73e5e 100644 --- a/doric-Qt/example/doric/engine/DoricInterfaceJSE.h +++ b/doric-Qt/example/doric/engine/DoricInterfaceJSE.h @@ -4,7 +4,9 @@ #include #include -class DoricInterfaceJSE { +#include "DoricExport.h" + +class DORIC_EXPORT DoricInterfaceJSE { public: virtual QString loadJS(QString script, QString source) = 0; diff --git a/doric-Qt/example/doric/engine/DoricPromise.h b/doric-Qt/example/doric/engine/DoricPromise.h index d0b43946..9cf15080 100644 --- a/doric-Qt/example/doric/engine/DoricPromise.h +++ b/doric-Qt/example/doric/engine/DoricPromise.h @@ -6,7 +6,9 @@ #include "DoricContext.h" #include "utils/DoricConstant.h" -class DoricPromise { +#include "DoricExport.h" + +class DORIC_EXPORT DoricPromise { public: static void resolve(DoricContext *context, QString callbackId, QVariantList args) { diff --git a/doric-Qt/example/doric/engine/native/NativeExecutor.h b/doric-Qt/example/doric/engine/native/NativeExecutor.h index 171db46f..b4e53989 100644 --- a/doric-Qt/example/doric/engine/native/NativeExecutor.h +++ b/doric-Qt/example/doric/engine/native/NativeExecutor.h @@ -3,7 +3,9 @@ #include -class NativeExecutor { +#include "DoricExport.h" + +class DORIC_EXPORT NativeExecutor { private: QJSEngine *mJSEngine; diff --git a/doric-Qt/example/doric/engine/v8/V8Executor.h b/doric-Qt/example/doric/engine/v8/V8Executor.h index b5f3be2d..0b151031 100644 --- a/doric-Qt/example/doric/engine/v8/V8Executor.h +++ b/doric-Qt/example/doric/engine/v8/V8Executor.h @@ -8,10 +8,12 @@ #include #include +#include "DoricExport.h" + static QMap> *map = new QMap>(); -class V8Executor { +class DORIC_EXPORT V8Executor { private: std::unique_ptr platform; diff --git a/doric-Qt/example/doric/loader/DoricAssetJSLoader.cpp b/doric-Qt/example/doric/loader/DoricAssetJSLoader.cpp new file mode 100644 index 00000000..d9c5484a --- /dev/null +++ b/doric-Qt/example/doric/loader/DoricAssetJSLoader.cpp @@ -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 DoricAssetJSLoader::request(QString source) { + QString protocol = "assets://"; + QString assetPath = source.mid(protocol.length()); + + std::shared_ptr asyncResult = + std::make_shared(); + + return asyncResult; +} diff --git a/doric-Qt/example/doric/loader/DoricAssetJSLoader.h b/doric-Qt/example/doric/loader/DoricAssetJSLoader.h new file mode 100644 index 00000000..4bdcd07a --- /dev/null +++ b/doric-Qt/example/doric/loader/DoricAssetJSLoader.h @@ -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 request(QString source) override; +}; + +#endif // DORICASSETJSLOADER_H diff --git a/doric-Qt/example/doric/loader/DoricInterfaceLoader.h b/doric-Qt/example/doric/loader/DoricInterfaceLoader.h index d48c1dde..95e141b5 100644 --- a/doric-Qt/example/doric/loader/DoricInterfaceLoader.h +++ b/doric-Qt/example/doric/loader/DoricInterfaceLoader.h @@ -1,11 +1,13 @@ #ifndef DORICINTERFACELOADER_H #define DORICINTERFACELOADER_H -#include "async/DoricAsyncResult.h" - #include -class DoricInterfaceLoader { +#include "DoricExport.h" + +#include "async/DoricAsyncResult.h" + +class DORIC_EXPORT DoricInterfaceLoader { public: virtual bool filter(QString source) = 0; diff --git a/doric-Qt/example/doric/loader/DoricJSLoaderManager.cpp b/doric-Qt/example/doric/loader/DoricJSLoaderManager.cpp index c4c4ebb4..5f1b5db6 100644 --- a/doric-Qt/example/doric/loader/DoricJSLoaderManager.cpp +++ b/doric-Qt/example/doric/loader/DoricJSLoaderManager.cpp @@ -1,7 +1,10 @@ #include "DoricJSLoaderManager.h" +#include "DoricAssetJSLoader.h" DoricJSLoaderManager::DoricJSLoaderManager() { qDebug() << "DoricJSLoaderManager constructor"; + + addJSLoader(new DoricAssetJSLoader()); } void DoricJSLoaderManager::addJSLoader(DoricInterfaceLoader *jsLoader) { diff --git a/doric-Qt/example/doric/loader/DoricJSLoaderManager.h b/doric-Qt/example/doric/loader/DoricJSLoaderManager.h index 2d6e0823..ab90c5ae 100644 --- a/doric-Qt/example/doric/loader/DoricJSLoaderManager.h +++ b/doric-Qt/example/doric/loader/DoricJSLoaderManager.h @@ -3,9 +3,11 @@ #include +#include "DoricExport.h" + #include "DoricInterfaceLoader.h" -class DoricJSLoaderManager { +class DORIC_EXPORT DoricJSLoaderManager { private: static DoricJSLoaderManager *local_instance; diff --git a/doric-Qt/example/doric/plugin/DoricNativePlugin.h b/doric-Qt/example/doric/plugin/DoricNativePlugin.h index 3632eaaf..1172eb73 100644 --- a/doric-Qt/example/doric/plugin/DoricNativePlugin.h +++ b/doric-Qt/example/doric/plugin/DoricNativePlugin.h @@ -1,9 +1,11 @@ #ifndef DORICNATIVEPLUGIN_H #define DORICNATIVEPLUGIN_H +#include "DoricExport.h" + #include "../utils/DoricContextHolder.h" -class DoricNativePlugin : public DoricContextHolder { +class DORIC_EXPORT DoricNativePlugin : public DoricContextHolder { public: using DoricContextHolder::DoricContextHolder; }; diff --git a/doric-Qt/example/doric/template/DoricSingleton.h b/doric-Qt/example/doric/template/DoricSingleton.h index d6542cc4..c989e4e6 100644 --- a/doric-Qt/example/doric/template/DoricSingleton.h +++ b/doric-Qt/example/doric/template/DoricSingleton.h @@ -3,7 +3,9 @@ #include -class DoricSingleton { +#include "DoricExport.h" + +class DORIC_EXPORT DoricSingleton { private: static DoricSingleton *local_instance; DoricSingleton() { qDebug() << "constructor"; } diff --git a/doric-Qt/example/doric/utils/DoricGlobalBroadcast.h b/doric-Qt/example/doric/utils/DoricGlobalBroadcast.h index 057ade81..95a83499 100644 --- a/doric-Qt/example/doric/utils/DoricGlobalBroadcast.h +++ b/doric-Qt/example/doric/utils/DoricGlobalBroadcast.h @@ -3,7 +3,9 @@ #include -class DoricGlobalBroadcast { +#include "DoricExport.h" + +class DORIC_EXPORT DoricGlobalBroadcast { private: static DoricGlobalBroadcast *local_instance; DoricGlobalBroadcast() { qDebug() << "DoricGlobalBroadcast constructor"; } diff --git a/doric-Qt/example/doric/utils/DoricNetworkService.h b/doric-Qt/example/doric/utils/DoricNetworkService.h index df632336..dc2bdd28 100644 --- a/doric-Qt/example/doric/utils/DoricNetworkService.h +++ b/doric-Qt/example/doric/utils/DoricNetworkService.h @@ -9,7 +9,9 @@ #include #include -class InnerTask : public QObject { +#include "DoricExport.h" + +class DORIC_EXPORT InnerTask : public QObject { Q_OBJECT private: QNetworkRequest httpRequest; @@ -63,7 +65,7 @@ signals: void response(int code, QList headers, QByteArray data); }; -class DoricNetworkService : public QObject { +class DORIC_EXPORT DoricNetworkService : public QObject { Q_OBJECT private: QThread thread; diff --git a/doric-Qt/example/doric/utils/DoricObjectFactory.h b/doric-Qt/example/doric/utils/DoricObjectFactory.h index 55000621..faedd837 100644 --- a/doric-Qt/example/doric/utils/DoricObjectFactory.h +++ b/doric-Qt/example/doric/utils/DoricObjectFactory.h @@ -5,7 +5,9 @@ #include #include -class DoricObjectFactory { +#include "DoricExport.h" + +class DORIC_EXPORT DoricObjectFactory { public: template static void registerClass(QString name) { constructors().insert(name, &constructorHelper); diff --git a/doric-Qt/example/doric/utils/DoricUtils.h b/doric-Qt/example/doric/utils/DoricUtils.h index 796d00af..3e76a855 100644 --- a/doric-Qt/example/doric/utils/DoricUtils.h +++ b/doric-Qt/example/doric/utils/DoricUtils.h @@ -7,7 +7,9 @@ #include #include -class DoricUtils { +#include "DoricExport.h" + +class DORIC_EXPORT DoricUtils { public: static QString readAssetFile(QString preffix, QString assetName) { QResource resource(":" + preffix + "/" + assetName);