1 | /****************************************************************************
|
---|
2 | ** $Id: qucomextra.cpp 2 2005-11-16 15:49:26Z dmik $
|
---|
3 | **
|
---|
4 | ** Implementation of extra QUcom classes
|
---|
5 | **
|
---|
6 | ** Created : 990101
|
---|
7 | **
|
---|
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
|
---|
9 | **
|
---|
10 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
11 | **
|
---|
12 | ** This file may be distributed under the terms of the Q Public License
|
---|
13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
---|
14 | ** LICENSE.QPL included in the packaging of this file.
|
---|
15 | **
|
---|
16 | ** This file may be distributed and/or modified under the terms of the
|
---|
17 | ** GNU General Public License version 2 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
19 | ** packaging of this file.
|
---|
20 | **
|
---|
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
22 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
23 | ** Agreement provided with the Software.
|
---|
24 | **
|
---|
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
27 | **
|
---|
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
29 | ** information about Qt Commercial License Agreements.
|
---|
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
32 | **
|
---|
33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
34 | ** not clear to you.
|
---|
35 | **
|
---|
36 | **********************************************************************/
|
---|
37 |
|
---|
38 | #include "qucomextra_p.h"
|
---|
39 | #include <qvariant.h>
|
---|
40 |
|
---|
41 |
|
---|
42 | #ifndef QT_NO_VARIANT
|
---|
43 | // 6dc75d58-a1d9-4417-b591-d45c63a3a4ea
|
---|
44 | const QUuid TID_QUType_QVariant( 0x6dc75d58, 0xa1d9, 0x4417, 0xb5, 0x91, 0xd4, 0x5c, 0x63, 0xa3, 0xa4, 0xea );
|
---|
45 | QUType_QVariant static_QUType_QVariant;
|
---|
46 |
|
---|
47 | const QUuid *QUType_QVariant::uuid() const { return &TID_QUType_QVariant; }
|
---|
48 | const char *QUType_QVariant::desc() const { return "QVariant"; }
|
---|
49 |
|
---|
50 | void QUType_QVariant::set( QUObject *o, const QVariant& v )
|
---|
51 | {
|
---|
52 | o->payload.ptr = new QVariant( v );
|
---|
53 | o->type = this;
|
---|
54 | }
|
---|
55 |
|
---|
56 | QVariant &QUType_QVariant::get( QUObject * o )
|
---|
57 | {
|
---|
58 | return *(QVariant*)o->payload.ptr;
|
---|
59 | }
|
---|
60 |
|
---|
61 | bool QUType_QVariant::canConvertFrom( QUObject *o, QUType *t )
|
---|
62 | {
|
---|
63 | if ( isEqual( o->type, &static_QUType_QString )
|
---|
64 | || isEqual( o->type, &static_QUType_int )
|
---|
65 | || isEqual( o->type, &static_QUType_bool )
|
---|
66 | || isEqual( o->type, &static_QUType_double )
|
---|
67 | || isEqual( o->type, &static_QUType_charstar ) )
|
---|
68 | return TRUE;
|
---|
69 | return t->canConvertTo( o, this );
|
---|
70 | }
|
---|
71 |
|
---|
72 | bool QUType_QVariant::canConvertTo( QUObject * /*o*/, QUType * /*t*/ )
|
---|
73 | {
|
---|
74 | return FALSE;
|
---|
75 | }
|
---|
76 |
|
---|
77 | bool QUType_QVariant::convertFrom( QUObject *o, QUType *t )
|
---|
78 | {
|
---|
79 | QVariant *var = 0;
|
---|
80 | if ( isEqual( o->type, &static_QUType_QString ) )
|
---|
81 | var = new QVariant( static_QUType_QString.get( o ) );
|
---|
82 | else if ( isEqual( o->type, &static_QUType_int ) )
|
---|
83 | var = new QVariant( static_QUType_int.get( o ) );
|
---|
84 | else if ( isEqual( o->type, &static_QUType_bool ) )
|
---|
85 | var = new QVariant( static_QUType_bool.get( o ), 42 );
|
---|
86 | else if ( isEqual( o->type, &static_QUType_double ) )
|
---|
87 | var = new QVariant( static_QUType_double.get( o ) );
|
---|
88 | else if ( isEqual( o->type, &static_QUType_charstar ) )
|
---|
89 | var = new QVariant( static_QUType_charstar.get( o ) );
|
---|
90 | else
|
---|
91 | return t->convertTo( o, this );
|
---|
92 |
|
---|
93 | o->type->clear( o );
|
---|
94 | o->payload.ptr = var;
|
---|
95 | o->type = this;
|
---|
96 | return TRUE;
|
---|
97 | }
|
---|
98 |
|
---|
99 | bool QUType_QVariant::convertTo( QUObject * /*o*/, QUType * /*t*/ )
|
---|
100 | {
|
---|
101 | return FALSE;
|
---|
102 | }
|
---|
103 |
|
---|
104 | void QUType_QVariant::clear( QUObject *o )
|
---|
105 | {
|
---|
106 | delete (QVariant*)o->payload.ptr;
|
---|
107 | o->payload.ptr = 0;
|
---|
108 | }
|
---|
109 |
|
---|
110 | int QUType_QVariant::serializeTo( QUObject *, QUBuffer * )
|
---|
111 | {
|
---|
112 | return 0;
|
---|
113 | }
|
---|
114 |
|
---|
115 | int QUType_QVariant::serializeFrom( QUObject *, QUBuffer * )
|
---|
116 | {
|
---|
117 | return 0;
|
---|
118 | }
|
---|
119 |
|
---|
120 |
|
---|
121 | #endif
|
---|
122 |
|
---|
123 | const QUuid TID_QUType_varptr( 0x8d48b3a8, 0xbd7f, 0x11d5, 0x8d, 0x74, 0x00, 0xc0, 0xf0, 0x3b, 0xc0, 0xf3 );
|
---|
124 | QUType_varptr static_QUType_varptr;
|
---|
125 | const QUuid *QUType_varptr::uuid() const { return &TID_QUType_varptr; }
|
---|
126 | const char *QUType_varptr::desc() const { return "varptr"; }
|
---|
127 |
|
---|
128 | void QUType_varptr::set( QUObject *o, const void* v )
|
---|
129 | {
|
---|
130 | o->payload.ptr = (void*) v;
|
---|
131 | o->type = this;
|
---|
132 | }
|
---|
133 |
|
---|
134 | bool QUType_varptr::canConvertFrom( QUObject *o, QUType *t )
|
---|
135 | {
|
---|
136 | if ( isEqual( t, &static_QUType_ptr ) )
|
---|
137 | return TRUE;
|
---|
138 | return t->canConvertTo( o, this );
|
---|
139 | }
|
---|
140 |
|
---|
141 | bool QUType_varptr::canConvertTo( QUObject *, QUType * t)
|
---|
142 | {
|
---|
143 | return isEqual( t, &static_QUType_ptr );
|
---|
144 | }
|
---|
145 |
|
---|
146 | bool QUType_varptr::convertFrom( QUObject *o, QUType *t )
|
---|
147 | {
|
---|
148 | if ( isEqual( t, &static_QUType_ptr ) )
|
---|
149 | ;
|
---|
150 | else
|
---|
151 | return t->convertTo( o, this );
|
---|
152 |
|
---|
153 | o->type = this;
|
---|
154 | return TRUE;
|
---|
155 | }
|
---|
156 |
|
---|
157 | bool QUType_varptr::convertTo( QUObject *o, QUType * t)
|
---|
158 | {
|
---|
159 | if ( isEqual( t, &static_QUType_ptr ) ) {
|
---|
160 | o->type = &static_QUType_ptr;
|
---|
161 | return TRUE;
|
---|
162 | }
|
---|
163 | return FALSE;
|
---|
164 | }
|
---|
165 |
|
---|
166 | int QUType_varptr::serializeTo( QUObject *, QUBuffer * )
|
---|
167 | {
|
---|
168 | return 0;
|
---|
169 | }
|
---|
170 |
|
---|
171 | int QUType_varptr::serializeFrom( QUObject *, QUBuffer * )
|
---|
172 | {
|
---|
173 | return 0;
|
---|
174 | }
|
---|