1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QtCore module of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef QMETAOBJECT_H
|
---|
43 | #define QMETAOBJECT_H
|
---|
44 |
|
---|
45 | #include <QtCore/qobjectdefs.h>
|
---|
46 | #include <QtCore/qvariant.h>
|
---|
47 |
|
---|
48 | QT_BEGIN_HEADER
|
---|
49 |
|
---|
50 | QT_BEGIN_NAMESPACE
|
---|
51 |
|
---|
52 | QT_MODULE(Core)
|
---|
53 |
|
---|
54 | template <typename T> class QList;
|
---|
55 |
|
---|
56 | class Q_CORE_EXPORT QMetaMethod
|
---|
57 | {
|
---|
58 | public:
|
---|
59 | inline QMetaMethod() : mobj(0),handle(0) {}
|
---|
60 |
|
---|
61 | const char *signature() const;
|
---|
62 | const char *typeName() const;
|
---|
63 | QList<QByteArray> parameterTypes() const;
|
---|
64 | QList<QByteArray> parameterNames() const;
|
---|
65 | const char *tag() const;
|
---|
66 | enum Access { Private, Protected, Public };
|
---|
67 | Access access() const;
|
---|
68 | enum MethodType { Method, Signal, Slot, Constructor };
|
---|
69 | MethodType methodType() const;
|
---|
70 | enum Attributes { Compatibility = 0x1, Cloned = 0x2, Scriptable = 0x4 };
|
---|
71 | int attributes() const;
|
---|
72 |
|
---|
73 | inline const QMetaObject *enclosingMetaObject() const { return mobj; }
|
---|
74 |
|
---|
75 | bool invoke(QObject *object,
|
---|
76 | Qt::ConnectionType connectionType,
|
---|
77 | QGenericReturnArgument returnValue,
|
---|
78 | QGenericArgument val0 = QGenericArgument(0),
|
---|
79 | QGenericArgument val1 = QGenericArgument(),
|
---|
80 | QGenericArgument val2 = QGenericArgument(),
|
---|
81 | QGenericArgument val3 = QGenericArgument(),
|
---|
82 | QGenericArgument val4 = QGenericArgument(),
|
---|
83 | QGenericArgument val5 = QGenericArgument(),
|
---|
84 | QGenericArgument val6 = QGenericArgument(),
|
---|
85 | QGenericArgument val7 = QGenericArgument(),
|
---|
86 | QGenericArgument val8 = QGenericArgument(),
|
---|
87 | QGenericArgument val9 = QGenericArgument()) const;
|
---|
88 | inline bool invoke(QObject *object,
|
---|
89 | QGenericReturnArgument returnValue,
|
---|
90 | QGenericArgument val0 = QGenericArgument(0),
|
---|
91 | QGenericArgument val1 = QGenericArgument(),
|
---|
92 | QGenericArgument val2 = QGenericArgument(),
|
---|
93 | QGenericArgument val3 = QGenericArgument(),
|
---|
94 | QGenericArgument val4 = QGenericArgument(),
|
---|
95 | QGenericArgument val5 = QGenericArgument(),
|
---|
96 | QGenericArgument val6 = QGenericArgument(),
|
---|
97 | QGenericArgument val7 = QGenericArgument(),
|
---|
98 | QGenericArgument val8 = QGenericArgument(),
|
---|
99 | QGenericArgument val9 = QGenericArgument()) const
|
---|
100 | {
|
---|
101 | return invoke(object, Qt::AutoConnection, returnValue,
|
---|
102 | val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
|
---|
103 | }
|
---|
104 | inline bool invoke(QObject *object,
|
---|
105 | Qt::ConnectionType connectionType,
|
---|
106 | QGenericArgument val0 = QGenericArgument(0),
|
---|
107 | QGenericArgument val1 = QGenericArgument(),
|
---|
108 | QGenericArgument val2 = QGenericArgument(),
|
---|
109 | QGenericArgument val3 = QGenericArgument(),
|
---|
110 | QGenericArgument val4 = QGenericArgument(),
|
---|
111 | QGenericArgument val5 = QGenericArgument(),
|
---|
112 | QGenericArgument val6 = QGenericArgument(),
|
---|
113 | QGenericArgument val7 = QGenericArgument(),
|
---|
114 | QGenericArgument val8 = QGenericArgument(),
|
---|
115 | QGenericArgument val9 = QGenericArgument()) const
|
---|
116 | {
|
---|
117 | return invoke(object, connectionType, QGenericReturnArgument(),
|
---|
118 | val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
|
---|
119 | }
|
---|
120 | inline bool invoke(QObject *object,
|
---|
121 | QGenericArgument val0 = QGenericArgument(0),
|
---|
122 | QGenericArgument val1 = QGenericArgument(),
|
---|
123 | QGenericArgument val2 = QGenericArgument(),
|
---|
124 | QGenericArgument val3 = QGenericArgument(),
|
---|
125 | QGenericArgument val4 = QGenericArgument(),
|
---|
126 | QGenericArgument val5 = QGenericArgument(),
|
---|
127 | QGenericArgument val6 = QGenericArgument(),
|
---|
128 | QGenericArgument val7 = QGenericArgument(),
|
---|
129 | QGenericArgument val8 = QGenericArgument(),
|
---|
130 | QGenericArgument val9 = QGenericArgument()) const
|
---|
131 | {
|
---|
132 | return invoke(object, Qt::AutoConnection, QGenericReturnArgument(),
|
---|
133 | val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
|
---|
134 | }
|
---|
135 |
|
---|
136 | private:
|
---|
137 | const QMetaObject *mobj;
|
---|
138 | uint handle;
|
---|
139 | friend struct QMetaObject;
|
---|
140 | };
|
---|
141 | Q_DECLARE_TYPEINFO(QMetaMethod, Q_MOVABLE_TYPE);
|
---|
142 |
|
---|
143 | class Q_CORE_EXPORT QMetaEnum
|
---|
144 | {
|
---|
145 | public:
|
---|
146 | inline QMetaEnum() : mobj(0),handle(0) {}
|
---|
147 |
|
---|
148 | const char *name() const;
|
---|
149 | bool isFlag() const;
|
---|
150 |
|
---|
151 | int keyCount() const;
|
---|
152 | const char *key(int index) const;
|
---|
153 | int value(int index) const;
|
---|
154 |
|
---|
155 | const char *scope() const;
|
---|
156 |
|
---|
157 | int keyToValue(const char *key) const;
|
---|
158 | const char* valueToKey(int value) const;
|
---|
159 | int keysToValue(const char * keys) const;
|
---|
160 | QByteArray valueToKeys(int value) const;
|
---|
161 |
|
---|
162 | inline const QMetaObject *enclosingMetaObject() const { return mobj; }
|
---|
163 |
|
---|
164 | inline bool isValid() const { return name() != 0; }
|
---|
165 | private:
|
---|
166 | const QMetaObject *mobj;
|
---|
167 | uint handle;
|
---|
168 | friend struct QMetaObject;
|
---|
169 | };
|
---|
170 | Q_DECLARE_TYPEINFO(QMetaEnum, Q_MOVABLE_TYPE);
|
---|
171 |
|
---|
172 | class Q_CORE_EXPORT QMetaProperty
|
---|
173 | {
|
---|
174 | public:
|
---|
175 | QMetaProperty();
|
---|
176 |
|
---|
177 | const char *name() const;
|
---|
178 | const char *typeName() const;
|
---|
179 | QVariant::Type type() const;
|
---|
180 | int userType() const;
|
---|
181 |
|
---|
182 | bool isReadable() const;
|
---|
183 | bool isWritable() const;
|
---|
184 | bool isResettable() const;
|
---|
185 | bool isDesignable(const QObject *obj = 0) const;
|
---|
186 | bool isScriptable(const QObject *obj = 0) const;
|
---|
187 | bool isStored(const QObject *obj = 0) const;
|
---|
188 | bool isEditable(const QObject *obj = 0) const;
|
---|
189 | bool isUser(const QObject *obj = 0) const;
|
---|
190 |
|
---|
191 | bool isFlagType() const;
|
---|
192 | bool isEnumType() const;
|
---|
193 | QMetaEnum enumerator() const;
|
---|
194 |
|
---|
195 | bool hasNotifySignal() const;
|
---|
196 | QMetaMethod notifySignal() const;
|
---|
197 | int notifySignalIndex() const;
|
---|
198 |
|
---|
199 | QVariant read(const QObject *obj) const;
|
---|
200 | bool write(QObject *obj, const QVariant &value) const;
|
---|
201 | bool reset(QObject *obj) const;
|
---|
202 |
|
---|
203 | bool hasStdCppSet() const;
|
---|
204 | inline bool isValid() const { return isReadable(); }
|
---|
205 | inline const QMetaObject *enclosingMetaObject() const { return mobj; }
|
---|
206 |
|
---|
207 | private:
|
---|
208 | const QMetaObject *mobj;
|
---|
209 | uint handle;
|
---|
210 | int idx;
|
---|
211 | QMetaEnum menum;
|
---|
212 | friend struct QMetaObject;
|
---|
213 | };
|
---|
214 |
|
---|
215 | class Q_CORE_EXPORT QMetaClassInfo
|
---|
216 | {
|
---|
217 | public:
|
---|
218 | inline QMetaClassInfo() : mobj(0),handle(0) {}
|
---|
219 | const char *name() const;
|
---|
220 | const char *value() const;
|
---|
221 | inline const QMetaObject *enclosingMetaObject() const { return mobj; }
|
---|
222 | private:
|
---|
223 | const QMetaObject *mobj;
|
---|
224 | uint handle;
|
---|
225 | friend struct QMetaObject;
|
---|
226 | };
|
---|
227 | Q_DECLARE_TYPEINFO(QMetaClassInfo, Q_MOVABLE_TYPE);
|
---|
228 |
|
---|
229 | QT_END_NAMESPACE
|
---|
230 |
|
---|
231 | QT_END_HEADER
|
---|
232 |
|
---|
233 | #endif // QMETAOBJECT_H
|
---|