Showing the changes to libraries/script-engine/src/qtscript/ScriptEngineQtScript.h (1 of 11 files). Show all
Unified · Split
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <QtCore/QMutex> |
| 25 | 25 | #include <QtCore/QObject> |
| 26 | 26 | #include <QtCore/QPointer> |
| 27 | +#include <QtCore/QSharedPointer> | |
| 27 | 28 | #include <QtCore/QString> |
| 28 | 29 | |
| 29 | 30 | #include <QtScript/QScriptEngine> |
| @@ -34,13 +35,12 @@ · 4 unmodified lines | ||
| 34 | 35 | #include "ArrayBufferClass.h" |
| 35 | 36 | |
| 36 | 37 | class ScriptContextQtWrapper; |
| 37 | −class ScriptContextQtAgent; | |
| 38 | 38 | class ScriptEngineQtScript; |
| 39 | 39 | class ScriptManager; |
| 40 | −using ScriptEngineQtScriptPointer = std::shared_ptr<ScriptEngineQtScript>; | |
| 40 | +class ScriptObjectQtProxy; | |
| 41 | 41 | using ScriptContextQtPointer = std::shared_ptr<ScriptContextQtWrapper>; |
| 42 | 42 | |
| 43 | −Q_DECLARE_METATYPE(ScriptEngineQtScriptPointer); | |
| 43 | +Q_DECLARE_METATYPE(ScriptEngine::FunctionSignature) | |
| 44 | 44 | |
| 45 | 45 | /// [QtScript] Implements ScriptEngine for QtScript and translates calls for QScriptEngine |
| 46 | 46 | class ScriptEngineQtScript final : public QScriptEngine, |
| @@ -50,7 +50,6 @@ class ScriptEngineQtScript final : public QScriptEngine, · 3 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | public: // construction |
| 52 | 52 | ScriptEngineQtScript(ScriptManager* scriptManager = nullptr); |
| 53 | − ~ScriptEngineQtScript(); | |
| 54 | 53 | |
| 55 | 54 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 56 | 55 | // NOTE - these are NOT intended to be public interfaces available to scripts, the are only Q_INVOKABLE so we can |
| @@ -150,11 +149,16 @@ public: // public non-interface methods for other QtScript-specific classes to u · 93 unmodified lines | ||
| 150 | 149 | |
| 151 | 150 | public: // not for public use, but I don't like how Qt strings this along with private friend functions |
| 152 | 151 | virtual ScriptValue create(int type, const void* ptr) override; |
| 153 | − virtual QVariant convert(const ScriptValue& value, int type) override; | |
| 152 | + virtual QVariant convert(const ScriptValue& value, int typeId) override; | |
| 154 | 153 | virtual void registerCustomType(int type, ScriptEngine::MarshalFunction marshalFunc, |
| 155 | 154 | ScriptEngine::DemarshalFunction demarshalFunc) override; |
| 156 | − bool castValueToVariant(const QScriptValue& val, QVariant& dest, int destType); | |
| 155 | + bool castValueToVariant(const QScriptValue& val, QVariant& dest, int destTypeId); | |
| 157 | 156 | QScriptValue castVariantToValue(const QVariant& val); |
| 157 | + static QString valueType(const QScriptValue& val); | |
| 158 | + | |
| 159 | + using ObjectWrapperMap = QMap<QObject*, QWeakPointer<ScriptObjectQtProxy>>; | |
| 160 | + mutable QMutex _qobjectWrapperMapProtect; | |
| 161 | + ObjectWrapperMap _qobjectWrapperMap; | |
| 158 | 162 | |
| 159 | 163 | protected: |
| 160 | 164 | // like `newFunction`, but allows mapping inline C++ lambdas with captures as callable QScriptValues |
| @@ -180,14 +184,11 @@ protected: · 19 unmodified lines | ||
| 180 | 184 | mutable QMutex _customTypeProtect; |
| 181 | 185 | CustomMarshalMap _customTypes; |
| 182 | 186 | CustomPrototypeMap _customPrototypes; |
| 183 | − int _nextCustomType = 0; | |
| 184 | 187 | ScriptValue _nullValue; |
| 185 | 188 | ScriptValue _undefinedValue; |
| 186 | 189 | mutable ScriptContextQtPointer _currContext; |
| 187 | 190 | |
| 188 | 191 | ArrayBufferClass* _arrayBufferClass; |
| 189 | − | |
| 190 | − ScriptContextQtAgent* _contextAgent{ nullptr }; | |
| 191 | 192 | }; |
| 192 | 193 | |
| 193 | 194 | // Lambda helps create callable QScriptValues out of std::functions: |