Eneboo - Documentación para desarrolladores
src/qt/include/qmetaobject.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qmetaobject.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QMetaObject class
00005 **
00006 ** Created : 930419
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the kernel module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QMETAOBJECT_H
00039 #define QMETAOBJECT_H
00040 
00041 #ifndef QT_H
00042 #include "qconnection.h"
00043 #include "qstrlist.h"
00044 #endif // QT_H
00045 
00046 #ifndef Q_MOC_OUTPUT_REVISION
00047 #define Q_MOC_OUTPUT_REVISION 26
00048 #endif
00049 
00050 class QObject;
00051 struct QUMethod;
00052 class QMetaObjectPrivate;
00053 
00054 struct QMetaData                                // - member function meta data
00055 {                                               //   for signal and slots
00056     const char *name;                           // - member name
00057     const QUMethod* method;                     // - detailed method description
00058     enum Access { Private, Protected, Public };
00059     Access access;                              // - access permission
00060 };
00061 
00062 #ifndef QT_NO_PROPERTIES
00063 struct QMetaEnum                                // enumerator meta data
00064 {                                               //  for properties
00065     const char *name;                           // - enumerator name
00066     uint count;                                 // - number of values
00067     struct Item                                 // - a name/value pair
00068     {
00069         const char *key;
00070         int value;
00071     };
00072     const Item *items;                          // - the name/value pairs
00073     bool set;                                   // whether enum has to be treated as a set
00074 };
00075 #endif
00076 
00077 #ifndef QT_NO_PROPERTIES
00078 
00079 class Q_EXPORT QMetaProperty                    // property meta data
00080 {
00081 public:
00082     const char* type() const { return t; }      // type of the property
00083     const char* name() const { return n; }      // name of the property
00084 
00085     bool writable() const;
00086     bool isValid() const;
00087 
00088     bool isSetType() const;
00089     bool isEnumType() const;
00090     QStrList enumKeys() const;                  // enumeration names
00091 
00092     int keyToValue( const char* key ) const;    // enum and set conversion functions
00093     const char* valueToKey( int value ) const;
00094     int keysToValue( const QStrList& keys ) const;
00095     QStrList valueToKeys( int value ) const;
00096 
00097     bool designable( QObject* = 0 ) const;
00098     bool scriptable( QObject* = 0 ) const;
00099     bool stored( QObject* = 0 ) const;
00100 
00101     bool reset( QObject* ) const;
00102 
00103     const char* t;                      // internal
00104     const char* n;                      // internal
00105 
00106     enum Flags  {
00107         Invalid         = 0x00000000,
00108         Readable        = 0x00000001,
00109         Writable        = 0x00000002,
00110         EnumOrSet       = 0x00000004,
00111         UnresolvedEnum  = 0x00000008,
00112         StdSet          = 0x00000100,
00113         Override        = 0x00000200
00114     };
00115 
00116     uint flags; // internal
00117     bool testFlags( uint f ) const;     // internal
00118     bool stdSet() const;                // internal
00119     int id() const;                     // internal
00120 
00121     QMetaObject** meta;                 // internal
00122 
00123     const QMetaEnum* enumData;          // internal
00124     int _id;                            // internal
00125     void clear();                       // internal
00126 };
00127 
00128 inline bool QMetaProperty::testFlags( uint f ) const
00129 { return (flags & (uint)f) != (uint)0; }
00130 
00131 #endif // QT_NO_PROPERTIES
00132 
00133 struct QClassInfo                               // class info meta data
00134 {
00135     const char* name;                           // - name of the info
00136     const char* value;                          // - value of the info
00137 };
00138 
00139 class Q_EXPORT QMetaObject                      // meta object class
00140 {
00141 public:
00142     QMetaObject( const char * const class_name, QMetaObject *superclass,
00143                  const QMetaData * const slot_data, int n_slots,
00144                  const QMetaData * const signal_data, int n_signals,
00145 #ifndef QT_NO_PROPERTIES
00146                  const QMetaProperty *const prop_data, int n_props,
00147                  const QMetaEnum *const enum_data, int n_enums,
00148 #endif
00149                  const QClassInfo *const class_info, int n_info );
00150 
00151 #ifndef QT_NO_PROPERTIES
00152     QMetaObject( const char * const class_name, QMetaObject *superclass,
00153                  const QMetaData * const slot_data, int n_slots,
00154                  const QMetaData * const signal_data, int n_signals,
00155                  const QMetaProperty *const prop_data, int n_props,
00156                  const QMetaEnum *const enum_data, int n_enums,
00157                  bool (*qt_static_property)(QObject*, int, int, QVariant*),
00158                  const QClassInfo *const class_info, int n_info );
00159 #endif
00160 
00161 
00162     virtual ~QMetaObject();
00163 
00164     const char  *className()            const { return classname; }
00165     const char  *superClassName()       const { return superclassname; }
00166 
00167     QMetaObject *superClass()           const { return superclass; }
00168 
00169     bool        inherits( const char* clname ) const;
00170 
00171     int numSlots( bool super = FALSE ) const;
00172     int         numSignals( bool super = FALSE ) const;
00173 
00174     int         findSlot( const char *, bool super = FALSE ) const;
00175     int         findSignal( const char *, bool super = FALSE ) const;
00176 
00177     const QMetaData     *slot( int index, bool super = FALSE ) const;
00178     const QMetaData     *signal( int index, bool super = FALSE ) const;
00179 
00180     QStrList    slotNames( bool super = FALSE ) const;
00181     QStrList    signalNames( bool super = FALSE ) const;
00182 
00183     int         slotOffset() const;
00184     int         signalOffset() const;
00185     int         propertyOffset() const;
00186 
00187     int         numClassInfo( bool super = FALSE ) const;
00188     const QClassInfo    *classInfo( int index, bool super = FALSE ) const;
00189     const char  *classInfo( const char* name, bool super = FALSE ) const;
00190 
00191 #ifndef QT_NO_PROPERTIES
00192     const QMetaProperty *property( int index, bool super = FALSE ) const;
00193     int findProperty( const char *name, bool super = FALSE ) const;
00194     int indexOfProperty( const QMetaProperty*, bool super = FALSE ) const;
00195     const QMetaProperty* resolveProperty( const QMetaProperty* ) const;
00196     int resolveProperty( int ) const;
00197     QStrList            propertyNames( bool super = FALSE ) const;
00198     int         numProperties( bool super = FALSE ) const;
00199 #endif
00200 
00201     // static wrappers around constructors, necessary to work around a
00202     // Windows-DLL limitation: objects can only be deleted within a
00203     // DLL if they were actually created within that DLL.
00204     static QMetaObject  *new_metaobject( const char *, QMetaObject *,
00205                                         const QMetaData *const, int,
00206                                         const QMetaData *const, int,
00207 #ifndef QT_NO_PROPERTIES
00208                                         const QMetaProperty *const prop_data, int n_props,
00209                                         const QMetaEnum *const enum_data, int n_enums,
00210 #endif
00211                                         const QClassInfo *const  class_info, int n_info );
00212 #ifndef QT_NO_PROPERTIES
00213     static QMetaObject  *new_metaobject( const char *, QMetaObject *,
00214                                         const QMetaData *const, int,
00215                                         const QMetaData *const, int,
00216                                         const QMetaProperty *const prop_data, int n_props,
00217                                         const QMetaEnum *const enum_data, int n_enums,
00218                                          bool (*qt_static_property)(QObject*, int, int, QVariant*),
00219                                         const QClassInfo *const  class_info, int n_info );
00220     QStrList            enumeratorNames( bool super = FALSE ) const;
00221     int numEnumerators( bool super = FALSE ) const;
00222     const QMetaEnum             *enumerator( const char* name, bool super = FALSE ) const;
00223 #endif
00224 
00225     static QMetaObject *metaObject( const char *class_name );
00226     static bool hasMetaObject( const char *class_name );
00227 
00228 private:
00229     QMemberDict         *init( const QMetaData *, int );
00230 
00231     const char          *classname;             // class name
00232     const char          *superclassname;        // super class name
00233     QMetaObject *superclass;                    // super class meta object
00234     QMetaObjectPrivate  *d;                     // private data for...
00235     void        *reserved;                      // ...binary compatibility
00236     const QMetaData             *slotData;      // slot meta data
00237     QMemberDict *slotDict;                      // slot dictionary
00238     const QMetaData             *signalData;    // signal meta data
00239     QMemberDict *signalDict;                    // signal dictionary
00240     int signaloffset;
00241     int slotoffset;
00242 #ifndef QT_NO_PROPERTIES
00243     int propertyoffset;
00244 public:
00245     bool qt_static_property( QObject* o, int id, int f, QVariant* v);
00246 private:
00247     friend class QMetaProperty;
00248 #endif
00249 
00250 private:        // Disabled copy constructor and operator=
00251 #if defined(Q_DISABLE_COPY)
00252     QMetaObject( const QMetaObject & );
00253     QMetaObject &operator=( const QMetaObject & );
00254 #endif
00255 };
00256 
00257 inline int QMetaObject::slotOffset() const
00258 { return slotoffset; }
00259 
00260 inline int QMetaObject::signalOffset() const
00261 { return signaloffset; }
00262 
00263 #ifndef QT_NO_PROPERTIES
00264 inline int QMetaObject::propertyOffset() const
00265 { return propertyoffset; }
00266 #endif
00267 
00268 typedef QMetaObject *(*QtStaticMetaObjectFunction)();
00269 
00270 class Q_EXPORT QMetaObjectCleanUp
00271 {
00272 public:
00273     QMetaObjectCleanUp( const char *mo_name, QtStaticMetaObjectFunction );
00274     QMetaObjectCleanUp();
00275     ~QMetaObjectCleanUp();
00276 
00277     void setMetaObject( QMetaObject *&mo );
00278 
00279 private:
00280     QMetaObject **metaObject;
00281 };
00282 
00283 #endif // QMETAOBJECT_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'