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 #ifndef QUCOM_P_H
00039 #define QUCOM_P_H
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
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 struct QUObject;
00063 struct QUInterfaceDescription;
00064 struct QUnknownInterface;
00065 struct QDispatchInterface;
00066
00067
00068 struct Q_EXPORT QUBuffer
00069 {
00070 virtual long read( char *data, ulong maxlen ) = 0;
00071 virtual long write( const char *data, ulong len ) = 0;
00072 };
00073
00074
00075
00076 struct Q_EXPORT QUType
00077 {
00078 virtual const QUuid *uuid() const = 0;
00079 virtual const char *desc() const = 0;
00080
00081
00082 virtual bool canConvertFrom( QUObject *, QUType * ) = 0;
00083
00084 virtual bool canConvertTo( QUObject *, QUType * ) = 0;
00085
00086
00087 virtual bool convertFrom( QUObject *, QUType * ) = 0;
00088
00089 virtual bool convertTo( QUObject *, QUType * ) = 0;
00090
00091 virtual void clear( QUObject * ) = 0;
00092
00093 virtual int serializeTo( QUObject *, QUBuffer * ) = 0;
00094 virtual int serializeFrom( QUObject *, QUBuffer * ) = 0;
00095
00096 static bool isEqual( const QUType *t1, const QUType *t2 );
00097 static bool check( QUObject* o, QUType* t );
00098 };
00099
00100
00101
00102 extern Q_EXPORT const QUuid TID_QUType_Null;
00103 struct Q_EXPORT QUType_Null : public QUType
00104 {
00105 const QUuid *uuid() const;
00106 const char *desc() const;
00107
00108 bool canConvertFrom( QUObject *, QUType * );
00109 bool canConvertTo( QUObject *, QUType * );
00110 bool convertFrom( QUObject *, QUType * );
00111 bool convertTo( QUObject *, QUType * );
00112 void clear( QUObject * );
00113 int serializeTo( QUObject *, QUBuffer * );
00114 int serializeFrom( QUObject *, QUBuffer * );
00115 };
00116 extern Q_EXPORT QUType_Null static_QUType_Null;
00117
00118
00119
00120 struct Q_EXPORT QUObject
00121 {
00122 public:
00123 QUObject() : type( &static_QUType_Null ) {}
00124 ~QUObject() { type->clear( this ); }
00125
00126 QUType *type;
00127
00128
00129 union
00130 {
00131 bool b;
00132
00133 char c;
00134 short s;
00135 int i;
00136 long l;
00137
00138 unsigned char uc;
00139 unsigned short us;
00140 unsigned int ui;
00141 unsigned long ul;
00142
00143 float f;
00144 double d;
00145
00146 char byte[16];
00147
00148 struct {
00149 char* data;
00150 unsigned long size;
00151 } bytearray;
00152
00153 void* ptr;
00154
00155 struct {
00156 void *ptr;
00157 bool owner;
00158 } voidstar;
00159
00160 struct {
00161 char *ptr;
00162 bool owner;
00163 } charstar;
00164
00165 struct {
00166 char *ptr;
00167 bool owner;
00168 } utf8;
00169
00170 struct {
00171 char *ptr;
00172 bool owner;
00173 } local8bit;
00174
00175 QUnknownInterface* iface;
00176 QDispatchInterface* idisp;
00177
00178 } payload;
00179
00180 };
00181
00182
00183
00184
00185
00186 struct Q_EXPORT QUParameter
00187 {
00188 const char* name;
00189 QUType *type;
00190 const void* typeExtra;
00191 enum { In = 1, Out = 2, InOut = In | Out };
00192 int inOut;
00193 };
00194
00195
00196
00197 struct Q_EXPORT QUMethod
00198 {
00199 const char* name;
00200 int count;
00201 const QUParameter* parameters;
00202 };
00203
00204
00205 struct Q_EXPORT QUProperty
00206 {
00207 const char* name;
00208 QUType* type;
00209 const void* typeExtra;
00210
00211 int set;
00212 int get;
00213
00214 int designable;
00215 int stored;
00216 };
00217
00218
00219
00220 struct Q_EXPORT QUInterfaceDescription
00221 {
00222 int methodCount;
00223 const QUMethod* methods;
00224 int propertyCount;
00225 const QUProperty* properties;
00226 };
00227
00228
00229
00230
00231
00232 struct Q_EXPORT QUComponentDescription
00233 {
00234 const char* name;
00235 const char* vendor;
00236 const char* release;
00237 const char* info;
00238 QUuid cid;
00239 int count;
00240 const QUuid* interfaces;
00241 };
00242
00243
00244
00245
00246
00247 struct Q_EXPORT QUComponentServerDescription
00248 {
00249 const char* name;
00250 const char* vendor;
00251 const char* release;
00252 const char* info;
00253 int count;
00254 const QUComponentDescription* components;
00255 };
00256
00257
00258
00259 struct Q_EXPORT QUEnumItem
00260 {
00261 const char *key;
00262 int value;
00263 };
00264
00265 struct Q_EXPORT QUEnum
00266 {
00267 const char *name;
00268 unsigned int count;
00269 const QUEnumItem *items;
00270 bool set;
00271 };
00272
00273 inline bool QUType::isEqual( const QUType *t1, const QUType *t2 ) {
00274 return t1 == t2 || t1->uuid() == t2->uuid() ||
00275 *(t1->uuid()) == *(t2->uuid());
00276 }
00277
00278 inline bool QUType::check( QUObject* o, QUType* t ) {
00279 return isEqual( o->type, t ) || t->convertFrom( o, o->type );
00280 }
00281
00282
00283
00284
00285 extern Q_EXPORT const QUuid TID_QUType_enum;
00286 struct Q_EXPORT QUType_enum : public QUType
00287 {
00288 const QUuid *uuid() const;
00289 const char *desc() const;
00290
00291 void set( QUObject *, int );
00292 int &get( QUObject * o ) { return o->payload.i; }
00293 bool canConvertFrom( QUObject *, QUType * );
00294 bool canConvertTo( QUObject *, QUType * );
00295 bool convertFrom( QUObject *, QUType * );
00296 bool convertTo( QUObject *, QUType * );
00297 void clear( QUObject * ) {}
00298 int serializeTo( QUObject *, QUBuffer * );
00299 int serializeFrom( QUObject *, QUBuffer * );
00300 };
00301 extern Q_EXPORT QUType_enum static_QUType_enum;
00302
00303
00304
00305 extern Q_EXPORT const QUuid TID_QUType_ptr;
00306 struct Q_EXPORT QUType_ptr : public QUType
00307 {
00308 const QUuid *uuid() const;
00309 const char *desc() const;
00310
00311 void set( QUObject *, const void* );
00312 void* &get( QUObject * o ) { return o->payload.ptr; }
00313 bool canConvertFrom( QUObject *, QUType * );
00314 bool canConvertTo( QUObject *, QUType * );
00315 bool convertFrom( QUObject *, QUType * );
00316 bool convertTo( QUObject *, QUType * );
00317 void clear( QUObject * ) {}
00318 int serializeTo( QUObject *, QUBuffer * );
00319 int serializeFrom( QUObject *, QUBuffer * );
00320 };
00321 extern Q_EXPORT QUType_ptr static_QUType_ptr;
00322
00323
00324 extern Q_EXPORT const QUuid TID_QUType_iface;
00325 struct Q_EXPORT QUType_iface : public QUType
00326 {
00327 const QUuid *uuid() const;
00328 const char *desc() const;
00329
00330 void set( QUObject *, QUnknownInterface* );
00331 QUnknownInterface* &get( QUObject *o ){ return o->payload.iface; }
00332 bool canConvertFrom( QUObject *, QUType * );
00333 bool canConvertTo( QUObject *, QUType * );
00334 bool convertFrom( QUObject *, QUType * );
00335 bool convertTo( QUObject *, QUType * );
00336 void clear( QUObject * ) {}
00337 int serializeTo( QUObject *, QUBuffer * );
00338 int serializeFrom( QUObject *, QUBuffer * );
00339 };
00340 extern Q_EXPORT QUType_iface static_QUType_iface;
00341
00342
00343 extern Q_EXPORT const QUuid TID_QUType_idisp;
00344 struct Q_EXPORT QUType_idisp : public QUType
00345 {
00346 const QUuid *uuid() const;
00347 const char *desc() const;
00348
00349 void set( QUObject *, QDispatchInterface* );
00350 QDispatchInterface* &get( QUObject *o ){ return o->payload.idisp; }
00351 bool canConvertFrom( QUObject *, QUType * );
00352 bool canConvertTo( QUObject *, QUType * );
00353 bool convertFrom( QUObject *, QUType * );
00354 bool convertTo( QUObject *, QUType * );
00355 void clear( QUObject * ) {}
00356 int serializeTo( QUObject *, QUBuffer * );
00357 int serializeFrom( QUObject *, QUBuffer * );
00358 };
00359 extern Q_EXPORT QUType_idisp static_QUType_idisp;
00360
00361
00362 extern Q_EXPORT const QUuid TID_QUType_bool;
00363 struct Q_EXPORT QUType_bool : public QUType
00364 {
00365 const QUuid *uuid() const;
00366 const char *desc() const;
00367
00368 void set( QUObject *, bool );
00369 bool &get( QUObject *o ) { return o->payload.b; }
00370 bool canConvertFrom( QUObject *, QUType * );
00371 bool canConvertTo( QUObject *, QUType * );
00372 bool convertFrom( QUObject *, QUType * );
00373 bool convertTo( QUObject *, QUType * );
00374 void clear( QUObject * ) {}
00375 int serializeTo( QUObject *, QUBuffer * );
00376 int serializeFrom( QUObject *, QUBuffer * );
00377 };
00378 extern Q_EXPORT QUType_bool static_QUType_bool;
00379
00380
00381 extern Q_EXPORT const QUuid TID_QUType_int;
00382 struct Q_EXPORT QUType_int : public QUType
00383 {
00384 const QUuid *uuid() const;
00385 const char *desc() const;
00386
00387 void set( QUObject *, int );
00388 int &get( QUObject *o ) { return o->payload.i; }
00389 bool canConvertFrom( QUObject *, QUType * );
00390 bool canConvertTo( QUObject *, QUType * );
00391 bool convertFrom( QUObject *, QUType * );
00392 bool convertTo( QUObject *, QUType * );
00393 void clear( QUObject * ) {}
00394 int serializeTo( QUObject *, QUBuffer * );
00395 int serializeFrom( QUObject *, QUBuffer * );
00396 };
00397 extern Q_EXPORT QUType_int static_QUType_int;
00398
00399
00400
00401 extern Q_EXPORT const QUuid TID_QUType_double;
00402 struct Q_EXPORT QUType_double : public QUType
00403 {
00404 const QUuid *uuid() const;
00405 const char *desc() const;
00406
00407 void set( QUObject *, double );
00408 double &get( QUObject *o ) { return o->payload.d; }
00409 bool canConvertFrom( QUObject *, QUType * );
00410 bool canConvertTo( QUObject *, QUType * );
00411 bool convertFrom( QUObject *, QUType * );
00412 bool convertTo( QUObject *, QUType * );
00413 void clear( QUObject * ) {}
00414 int serializeTo( QUObject *, QUBuffer * );
00415 int serializeFrom( QUObject *, QUBuffer * );
00416 };
00417 extern Q_EXPORT QUType_double static_QUType_double;
00418
00419
00420
00421 extern Q_EXPORT const QUuid TID_QUType_charstar;
00422 struct Q_EXPORT QUType_charstar : public QUType
00423 {
00424 const QUuid *uuid() const;
00425 const char *desc() const;
00426
00427 void set( QUObject *, const char*, bool take = FALSE );
00428 char* get( QUObject *o ){ return o->payload.charstar.ptr; }
00429 bool canConvertFrom( QUObject *, QUType * );
00430 bool canConvertTo( QUObject *, QUType * );
00431 bool convertFrom( QUObject *, QUType * );
00432 bool convertTo( QUObject *, QUType * );
00433 void clear( QUObject * );
00434 int serializeTo( QUObject *, QUBuffer * );
00435 int serializeFrom( QUObject *, QUBuffer * );
00436
00437 };
00438 extern Q_EXPORT QUType_charstar static_QUType_charstar;
00439
00440
00441 extern const QUuid TID_QUType_QString;
00442
00443 struct Q_EXPORT QUType_QString : public QUType
00444 {
00445 const QUuid *uuid() const;
00446 const char *desc() const;
00447
00448 void set( QUObject *, const QString & );
00449 QString &get( QUObject * o ) { return *(QString*)o->payload.ptr; }
00450
00451 bool canConvertFrom( QUObject *, QUType * );
00452 bool canConvertTo( QUObject *, QUType * );
00453 bool convertFrom( QUObject *, QUType * );
00454 bool convertTo( QUObject *, QUType * );
00455 void clear( QUObject * );
00456 int serializeTo( QUObject *, QUBuffer * );
00457 int serializeFrom( QUObject *, QUBuffer * );
00458
00459 };
00460 extern Q_EXPORT QUType_QString static_QUType_QString;
00461
00462
00463 #endif // QUCOM_P_H