Fixes.
[quassel.git] / src / contrib / qxt / qxtmetaobject.h
1 /****************************************************************************
2 **
3 ** Copyright (C) Qxt Foundation. Some rights reserved.
4 **
5 ** This file is part of the QxtCore module of the Qt eXTension library
6 **
7 ** This library is free software; you can redistribute it and/or modify it
8 ** under the terms of th Common Public License, version 1.0, as published by
9 ** IBM.
10 **
11 ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
12 ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
13 ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
14 ** FITNESS FOR A PARTICULAR PURPOSE.
15 **
16 ** You should have received a copy of the CPL along with this file.
17 ** See the LICENSE file and the cpl1.0.txt file included with the source
18 ** distribution for more information. If you did not receive a copy of the
19 ** license, contact the Qxt Foundation.
20 **
21 ** <http://libqxt.sourceforge.net>  <foundation@libqxt.org>
22 **
23 ****************************************************************************/
24 #ifndef QXTMETAOBJECT_H
25 #define QXTMETAOBJECT_H
26
27 #include <QMetaObject>
28 #include <QVariant>
29 #include <QGenericArgument>
30 #include "qxtnullable.h"
31 class QByteArray;
32 class QxtBoundArgument;
33 class QxtBoundFunction;
34
35 #define QXT_PROTO_10ARGS(T) T p1 = T(), T p2 = T(), T p3 = T(), T p4 = T(), \
36         T p5 = T(), T p6 = T(), T p7 = T(), T p8 = T(), T p9 = T(), T p10 = T()
37 #define QXT_IMPL_10ARGS(T) T p1, T p2, T p3, T p4, T p5, T p6, T p7, T p8, T p9, T p10
38 namespace QxtMetaObject
39 {
40 QByteArray methodName(const char* method);
41 QByteArray methodSignature(const char* method);
42
43 bool isSignalOrSlot (const char* method);
44
45
46 QxtBoundFunction* bind(QObject* recv, const char* invokable, QXT_PROTO_10ARGS(QVariant));
47 QxtBoundFunction* bind(QObject* recv, const char* invokable, QXT_PROTO_10ARGS(QGenericArgument));
48 template <typename FP>
49 QxtBoundFunction* bindFunction(FP funcPointer, QXT_PROTO_10ARGS(QGenericArgument));
50 template <class T, typename FP>
51 QxtBoundFunction* bindMethod(T recv, FP funcPointer, QXT_PROTO_10ARGS(QGenericArgument));
52 bool connect(QObject* sender, const char* signal, QxtBoundFunction* slot,
53              Qt::ConnectionType type = Qt::AutoConnection);
54 }
55
56 #define QXT_BIND(i) QGenericArgument("QxtBoundArgument", reinterpret_cast<void*>(i))
57
58 #endif // QXTMETAOBJECT_H