~ubuntu-branches/ubuntu/trusty/tomahawk/trusty-proposed

« back to all changes in this revision

Viewing changes to thirdparty/qxt/qxtweb-standalone/qxtweb/qxtmetaobject.h

  • Committer: Package Import Robot
  • Author(s): Harald Sitter
  • Date: 2013-03-07 21:50:13 UTC
  • Revision ID: package-import@ubuntu.com-20130307215013-6gdjkdds7i9uenvs
Tags: upstream-0.6.0+dfsg
ImportĀ upstreamĀ versionĀ 0.6.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
 **
 
3
 ** Copyright (C) Qxt Foundation. Some rights reserved.
 
4
 **
 
5
 ** This file is part of the QxtCore module of the Qxt library.
 
6
 **
 
7
 ** This library is free software; you can redistribute it and/or modify it
 
8
 ** under the terms of the Common Public License, version 1.0, as published
 
9
 ** by IBM, and/or under the terms of the GNU Lesser General Public License,
 
10
 ** version 2.1, as published by the Free Software Foundation.
 
11
 **
 
12
 ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
 
13
 ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
 
14
 ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
 
15
 ** FITNESS FOR A PARTICULAR PURPOSE.
 
16
 **
 
17
 ** You should have received a copy of the CPL and the LGPL along with this
 
18
 ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
 
19
 ** included with the source distribution for more information.
 
20
 ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
 
21
 **
 
22
 ** <http://libqxt.org>  <foundation@libqxt.org>
 
23
 **
 
24
 ****************************************************************************/
 
25
#ifndef QXTMETAOBJECT_H
 
26
#define QXTMETAOBJECT_H
 
27
 
 
28
#include <QMetaObject>
 
29
#include <QVariant>
 
30
#include <QGenericArgument>
 
31
#include <typeinfo>
 
32
#include "qxtnullable.h"
 
33
#include "qxtglobal.h"
 
34
QT_FORWARD_DECLARE_CLASS(QByteArray)
 
35
class QxtBoundArgument;
 
36
class QxtBoundFunction;
 
37
 
 
38
#define QXT_PROTO_10ARGS(T) T p1 = T(), T p2 = T(), T p3 = T(), T p4 = T(), T p5 = T(), T p6 = T(), T p7 = T(), T p8 = T(), T p9 = T(), T p10 = T()
 
39
#define QXT_PROTO_9ARGS(T) T p2 = T(), T p3 = T(), T p4 = T(), T p5 = T(), T p6 = T(), T p7 = T(), T p8 = T(), T p9 = T(), T p10 = T()
 
40
#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
 
41
 
 
42
class QXT_CORE_EXPORT QxtGenericFunctionPointer
 
43
{
 
44
    template<typename FUNCTION>
 
45
    friend QxtGenericFunctionPointer qxtFuncPtr(FUNCTION funcPtr);
 
46
public:
 
47
    QxtGenericFunctionPointer(const QxtGenericFunctionPointer& other)
 
48
    {
 
49
        funcPtr = other.funcPtr;
 
50
        typeName = other.typeName;
 
51
    }
 
52
 
 
53
    typedef void(voidFunc)();
 
54
    voidFunc* funcPtr;
 
55
    QByteArray typeName;
 
56
 
 
57
protected:
 
58
    QxtGenericFunctionPointer(voidFunc* ptr, const QByteArray& typeIdName)
 
59
    {
 
60
        funcPtr = ptr;
 
61
        typeName = typeIdName;
 
62
    }
 
63
};
 
64
 
 
65
template<typename FUNCTION>
 
66
QxtGenericFunctionPointer qxtFuncPtr(FUNCTION funcPtr)
 
67
{
 
68
    return QxtGenericFunctionPointer(reinterpret_cast<QxtGenericFunctionPointer::voidFunc*>(funcPtr), typeid(funcPtr).name());
 
69
}
 
70
 
 
71
namespace QxtMetaObject
 
72
{
 
73
    QXT_CORE_EXPORT QByteArray methodName(const char* method);
 
74
    QXT_CORE_EXPORT QByteArray methodSignature(const char* method);
 
75
 
 
76
    QXT_CORE_EXPORT bool isSignalOrSlot(const char* method);
 
77
 
 
78
    QXT_CORE_EXPORT QxtBoundFunction* bind(QObject* recv, const char* invokable, QXT_PROTO_10ARGS(QGenericArgument));
 
79
    QXT_CORE_EXPORT QxtBoundFunction* bind(QObject* recv, const char* invokable, QVariant p1, QXT_PROTO_9ARGS(QVariant));
 
80
    QXT_CORE_EXPORT bool connect(QObject* sender, const char* signal, QxtBoundFunction* slot,
 
81
                                 Qt::ConnectionType type = Qt::AutoConnection);
 
82
 
 
83
    QXT_CORE_EXPORT bool invokeMethod(QObject* object, const char* member,
 
84
                           const QVariant& arg0 = QVariant(), const QVariant& arg1 = QVariant(),
 
85
                           const QVariant& arg2 = QVariant(), const QVariant& arg3 = QVariant(),
 
86
                           const QVariant& arg4 = QVariant(), const QVariant& arg5 = QVariant(),
 
87
                           const QVariant& arg6 = QVariant(), const QVariant& arg7 = QVariant(),
 
88
                           const QVariant& arg8 = QVariant(), const QVariant& arg9 = QVariant());
 
89
 
 
90
    QXT_CORE_EXPORT bool invokeMethod(QObject* object, const char* member, Qt::ConnectionType type,
 
91
                           const QVariant& arg0 = QVariant(), const QVariant& arg1 = QVariant(),
 
92
                           const QVariant& arg2 = QVariant(), const QVariant& arg3 = QVariant(),
 
93
                           const QVariant& arg4 = QVariant(), const QVariant& arg5 = QVariant(),
 
94
                           const QVariant& arg6 = QVariant(), const QVariant& arg7 = QVariant(),
 
95
                           const QVariant& arg8 = QVariant(), const QVariant& arg9 = QVariant());
 
96
}
 
97
 
 
98
/*!
 
99
 * \relates QxtMetaObject
 
100
 * Refers to the n'th parameter of QxtBoundFunction::invoke() or of a signal connected to
 
101
 * a QxtBoundFunction.
 
102
 * \sa QxtMetaObject::bind
 
103
 */
 
104
#define QXT_BIND(n) QGenericArgument("QxtBoundArgument", reinterpret_cast<void*>(n))
 
105
 
 
106
#endif // QXTMETAOBJECT_H