1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). |
4 | ** Contact: http://www.qt-project.org/legal |
5 | ** |
6 | ** This file is part of the QtCore module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and Digia. For licensing terms and |
14 | ** conditions see http://qt.digia.com/licensing. For further information |
15 | ** use the contact form at http://qt.digia.com/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 2.1 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
24 | ** |
25 | ** In addition, as a special exception, Digia gives you certain additional |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
28 | ** |
29 | ** GNU General Public License Usage |
30 | ** Alternatively, this file may be used under the terms of the GNU |
31 | ** General Public License version 3.0 as published by the Free Software |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the |
33 | ** packaging of this file. Please review the following information to |
34 | ** ensure the GNU General Public License version 3.0 requirements will be |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. |
36 | ** |
37 | ** |
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 | int methodIndex() const; |
73 | int revision() const; |
74 | |
75 | inline const QMetaObject *enclosingMetaObject() const { return mobj; } |
76 | |
77 | bool invoke(QObject *object, |
78 | Qt::ConnectionType connectionType, |
79 | QGenericReturnArgument returnValue, |
80 | QGenericArgument val0 = QGenericArgument(0), |
81 | QGenericArgument val1 = QGenericArgument(), |
82 | QGenericArgument val2 = QGenericArgument(), |
83 | QGenericArgument val3 = QGenericArgument(), |
84 | QGenericArgument val4 = QGenericArgument(), |
85 | QGenericArgument val5 = QGenericArgument(), |
86 | QGenericArgument val6 = QGenericArgument(), |
87 | QGenericArgument val7 = QGenericArgument(), |
88 | QGenericArgument val8 = QGenericArgument(), |
89 | QGenericArgument val9 = QGenericArgument()) const; |
90 | inline bool invoke(QObject *object, |
91 | QGenericReturnArgument returnValue, |
92 | QGenericArgument val0 = QGenericArgument(0), |
93 | QGenericArgument val1 = QGenericArgument(), |
94 | QGenericArgument val2 = QGenericArgument(), |
95 | QGenericArgument val3 = QGenericArgument(), |
96 | QGenericArgument val4 = QGenericArgument(), |
97 | QGenericArgument val5 = QGenericArgument(), |
98 | QGenericArgument val6 = QGenericArgument(), |
99 | QGenericArgument val7 = QGenericArgument(), |
100 | QGenericArgument val8 = QGenericArgument(), |
101 | QGenericArgument val9 = QGenericArgument()) const |
102 | { |
103 | return invoke(object, Qt::AutoConnection, returnValue, |
104 | val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); |
105 | } |
106 | inline bool invoke(QObject *object, |
107 | Qt::ConnectionType connectionType, |
108 | QGenericArgument val0 = QGenericArgument(0), |
109 | QGenericArgument val1 = QGenericArgument(), |
110 | QGenericArgument val2 = QGenericArgument(), |
111 | QGenericArgument val3 = QGenericArgument(), |
112 | QGenericArgument val4 = QGenericArgument(), |
113 | QGenericArgument val5 = QGenericArgument(), |
114 | QGenericArgument val6 = QGenericArgument(), |
115 | QGenericArgument val7 = QGenericArgument(), |
116 | QGenericArgument val8 = QGenericArgument(), |
117 | QGenericArgument val9 = QGenericArgument()) const |
118 | { |
119 | return invoke(object, connectionType, QGenericReturnArgument(), |
120 | val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); |
121 | } |
122 | inline bool invoke(QObject *object, |
123 | QGenericArgument val0 = QGenericArgument(0), |
124 | QGenericArgument val1 = QGenericArgument(), |
125 | QGenericArgument val2 = QGenericArgument(), |
126 | QGenericArgument val3 = QGenericArgument(), |
127 | QGenericArgument val4 = QGenericArgument(), |
128 | QGenericArgument val5 = QGenericArgument(), |
129 | QGenericArgument val6 = QGenericArgument(), |
130 | QGenericArgument val7 = QGenericArgument(), |
131 | QGenericArgument val8 = QGenericArgument(), |
132 | QGenericArgument val9 = QGenericArgument()) const |
133 | { |
134 | return invoke(object, Qt::AutoConnection, QGenericReturnArgument(), |
135 | val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); |
136 | } |
137 | |
138 | private: |
139 | const QMetaObject *mobj; |
140 | uint handle; |
141 | friend struct QMetaObject; |
142 | friend struct QMetaObjectPrivate; |
143 | friend class QObject; |
144 | }; |
145 | Q_DECLARE_TYPEINFO(QMetaMethod, Q_MOVABLE_TYPE); |
146 | |
147 | class Q_CORE_EXPORT QMetaEnum |
148 | { |
149 | public: |
150 | inline QMetaEnum() : mobj(0),handle(0) {} |
151 | |
152 | const char *name() const; |
153 | bool isFlag() const; |
154 | |
155 | int keyCount() const; |
156 | const char *key(int index) const; |
157 | int value(int index) const; |
158 | |
159 | const char *scope() const; |
160 | |
161 | int keyToValue(const char *key) const; |
162 | const char* valueToKey(int value) const; |
163 | int keysToValue(const char * keys) const; |
164 | QByteArray valueToKeys(int value) const; |
165 | |
166 | inline const QMetaObject *enclosingMetaObject() const { return mobj; } |
167 | |
168 | inline bool isValid() const { return name() != 0; } |
169 | private: |
170 | const QMetaObject *mobj; |
171 | uint handle; |
172 | friend struct QMetaObject; |
173 | }; |
174 | Q_DECLARE_TYPEINFO(QMetaEnum, Q_MOVABLE_TYPE); |
175 | |
176 | class Q_CORE_EXPORT QMetaProperty |
177 | { |
178 | public: |
179 | QMetaProperty(); |
180 | |
181 | const char *name() const; |
182 | const char *typeName() const; |
183 | QVariant::Type type() const; |
184 | int userType() const; |
185 | int propertyIndex() const; |
186 | |
187 | bool isReadable() const; |
188 | bool isWritable() const; |
189 | bool isResettable() const; |
190 | bool isDesignable(const QObject *obj = 0) const; |
191 | bool isScriptable(const QObject *obj = 0) const; |
192 | bool isStored(const QObject *obj = 0) const; |
193 | bool isEditable(const QObject *obj = 0) const; |
194 | bool isUser(const QObject *obj = 0) const; |
195 | bool isConstant() const; |
196 | bool isFinal() const; |
197 | |
198 | bool isFlagType() const; |
199 | bool isEnumType() const; |
200 | QMetaEnum enumerator() const; |
201 | |
202 | bool hasNotifySignal() const; |
203 | QMetaMethod notifySignal() const; |
204 | int notifySignalIndex() const; |
205 | |
206 | int revision() const; |
207 | |
208 | QVariant read(const QObject *obj) const; |
209 | bool write(QObject *obj, const QVariant &value) const; |
210 | bool reset(QObject *obj) const; |
211 | |
212 | bool hasStdCppSet() const; |
213 | inline bool isValid() const { return isReadable(); } |
214 | inline const QMetaObject *enclosingMetaObject() const { return mobj; } |
215 | |
216 | private: |
217 | const QMetaObject *mobj; |
218 | uint handle; |
219 | int idx; |
220 | QMetaEnum ; |
221 | friend struct QMetaObject; |
222 | }; |
223 | |
224 | class Q_CORE_EXPORT QMetaClassInfo |
225 | { |
226 | public: |
227 | inline QMetaClassInfo() : mobj(0),handle(0) {} |
228 | const char *name() const; |
229 | const char *value() const; |
230 | inline const QMetaObject *enclosingMetaObject() const { return mobj; } |
231 | private: |
232 | const QMetaObject *mobj; |
233 | uint handle; |
234 | friend struct QMetaObject; |
235 | }; |
236 | Q_DECLARE_TYPEINFO(QMetaClassInfo, Q_MOVABLE_TYPE); |
237 | |
238 | QT_END_NAMESPACE |
239 | |
240 | QT_END_HEADER |
241 | |
242 | #endif // QMETAOBJECT_H |
243 | |