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