Showing the changes to libraries/script-engine/src/qtscript/ScriptEngineQtScript.h (1 of 2 files). Show all
Unified · Split
| @@ -382,7 +382,8 @@ signals: · 381 unmodified lines | ||
| 382 | 382 | public: // not for public use, but I don't like how Qt strings this along with private friend functions |
| 383 | 383 | virtual ScriptValuePointer create(int type, const void* ptr); |
| 384 | 384 | virtual bool convert(const ScriptValuePointer& value, int type, void* ptr); |
| 385 | − virtual void registerCustomType(int type, ScriptEngine::MarshalFunction mf, ScriptEngine::DemarshalFunction df, const ScriptValuePointer& prototype); | |
| 385 | + virtual void registerCustomType(int type, ScriptEngine::MarshalFunction marshalFunc, | |
| 386 | + ScriptEngine::DemarshalFunction demarshalFunc, const ScriptValuePointer& prototype); | |
| 386 | 387 | |
| 387 | 388 | protected: |
| 388 | 389 | // like `newFunction`, but allows mapping inline C++ lambdas with captures as callable QScriptValues |
| @@ -403,6 +404,16 @@ protected: · 14 unmodified lines | ||
| 403 | 404 | */ |
| 404 | 405 | Q_INVOKABLE void executeOnScriptThread(std::function<void()> function, const Qt::ConnectionType& type = Qt::QueuedConnection ); |
| 405 | 406 | |
| 407 | + // store for handling custom type marshaling/demarshaling | |
| 408 | + struct CustomTypeInfo { | |
| 409 | + ScriptEngine::MarshalFunction marshalFunc; | |
| 410 | + ScriptEngine::DemarshalFunction demarshalFunc; | |
| 411 | + ScriptValuePointer prototype; | |
| 412 | + }; | |
| 413 | + typedef std::map<int, CustomTypeInfo> TCustomTypeMap; | |
| 414 | + TCustomTypeMap _customTypes; | |
| 415 | + std::mutex _customTypeProtect; | |
| 416 | + | |
| 406 | 417 | QPointer<ScriptManager> _manager; |
| 407 | 418 | |
| 408 | 419 | ScriptValuePointer _nullValue; |