File indexing completed on 2024-06-23 05:49:04
0001 /* 0002 This file is part of the Okteta Kasten Framework, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2010, 2011 Alex Richardson <alex.richardson@gmx.de> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef KASTEN_SCRIPTHANDLER_HPP 0010 #define KASTEN_SCRIPTHANDLER_HPP 0011 0012 #include "scripthandlerinfo.hpp" 0013 // Std 0014 #include <memory> 0015 0016 class DataInformation; 0017 class ArrayDataInformation; 0018 class TaggedUnionDataInformation; 0019 class ScriptLogger; 0020 class TopLevelDataInformation; 0021 class QScriptEngineDebugger; 0022 class QScriptValue; 0023 class QString; 0024 0025 class ScriptHandler 0026 { 0027 public: 0028 ScriptHandler(QScriptEngine* engine, TopLevelDataInformation* topLevel); 0029 ScriptHandler(const ScriptHandler&) = delete; 0030 0031 virtual ~ScriptHandler(); 0032 0033 ScriptHandler& operator=(const ScriptHandler&) = delete; 0034 0035 public: 0036 void validateData(DataInformation* data); 0037 /** The pointer may be changed while updating, CHECK AS SOON AS FUNCTION RETURNS! */ 0038 void updateDataInformation(DataInformation* data); 0039 void updateLength(ArrayDataInformation* array); 0040 QString customToString(const DataInformation* data, const QScriptValue& func); 0041 0042 QScriptEngine* engine() const; 0043 ScriptHandlerInfo* handlerInfo(); 0044 0045 QScriptValue callFunction(QScriptValue func, DataInformation* data, ScriptHandlerInfo::Mode mode); 0046 0047 private: 0048 std::unique_ptr<QScriptEngine> mEngine; 0049 TopLevelDataInformation* mTopLevel; 0050 ScriptHandlerInfo mHandlerInfo; 0051 }; 0052 0053 #endif /* KASTEN_SCRIPTHANDLER_HPP */