File indexing completed on 2024-04-21 15:02:59
0001 /*************************************************************************** 0002 * plugin.h 0003 * This file is part of the KDE project 0004 * copyright (C)2007 by Sebastian Sauer (mail@dipe.org) 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Library General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2 of the License, or (at your option) any later version. 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * Library General Public License for more details. 0014 * You should have received a copy of the GNU Library General Public License 0015 * along with this program; see the file COPYING. If not, write to 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 ***************************************************************************/ 0019 0020 #ifndef KROSS_ECMAPLUGIN_H 0021 #define KROSS_ECMAPLUGIN_H 0022 0023 #include <QScriptEngine> 0024 #include <QScriptExtensionPlugin> 0025 //#include <QVariant> 0026 //#include <QObject> 0027 //#include <QDir> 0028 //#include <QDomAttr> 0029 //#include <QAction> 0030 //#include <QUrl> 0031 0032 //#include "errorinterface.h" 0033 //#include "childreninterface.h" 0034 0035 #define KROSSQTSPLUGIN_EXPORT Q_DECL_EXPORT 0036 0037 namespace Kross 0038 { 0039 0040 /** 0041 * Kross QtScript Extension that provides access to the Kross Scripting Framework 0042 * within the QtScript scripting language. This EcmaPlugin does implement the 0043 * extension named "kross". 0044 */ 0045 class KROSSQTSPLUGIN_EXPORT EcmaPlugin : public QScriptExtensionPlugin 0046 { 0047 Q_OBJECT 0048 Q_PLUGIN_METADATA(IID "org.kde.EcmaPlugin") 0049 public: 0050 0051 /** 0052 * Constructor. 0053 * 0054 * \param parent Optional QObject parent of this QObject. 0055 */ 0056 EcmaPlugin(QObject *parent = nullptr); 0057 0058 /** 0059 * Destructor. 0060 */ 0061 ~EcmaPlugin() override; 0062 0063 /** 0064 * Initializes this extension. 0065 * 0066 * \param key The key to differ between extensions. We provide 0067 * the extension which key is "kross". 0068 * \param engine The QScriptEngine instance. 0069 */ 0070 void initialize(const QString &key, QScriptEngine *engine) override; 0071 0072 /** 0073 * Returns the list of keys this plugin supports. 0074 * 0075 * \return a QStringList with the single item "kross" to let 0076 * QtScript know, that we provide an extension with that key. 0077 */ 0078 QStringList keys() const override; 0079 0080 private: 0081 /// \internal d-pointer class. 0082 class Private; 0083 /// \internal d-pointer instance. 0084 Private *const d; 0085 }; 0086 0087 } 0088 0089 #endif 0090