Eneboo - Documentación para desarrolladores
src/qt/include/private/qucom_p.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qucom_p.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of the QUcom interfaces
00005 **
00006 ** Created : 990101
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the tools 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 QUCOM_P_H
00039 #define QUCOM_P_H
00040 
00041 //
00042 //  W A R N I N G
00043 //  -------------
00044 //
00045 // This file is not part of the Qt API.  It exists for the convenience
00046 // of a number of Qt sources files.  This header file may change from
00047 // version to version without notice, or even be removed.
00048 //
00049 // We mean it.
00050 //
00051 //
00052 
00053 #ifndef QT_H
00054 #include "qstring.h"
00055 #include "quuid.h"
00056 #endif // QT_H
00057 
00058 #ifdef check
00059 #undef check
00060 #endif
00061 
00062 #if __GNUC__ - 0 > 3
00063 #pragma GCC system_header
00064 #endif
00065 
00066 struct QUObject;
00067 struct QUInterfaceDescription;
00068 struct QUnknownInterface;
00069 struct QDispatchInterface;
00070 
00071 
00072 struct Q_EXPORT QUBuffer
00073 {
00074     virtual long read( char *data, ulong maxlen ) = 0;
00075     virtual long write( const char *data, ulong len ) = 0;
00076 };
00077 
00078 
00079 // A type for a QUObject
00080 struct Q_EXPORT QUType
00081 {
00082     virtual const QUuid *uuid() const = 0;
00083     virtual const char *desc() const = 0;
00084 
00085 
00086     virtual bool canConvertFrom( QUObject *, QUType * ) = 0;
00087     // virtual private, only called by canConvertFrom
00088     virtual bool canConvertTo( QUObject *, QUType * ) = 0;
00089 
00090 
00091     virtual bool convertFrom( QUObject *, QUType * ) = 0;
00092     // virtual private, only called by convertFrom
00093     virtual bool convertTo( QUObject *, QUType * ) = 0;
00094 
00095     virtual void clear( QUObject * ) = 0;
00096 
00097     virtual int serializeTo( QUObject *, QUBuffer * ) = 0;
00098     virtual int serializeFrom( QUObject *, QUBuffer * ) = 0;
00099 
00100     static bool isEqual( const QUType *t1, const QUType *t2 );
00101     static bool check( QUObject* o, QUType* t );
00102 };
00103 
00104 
00105 // {DE56510E-4E9F-4b76-A3C2-D1E2EF42F1AC}
00106 extern Q_EXPORT const QUuid TID_QUType_Null;
00107 struct Q_EXPORT QUType_Null : public QUType
00108 {
00109     const QUuid *uuid() const;
00110     const char *desc() const;
00111 
00112     bool canConvertFrom( QUObject *, QUType * );
00113     bool canConvertTo( QUObject *, QUType * );
00114     bool convertFrom( QUObject *, QUType * );
00115     bool convertTo( QUObject *, QUType * );
00116     void clear( QUObject * );
00117     int serializeTo( QUObject *, QUBuffer * );
00118     int serializeFrom( QUObject *, QUBuffer * );
00119 };
00120 extern Q_EXPORT QUType_Null static_QUType_Null;
00121 
00122 
00123 // The magic QUObject
00124 struct Q_EXPORT QUObject
00125 {
00126 public: // scary MSVC bug makes this necessary
00127     QUObject() : type( &static_QUType_Null ) {}
00128     ~QUObject() { type->clear( this ); }
00129 
00130     QUType *type;
00131 
00132     // the unavoidable union
00133     union
00134     {
00135         bool b;
00136 
00137         char c;
00138         short s;
00139         int i;
00140         long l;
00141 
00142         unsigned char uc;
00143         unsigned short us;
00144         unsigned int ui;
00145         unsigned long ul;
00146 
00147         float f;
00148         double d;
00149 
00150         char byte[16];
00151 
00152         struct {
00153            char* data;
00154            unsigned long size;
00155         } bytearray;
00156 
00157         void* ptr;
00158 
00159         struct {
00160             void *ptr;
00161             bool owner;
00162         } voidstar;
00163 
00164         struct {
00165             char *ptr;
00166             bool owner;
00167         } charstar;
00168 
00169         struct {
00170             char *ptr;
00171             bool owner;
00172         } utf8;
00173 
00174         struct {
00175             char *ptr;
00176             bool owner;
00177         } local8bit;
00178 
00179         QUnknownInterface* iface;
00180         QDispatchInterface* idisp;
00181 
00182     } payload;
00183 
00184 };
00185 
00186 
00187 // A parameter description describes one method parameters. A
00188 // parameter has a name, a type and a flag describing whether it's an
00189 // in parameter, an out parameter, or both ways
00190 struct Q_EXPORT QUParameter
00191 {
00192     const char* name;
00193     QUType *type;
00194     const void* typeExtra; //Usually 0, UEnum* for QUType_enum, const char* for QUType_ptr, int* for QUType_varptr
00195     enum { In = 1, Out = 2, InOut = In | Out };
00196     int inOut;
00197 };
00198 
00199 // A method description describes one method. A method has a name and
00200 // an array of parameters.
00201 struct Q_EXPORT QUMethod
00202 {
00203     const char* name;
00204     int count;
00205     const QUParameter* parameters;
00206 };
00207 
00208 // A Property description. Not used yet in the example.
00209 struct Q_EXPORT QUProperty
00210 {
00211     const char* name;
00212     QUType* type;
00213     const void* typeExtra; //type dependend. Usually 0, but UEnum for QUTypeenum or const char* for QUTypeptr
00214 
00215     int set; // -1 undefined
00216     int get; // -1 undefined
00217 
00218     int designable; // -1 FALSE, -2 TRUE, else method
00219     int stored; // -1 FALSE, -2 TRUE, else method
00220 };
00221 
00222 // An interface description describes one interface, that is all its
00223 // methods and properties.
00224 struct Q_EXPORT QUInterfaceDescription
00225 {
00226     int methodCount;
00227     const QUMethod* methods;
00228     int propertyCount;
00229     const QUProperty* properties;
00230 };
00231 
00232 
00233 // A component description describe one component, that is its name,
00234 // vendor, release, info, its component uuid and all its interface
00235 // uuids.
00236 struct Q_EXPORT QUComponentDescription
00237 {
00238     const char* name;
00239     const char* vendor;
00240     const char* release;
00241     const char* info;
00242     QUuid cid;
00243     int count;
00244     const QUuid* interfaces;
00245 };
00246 
00247 
00248 // A component server description describe one component server, that
00249 // is its name, vendor, release, info and the descriptions of all
00250 // components it can instantiate.
00251 struct Q_EXPORT QUComponentServerDescription
00252 {
00253     const char* name;
00254     const char* vendor;
00255     const char* release;
00256     const char* info;
00257     int count;
00258     const QUComponentDescription* components;
00259 };
00260 
00261 
00262 
00263 struct Q_EXPORT QUEnumItem                              // - a name/value pair
00264 {
00265     const char *key;
00266     int value;
00267 };
00268 
00269 struct Q_EXPORT QUEnum
00270 {
00271     const char *name;                   // - enumerator name
00272     unsigned int count;                 // - number of values
00273     const QUEnumItem *items;            // - the name/value pairs
00274     bool set;                           // whether enum has to be treated as a set
00275 };
00276 
00277 inline bool QUType::isEqual( const QUType *t1, const QUType *t2 ) {
00278     return t1 == t2 || t1->uuid() == t2->uuid() ||
00279         *(t1->uuid()) == *(t2->uuid());
00280 }
00281 
00282 inline bool QUType::check( QUObject* o, QUType* t ) {
00283     return isEqual( o->type, t ) || t->convertFrom( o, o->type );
00284 }
00285 
00286 
00287 
00288 // {7EE17B08-5419-47e2-9776-8EEA112DCAEC}
00289 extern Q_EXPORT const QUuid TID_QUType_enum;
00290 struct Q_EXPORT QUType_enum : public QUType
00291 {
00292     const QUuid *uuid() const;
00293     const char *desc() const;
00294 
00295     void set( QUObject *, int );
00296     int &get( QUObject * o ) { return o->payload.i; }
00297     bool canConvertFrom( QUObject *, QUType * );
00298     bool canConvertTo( QUObject *, QUType * );
00299     bool convertFrom( QUObject *, QUType * );
00300     bool convertTo( QUObject *, QUType * );
00301     void clear( QUObject * ) {}
00302     int serializeTo( QUObject *, QUBuffer * );
00303     int serializeFrom( QUObject *, QUBuffer * );
00304 };
00305 extern Q_EXPORT QUType_enum static_QUType_enum;
00306 
00307 
00308 // {8AC26448-5AB4-49eb-968C-8F30AB13D732}
00309 extern Q_EXPORT const QUuid TID_QUType_ptr;
00310 struct Q_EXPORT QUType_ptr : public QUType
00311 {
00312     const QUuid *uuid() const;
00313     const char *desc() const;
00314 
00315     void set( QUObject *, const void* );
00316     void* &get( QUObject * o ) { return o->payload.ptr; }
00317     bool canConvertFrom( QUObject *, QUType * );
00318     bool canConvertTo( QUObject *, QUType * );
00319     bool convertFrom( QUObject *, QUType * );
00320     bool convertTo( QUObject *, QUType * );
00321     void clear( QUObject * ) {}
00322     int serializeTo( QUObject *, QUBuffer * );
00323     int serializeFrom( QUObject *, QUBuffer * );
00324 };
00325 extern Q_EXPORT QUType_ptr static_QUType_ptr;
00326 
00327 // {97A2594D-6496-4402-A11E-55AEF2D4D25C}
00328 extern Q_EXPORT const QUuid TID_QUType_iface;
00329 struct Q_EXPORT QUType_iface : public QUType
00330 {
00331     const QUuid *uuid() const;
00332     const char *desc() const;
00333 
00334     void set( QUObject *, QUnknownInterface* );
00335     QUnknownInterface* &get( QUObject *o ){ return o->payload.iface; }
00336     bool canConvertFrom( QUObject *, QUType * );
00337     bool canConvertTo( QUObject *, QUType * );
00338     bool convertFrom( QUObject *, QUType * );
00339     bool convertTo( QUObject *, QUType * );
00340     void clear( QUObject * ) {}
00341     int serializeTo( QUObject *, QUBuffer * );
00342     int serializeFrom( QUObject *, QUBuffer * );
00343 };
00344 extern Q_EXPORT QUType_iface static_QUType_iface;
00345 
00346 // {2F358164-E28F-4bf4-9FA9-4E0CDCABA50B}
00347 extern Q_EXPORT const QUuid TID_QUType_idisp;
00348 struct Q_EXPORT QUType_idisp : public QUType
00349 {
00350     const QUuid *uuid() const;
00351     const char *desc() const;
00352 
00353     void set( QUObject *, QDispatchInterface* );
00354     QDispatchInterface* &get( QUObject *o ){ return o->payload.idisp; }
00355     bool canConvertFrom( QUObject *, QUType * );
00356     bool canConvertTo( QUObject *, QUType * );
00357     bool convertFrom( QUObject *, QUType * );
00358     bool convertTo( QUObject *, QUType * );
00359     void clear( QUObject * ) {}
00360     int serializeTo( QUObject *, QUBuffer * );
00361     int serializeFrom( QUObject *, QUBuffer * );
00362 };
00363 extern Q_EXPORT QUType_idisp static_QUType_idisp;
00364 
00365 // {CA42115D-13D0-456c-82B5-FC10187F313E}
00366 extern Q_EXPORT const QUuid TID_QUType_bool;
00367 struct Q_EXPORT QUType_bool : public QUType
00368 {
00369     const QUuid *uuid() const;
00370     const char *desc() const;
00371 
00372     void set( QUObject *, bool );
00373     bool &get( QUObject *o ) { return o->payload.b; }
00374     bool canConvertFrom( QUObject *, QUType * );
00375     bool canConvertTo( QUObject *, QUType * );
00376     bool convertFrom( QUObject *, QUType * );
00377     bool convertTo( QUObject *, QUType * );
00378     void clear( QUObject * ) {}
00379     int serializeTo( QUObject *, QUBuffer * );
00380     int serializeFrom( QUObject *, QUBuffer * );
00381 };
00382 extern Q_EXPORT QUType_bool static_QUType_bool;
00383 
00384 // {53C1F3BE-73C3-4c7d-9E05-CCF09EB676B5}
00385 extern Q_EXPORT const QUuid TID_QUType_int;
00386 struct Q_EXPORT QUType_int : public QUType
00387 {
00388     const QUuid *uuid() const;
00389     const char *desc() const;
00390 
00391     void set( QUObject *, int );
00392     int &get( QUObject *o ) { return o->payload.i; }
00393     bool canConvertFrom( QUObject *, QUType * );
00394     bool canConvertTo( QUObject *, QUType * );
00395     bool convertFrom( QUObject *, QUType * );
00396     bool convertTo( QUObject *, QUType * );
00397     void clear( QUObject * ) {}
00398     int serializeTo( QUObject *, QUBuffer * );
00399     int serializeFrom( QUObject *, QUBuffer * );
00400 };
00401 extern Q_EXPORT QUType_int static_QUType_int;
00402 
00403 
00404 // {2D0974E5-0BA6-4ec2-8837-C198972CB48C}
00405 extern Q_EXPORT const QUuid TID_QUType_double;
00406 struct Q_EXPORT QUType_double : public QUType
00407 {
00408     const QUuid *uuid() const;
00409     const char *desc() const;
00410 
00411     void set( QUObject *, double );
00412     double &get( QUObject *o ) { return o->payload.d; }
00413     bool canConvertFrom( QUObject *, QUType * );
00414     bool canConvertTo( QUObject *, QUType * );
00415     bool convertFrom( QUObject *, QUType * );
00416     bool convertTo( QUObject *, QUType * );
00417     void clear( QUObject * ) {}
00418     int serializeTo( QUObject *, QUBuffer * );
00419     int serializeFrom( QUObject *, QUBuffer * );
00420 };
00421 extern Q_EXPORT QUType_double static_QUType_double;
00422 
00423 
00424 // {EFCDD1D4-77A3-4b8e-8D46-DC14B8D393E9}
00425 extern Q_EXPORT const QUuid TID_QUType_charstar;
00426 struct Q_EXPORT QUType_charstar : public QUType
00427 {
00428     const QUuid *uuid() const;
00429     const char *desc() const;
00430 
00431     void set( QUObject *, const char*, bool take = FALSE );
00432     char* get( QUObject *o ){ return o->payload.charstar.ptr; }
00433     bool canConvertFrom( QUObject *, QUType * );
00434     bool canConvertTo( QUObject *, QUType * );
00435     bool convertFrom( QUObject *, QUType * );
00436     bool convertTo( QUObject *, QUType * );
00437     void clear( QUObject * );
00438     int serializeTo( QUObject *, QUBuffer * );
00439     int serializeFrom( QUObject *, QUBuffer * );
00440 
00441 };
00442 extern Q_EXPORT QUType_charstar static_QUType_charstar;
00443 
00444 // {44C2A547-01E7-4e56-8559-35AF9D2F42B7}
00445 extern const QUuid TID_QUType_QString;
00446 
00447 struct Q_EXPORT QUType_QString : public QUType
00448 {
00449     const QUuid *uuid() const;
00450     const char *desc() const;
00451 
00452     void set( QUObject *, const QString & );
00453     QString &get( QUObject * o ) { return *(QString*)o->payload.ptr; }
00454 
00455     bool canConvertFrom( QUObject *, QUType * );
00456     bool canConvertTo( QUObject *, QUType * );
00457     bool convertFrom( QUObject *, QUType * );
00458     bool convertTo( QUObject *, QUType * );
00459     void clear( QUObject * );
00460     int serializeTo( QUObject *, QUBuffer * );
00461     int serializeFrom( QUObject *, QUBuffer * );
00462 
00463 };
00464 extern Q_EXPORT QUType_QString static_QUType_QString;
00465 
00466 
00467 #endif // QUCOM_P_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'