00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QOBJECTDEFS_H
00043 #define QOBJECTDEFS_H
00044
00045 #include <QtCore/qnamespace.h>
00046
00047 QT_BEGIN_HEADER
00048
00049 QT_BEGIN_NAMESPACE
00050
00051 QT_MODULE(Core)
00052
00053 class QByteArray;
00054
00055 class QString;
00056
00057 #ifndef Q_MOC_OUTPUT_REVISION
00058 #define Q_MOC_OUTPUT_REVISION 62
00059 #endif
00060
00061
00062
00063
00064 #ifndef Q_MOC_RUN
00065 # if defined(QT_NO_KEYWORDS)
00066 # define QT_NO_EMIT
00067 # else
00068 # define slots
00069 # define signals protected
00070 # endif
00071 # define Q_SLOTS
00072 # define Q_SIGNALS protected
00073 # define Q_PRIVATE_SLOT(d, signature)
00074 # define Q_EMIT
00075 #ifndef QT_NO_EMIT
00076 # define emit
00077 #endif
00078 #define Q_CLASSINFO(name, value)
00079 #define Q_INTERFACES(x)
00080 #define Q_PROPERTY(text)
00081 #define Q_PRIVATE_PROPERTY(d, text)
00082 #define Q_OVERRIDE(text)
00083 #define Q_ENUMS(x)
00084 #define Q_FLAGS(x)
00085 #ifdef QT3_SUPPORT
00086 # define Q_SETS(x)
00087 #endif
00088 #define Q_SCRIPTABLE
00089 #define Q_INVOKABLE
00090 #define Q_SIGNAL
00091 #define Q_SLOT
00092
00093 #ifndef QT_NO_TRANSLATION
00094 # ifndef QT_NO_TEXTCODEC
00095
00096
00097 # define QT_TR_FUNCTIONS \
00098 static inline QString tr(const char *s, const char *c = 0) \
00099 { return staticMetaObject.tr(s, c); } \
00100 static inline QString trUtf8(const char *s, const char *c = 0) \
00101 { return staticMetaObject.trUtf8(s, c); } \
00102 static inline QString tr(const char *s, const char *c, int n) \
00103 { return staticMetaObject.tr(s, c, n); } \
00104 static inline QString trUtf8(const char *s, const char *c, int n) \
00105 { return staticMetaObject.trUtf8(s, c, n); }
00106 # else
00107
00108
00109 # define QT_TR_FUNCTIONS \
00110 static inline QString tr(const char *s, const char *c = 0) \
00111 { return staticMetaObject.tr(s, c); } \
00112 static inline QString tr(const char *s, const char *c, int n) \
00113 { return staticMetaObject.tr(s, c, n); }
00114 # endif
00115 #else
00116
00117 # define QT_TR_FUNCTIONS
00118 #endif
00119
00120 #if defined(QT_NO_MEMBER_TEMPLATES) || defined(QT_NO_QOBJECT_CHECK)
00121
00122 #define Q_OBJECT_CHECK
00123 #else
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 #define Q_OBJECT_CHECK \
00139 template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const \
00140 { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i; }
00141
00142 template <typename T>
00143 inline int qYouForgotTheQ_OBJECT_Macro(T, T) { return 0; }
00144
00145 template <typename T1, typename T2>
00146 inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {}
00147 #endif // QT_NO_MEMBER_TEMPLATES
00148
00149 #ifdef Q_NO_DATA_RELOCATION
00150 #define Q_OBJECT_GETSTATICMETAOBJECT static const QMetaObject &getStaticMetaObject();
00151 #else
00152 #define Q_OBJECT_GETSTATICMETAOBJECT
00153 #endif
00154
00155
00156 #define Q_OBJECT \
00157 public: \
00158 Q_OBJECT_CHECK \
00159 static const QMetaObject staticMetaObject; \
00160 Q_OBJECT_GETSTATICMETAOBJECT \
00161 virtual const QMetaObject *metaObject() const; \
00162 virtual void *qt_metacast(const char *); \
00163 QT_TR_FUNCTIONS \
00164 virtual int qt_metacall(QMetaObject::Call, int, void **); \
00165 private:
00166
00167 #define Q_OBJECT_FAKE Q_OBJECT
00168
00169 #define Q_GADGET \
00170 public: \
00171 static const QMetaObject staticMetaObject; \
00172 Q_OBJECT_GETSTATICMETAOBJECT \
00173 private:
00174 #else // Q_MOC_RUN
00175 #define slots slots
00176 #define signals signals
00177 #define Q_SLOTS Q_SLOTS
00178 #define Q_SIGNALS Q_SIGNALS
00179 #define Q_CLASSINFO(name, value) Q_CLASSINFO(name, value)
00180 #define Q_INTERFACES(x) Q_INTERFACES(x)
00181 #define Q_PROPERTY(text) Q_PROPERTY(text)
00182 #define Q_PRIVATE_PROPERTY(d, text) Q_PRIVATE_PROPERTY(d, text)
00183 #define Q_OVERRIDE(text) Q_OVERRIDE(text)
00184 #define Q_ENUMS(x) Q_ENUMS(x)
00185 #define Q_FLAGS(x) Q_FLAGS(x)
00186 #ifdef QT3_SUPPORT
00187 # define Q_SETS(x) Q_SETS(x)
00188 #endif
00189
00190 #define Q_OBJECT Q_OBJECT
00191
00192 #define Q_OBJECT_FAKE Q_OBJECT_FAKE
00193
00194 #define Q_GADGET Q_GADGET
00195 #define Q_SCRIPTABLE Q_SCRIPTABLE
00196 #define Q_INVOKABLE Q_INVOKABLE
00197 #define Q_SIGNAL Q_SIGNAL
00198 #define Q_SLOT Q_SLOT
00199 #endif //Q_MOC_RUN
00200
00201
00202 #ifdef METHOD
00203 #undef METHOD
00204 #endif
00205 #ifdef SLOT
00206 #undef SLOT
00207 #endif
00208 #ifdef SIGNAL
00209 #undef SIGNAL
00210 #endif
00211
00212 Q_CORE_EXPORT const char *qFlagLocation(const char *method);
00213
00214 #define QTOSTRING_HELPER(s) #s
00215 #define QTOSTRING(s) QTOSTRING_HELPER(s)
00216 #ifndef QT_NO_DEBUG
00217 # define QLOCATION "\0"__FILE__":"QTOSTRING(__LINE__)
00218 # define METHOD(a) qFlagLocation("0"#a QLOCATION)
00219 # define SLOT(a) qFlagLocation("1"#a QLOCATION)
00220 # define SIGNAL(a) qFlagLocation("2"#a QLOCATION)
00221 #else
00222 # define METHOD(a) "0"#a
00223 # define SLOT(a) "1"#a
00224 # define SIGNAL(a) "2"#a
00225 #endif
00226
00227 #ifdef QT3_SUPPORT
00228 #define METHOD_CODE 0 // member type codes
00229 #define SLOT_CODE 1
00230 #define SIGNAL_CODE 2
00231 #endif
00232
00233 #define QMETHOD_CODE 0 // member type codes
00234 #define QSLOT_CODE 1
00235 #define QSIGNAL_CODE 2
00236
00237 #define Q_ARG(type, data) QArgument<type >(#type, data)
00238 #define Q_RETURN_ARG(type, data) QReturnArgument<type >(#type, data)
00239
00240 class QObject;
00241 class QMetaMethod;
00242 class QMetaEnum;
00243 class QMetaProperty;
00244 class QMetaClassInfo;
00245
00246
00247 class Q_CORE_EXPORT QGenericArgument
00248 {
00249 public:
00250 inline QGenericArgument(const char *aName = 0, const void *aData = 0)
00251 : _data(aData), _name(aName) {}
00252 inline void *data() const { return const_cast<void *>(_data); }
00253 inline const char *name() const { return _name; }
00254
00255 private:
00256 const void *_data;
00257 const char *_name;
00258 };
00259
00260 class Q_CORE_EXPORT QGenericReturnArgument: public QGenericArgument
00261 {
00262 public:
00263 inline QGenericReturnArgument(const char *aName = 0, void *aData = 0)
00264 : QGenericArgument(aName, aData)
00265 {}
00266 };
00267
00268 template <class T>
00269 class QArgument: public QGenericArgument
00270 {
00271 public:
00272 inline QArgument(const char *aName, const T &aData)
00273 : QGenericArgument(aName, static_cast<const void *>(&aData))
00274 {}
00275 };
00276 template <class T>
00277 class QArgument<T &>: public QGenericArgument
00278 {
00279 public:
00280 inline QArgument(const char *aName, T &aData)
00281 : QGenericArgument(aName, static_cast<const void *>(&aData))
00282 {}
00283 };
00284
00285
00286 template <typename T>
00287 class QReturnArgument: public QGenericReturnArgument
00288 {
00289 public:
00290 inline QReturnArgument(const char *aName, T &aData)
00291 : QGenericReturnArgument(aName, static_cast<void *>(&aData))
00292 {}
00293 };
00294
00295 struct Q_CORE_EXPORT QMetaObject
00296 {
00297 const char *className() const;
00298 const QMetaObject *superClass() const;
00299
00300 QObject *cast(QObject *obj) const;
00301
00302 #ifndef QT_NO_TRANSLATION
00303
00304 QString tr(const char *s, const char *c) const;
00305 QString trUtf8(const char *s, const char *c) const;
00306 QString tr(const char *s, const char *c, int n) const;
00307 QString trUtf8(const char *s, const char *c, int n) const;
00308 #endif // QT_NO_TRANSLATION
00309
00310 int methodOffset() const;
00311 int enumeratorOffset() const;
00312 int propertyOffset() const;
00313 int classInfoOffset() const;
00314
00315 int constructorCount() const;
00316 int methodCount() const;
00317 int enumeratorCount() const;
00318 int propertyCount() const;
00319 int classInfoCount() const;
00320
00321 int indexOfConstructor(const char *constructor) const;
00322 int indexOfMethod(const char *method) const;
00323 int indexOfSignal(const char *signal) const;
00324 int indexOfSlot(const char *slot) const;
00325 int indexOfEnumerator(const char *name) const;
00326 int indexOfProperty(const char *name) const;
00327 int indexOfClassInfo(const char *name) const;
00328
00329 QMetaMethod constructor(int index) const;
00330 QMetaMethod method(int index) const;
00331 QMetaEnum enumerator(int index) const;
00332 QMetaProperty property(int index) const;
00333 QMetaClassInfo classInfo(int index) const;
00334 QMetaProperty userProperty() const;
00335
00336 static bool checkConnectArgs(const char *signal, const char *method);
00337 static QByteArray normalizedSignature(const char *method);
00338 static QByteArray normalizedType(const char *type);
00339
00340
00341 static bool connect(const QObject *sender, int signal_index,
00342 const QObject *receiver, int method_index,
00343 int type = 0, int *types = 0);
00344
00345 static bool disconnect(const QObject *sender, int signal_index,
00346 const QObject *receiver, int method_index);
00347 static bool disconnectOne(const QObject *sender, int signal_index,
00348 const QObject *receiver, int method_index);
00349
00350 static void connectSlotsByName(QObject *o);
00351
00352
00353 static void activate(QObject *sender, int signal_index, void **argv);
00354 static void activate(QObject *sender, int from_signal_index, int to_signal_index, void **argv);
00355 static void activate(QObject *sender, const QMetaObject *, int local_signal_index, void **argv);
00356 static void activate(QObject *sender, const QMetaObject *, int from_local_signal_index, int to_local_signal_index, void **argv);
00357
00358
00359 static void addGuard(QObject **ptr);
00360 static void removeGuard(QObject **ptr);
00361 static void changeGuard(QObject **ptr, QObject *o);
00362
00363 static bool invokeMethod(QObject *obj, const char *member,
00364 Qt::ConnectionType,
00365 QGenericReturnArgument ret,
00366 QGenericArgument val0 = QGenericArgument(0),
00367 QGenericArgument val1 = QGenericArgument(),
00368 QGenericArgument val2 = QGenericArgument(),
00369 QGenericArgument val3 = QGenericArgument(),
00370 QGenericArgument val4 = QGenericArgument(),
00371 QGenericArgument val5 = QGenericArgument(),
00372 QGenericArgument val6 = QGenericArgument(),
00373 QGenericArgument val7 = QGenericArgument(),
00374 QGenericArgument val8 = QGenericArgument(),
00375 QGenericArgument val9 = QGenericArgument());
00376
00377 static inline bool invokeMethod(QObject *obj, const char *member,
00378 QGenericReturnArgument ret,
00379 QGenericArgument val0 = QGenericArgument(0),
00380 QGenericArgument val1 = QGenericArgument(),
00381 QGenericArgument val2 = QGenericArgument(),
00382 QGenericArgument val3 = QGenericArgument(),
00383 QGenericArgument val4 = QGenericArgument(),
00384 QGenericArgument val5 = QGenericArgument(),
00385 QGenericArgument val6 = QGenericArgument(),
00386 QGenericArgument val7 = QGenericArgument(),
00387 QGenericArgument val8 = QGenericArgument(),
00388 QGenericArgument val9 = QGenericArgument())
00389 {
00390 return invokeMethod(obj, member, Qt::AutoConnection, ret, val0, val1, val2, val3,
00391 val4, val5, val6, val7, val8, val9);
00392 }
00393
00394 static inline bool invokeMethod(QObject *obj, const char *member,
00395 Qt::ConnectionType type,
00396 QGenericArgument val0 = QGenericArgument(0),
00397 QGenericArgument val1 = QGenericArgument(),
00398 QGenericArgument val2 = QGenericArgument(),
00399 QGenericArgument val3 = QGenericArgument(),
00400 QGenericArgument val4 = QGenericArgument(),
00401 QGenericArgument val5 = QGenericArgument(),
00402 QGenericArgument val6 = QGenericArgument(),
00403 QGenericArgument val7 = QGenericArgument(),
00404 QGenericArgument val8 = QGenericArgument(),
00405 QGenericArgument val9 = QGenericArgument())
00406 {
00407 return invokeMethod(obj, member, type, QGenericReturnArgument(), val0, val1, val2,
00408 val3, val4, val5, val6, val7, val8, val9);
00409 }
00410
00411 static inline bool invokeMethod(QObject *obj, const char *member,
00412 QGenericArgument val0 = QGenericArgument(0),
00413 QGenericArgument val1 = QGenericArgument(),
00414 QGenericArgument val2 = QGenericArgument(),
00415 QGenericArgument val3 = QGenericArgument(),
00416 QGenericArgument val4 = QGenericArgument(),
00417 QGenericArgument val5 = QGenericArgument(),
00418 QGenericArgument val6 = QGenericArgument(),
00419 QGenericArgument val7 = QGenericArgument(),
00420 QGenericArgument val8 = QGenericArgument(),
00421 QGenericArgument val9 = QGenericArgument())
00422 {
00423 return invokeMethod(obj, member, Qt::AutoConnection, QGenericReturnArgument(), val0,
00424 val1, val2, val3, val4, val5, val6, val7, val8, val9);
00425 }
00426
00427 QObject *newInstance(QGenericArgument val0 = QGenericArgument(0),
00428 QGenericArgument val1 = QGenericArgument(),
00429 QGenericArgument val2 = QGenericArgument(),
00430 QGenericArgument val3 = QGenericArgument(),
00431 QGenericArgument val4 = QGenericArgument(),
00432 QGenericArgument val5 = QGenericArgument(),
00433 QGenericArgument val6 = QGenericArgument(),
00434 QGenericArgument val7 = QGenericArgument(),
00435 QGenericArgument val8 = QGenericArgument(),
00436 QGenericArgument val9 = QGenericArgument()) const;
00437
00438 enum Call {
00439 InvokeMetaMethod,
00440 ReadProperty,
00441 WriteProperty,
00442 ResetProperty,
00443 QueryPropertyDesignable,
00444 QueryPropertyScriptable,
00445 QueryPropertyStored,
00446 QueryPropertyEditable,
00447 QueryPropertyUser,
00448 CreateInstance
00449 };
00450
00451 int static_metacall(Call, int, void **) const;
00452 static int metacall(QObject *, Call, int, void **);
00453
00454 #ifdef QT3_SUPPORT
00455 QT3_SUPPORT const char *superClassName() const;
00456 #endif
00457
00458 struct {
00459 const QMetaObject *superdata;
00460 const char *stringdata;
00461 const uint *data;
00462 const void *extradata;
00463 } d;
00464
00465 };
00466
00467 typedef const QMetaObject& (*QMetaObjectAccessor)();
00468
00469 struct QMetaObjectExtraData
00470 {
00471 #ifdef Q_NO_DATA_RELOCATION
00472 const QMetaObjectAccessor *objects;
00473 #else
00474 const QMetaObject **objects;
00475 #endif
00476 int (*static_metacall)(QMetaObject::Call, int, void **);
00477 };
00478
00479 inline const char *QMetaObject::className() const
00480 { return d.stringdata; }
00481
00482 inline const QMetaObject *QMetaObject::superClass() const
00483 { return d.superdata; }
00484
00485 #ifdef QT3_SUPPORT
00486 inline const char *QMetaObject::superClassName() const
00487 { return d.superdata ? d.superdata->className() : 0; }
00488 #endif
00489
00490 QT_END_NAMESPACE
00491
00492 QT_END_HEADER
00493
00494 #endif // QOBJECTDEFS_H