1 /* This file is part of the KDE libraries
2     Copyright (C) 2005, 2006 Ian Reinhart Geiser <geiseri@kde.org>
3     Copyright (C) 2005, 2006 Matt Broadstone <mbroadst@gmail.com>
4     Copyright (C) 2005, 2006 Richard J. Moore <rich@kde.org>
5     Copyright (C) 2005, 2006 Erik L. Bunce <kde@bunce.us>
6 
7     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Library General Public
9     License as published by the Free Software Foundation; either
10     version 2 of the License, or (at your option) any later version.
11 
12     This library is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15     Library General Public License for more details.
16 
17     You should have received a copy of the GNU Library General Public License
18     along with this library; see the file COPYING.LIB.  If not, write to
19     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20     Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef SLOTPROXY_H
24 #define SLOTPROXY_H
25 
26 #include <QObject>
27 #include <QByteRef>
28 #include <QVariant>
29 #include <kjs/object.h>
30 #include "kjsembed.h"
31 
32 namespace KJS
33 {
34 class Interpreter;
35 class Value;
36 class List;
37 class ExecState;
38 }
39 
40 namespace KJSEmbed
41 {
42 class KJSEMBED_EXPORT SlotProxy : public QObject
43 {
44 public:
45     SlotProxy(KJS::JSObject *obj, KJS::Interpreter *interpreter, QObject *parent, const QByteArray &signature);
46     ~SlotProxy() override;
47     //Meta object stuff
48     QMetaObject staticMetaObject;
49     const QMetaObject *metaObject() const override;
50     void *qt_metacast(const char *_clname) override;
51     int qt_metacall(QMetaObject::Call _c, int _id, void **_a) override;
52 
53 private:
54     KJS::JSValue *callMethod(const QByteArray &methodName, void **_a);
55     KJS::List convertArguments(KJS::ExecState *exec, void **_a);
56     QByteArray m_signature;
57     uint m_data[16];
58     QByteArray m_stringData;
59     KJS::Interpreter *m_interpreter;
60     KJS::JSObject *m_object;
61     QVariant m_tmpResult;
62 };
63 }
64 #endif
65 
66