Mercurial > projects > qtd
annotate qt/core/QVariant.d @ 87:f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
author | SokoL_SD |
---|---|
date | Tue, 26 May 2009 10:59:07 +0000 |
parents | fd6eb3a1759d |
children | cbdfc92eac7f |
rev | line source |
---|---|
1 | 1 module qt.core.QVariant; |
2 | |
3 public import qt.QGlobal; | |
4 private import qt.QtDObject; | |
87
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
5 private import qt.core.QMetaType; |
1 | 6 |
7 // automatic imports------------- | |
8 private import qt.core.QSizeF; | |
9 private import qt.core.QPoint; | |
10 private import qt.core.QRectF; | |
11 public import qt.core.Qt; | |
12 private import qt.core.QDateTime; | |
13 private import qt.core.QDataStream; | |
14 private import qt.core.QTime; | |
15 private import qt.core.QUrl; | |
16 private import qt.core.QRegExp; | |
17 private import qt.core.QBitArray; | |
18 private import qt.core.QLine; | |
19 private import qt.core.QByteArray; | |
20 private import qt.core.QSize; | |
21 private import qt.core.QDate; | |
22 private import qt.core.QPointF; | |
23 private import qt.core.QLineF; | |
24 private import qt.core.QRect; | |
25 private import qt.core.QLocale; | |
26 | |
27 version (Tango) | |
28 { | |
29 import tango.core.Array; | |
30 import tango.stdc.stringz; | |
31 import tango.text.convert.Utf; | |
87
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
32 import tango.core.Traits; |
1 | 33 } |
34 | |
35 | |
36 public class QVariant : QtDObject | |
37 { | |
38 enum Type { | |
39 Invalid = 0, | |
40 | |
41 Bool = 1, | |
42 Int = 2, | |
43 UInt = 3, | |
44 LongLong = 4, | |
45 ULongLong = 5, | |
46 Double = 6, | |
47 Char = 7, | |
48 Map = 8, | |
49 List = 9, | |
50 String = 10, | |
51 StringList = 11, | |
52 ByteArray = 12, | |
53 BitArray = 13, | |
54 Date = 14, | |
55 Time = 15, | |
56 DateTime = 16, | |
57 Url = 17, | |
58 Locale = 18, | |
59 Rect = 19, | |
60 RectF = 20, | |
61 Size = 21, | |
62 SizeF = 22, | |
63 Line = 23, | |
64 LineF = 24, | |
65 Point = 25, | |
66 PointF = 26, | |
67 RegExp = 27, | |
68 LastCoreType = RegExp, | |
69 | |
70 // value 62 is internally reserved | |
71 | |
72 Font = 64, | |
73 Pixmap = 65, | |
74 Brush = 66, | |
75 Color = 67, | |
76 Palette = 68, | |
77 Icon = 69, | |
78 Image = 70, | |
79 Polygon = 71, | |
80 Region = 72, | |
81 Bitmap = 73, | |
82 Cursor = 74, | |
83 SizePolicy = 75, | |
84 KeySequence = 76, | |
85 Pen = 77, | |
86 TextLength = 78, | |
87 TextFormat = 79, | |
88 Matrix = 80, | |
89 Transform = 81, | |
90 LastGuiType = Transform, | |
91 | |
92 UserType = 127, | |
93 | |
94 LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type | |
95 } | |
87
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
96 |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
97 // Functions |
1 | 98 |
87
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
99 static public QVariant fromValue(T)(T obj) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
100 { |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
101 QVariant var; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
102 static if (is(T == class) || is(T == interface)) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
103 { |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
104 int i = qtd_MetatypeId(toStringz(obj.classinfo.name)); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
105 var = new QVariant(i, cast(void*)(obj)); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
106 } |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
107 else static if (isDynamicArrayType!(T) || isStaticArrayType!(T) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
108 { |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
109 int i = qtd_MetatypeId(toStringz(typeid(ElementTypeOfArray!(T)).toString ~ "[]")); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
110 auto darray = new DArrayToC; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
111 darray.array = obj.dup; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
112 var = new QVariant(i, cast(void*)(darray)); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
113 } |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
114 else |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
115 { |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
116 int i = qtd_MetatypeId(toStringz(typeid(T).toString)); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
117 auto data = new T; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
118 *data = obj; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
119 var = new QVariant(i, cast(void*)(data)); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
120 } |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
121 return var; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
122 } |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
123 |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
124 static public QVariant opCall(T)(T obj) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
125 { |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
126 return fromValue(obj); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
127 } |
1 | 128 |
129 public this() { | |
130 void* __qt_return_value = qtd_QVariant_QVariant(); | |
131 super(__qt_return_value); | |
132 } | |
133 | |
134 | |
135 public this(QDataStream s) { | |
136 void* __qt_return_value = qtd_QVariant_QVariant_QDataStream(s is null ? null : s.nativeId); | |
137 super(__qt_return_value); | |
138 } | |
139 | |
140 | |
141 public this(Qt.GlobalColor color) { | |
142 void* __qt_return_value = qtd_QVariant_QVariant_GlobalColor(color); | |
143 super(__qt_return_value); | |
144 } | |
145 | |
146 | |
147 public this(bool b) { | |
148 void* __qt_return_value = qtd_QVariant_QVariant_bool(b); | |
149 super(__qt_return_value); | |
150 } | |
151 | |
152 | |
153 public this(QBitArray bitarray) { | |
154 void* __qt_return_value = qtd_QVariant_QVariant_QBitArray(bitarray is null ? null : bitarray.nativeId); | |
155 super(__qt_return_value); | |
156 } | |
157 | |
158 | |
159 public this(QByteArray bytearray) { | |
160 void* __qt_return_value = qtd_QVariant_QVariant_QByteArray(bytearray is null ? null : bytearray.nativeId); | |
161 super(__qt_return_value); | |
162 } | |
163 | |
164 | |
165 public this(QDate date) { | |
166 void* __qt_return_value = qtd_QVariant_QVariant_QDate(date is null ? null : date.nativeId); | |
167 super(__qt_return_value); | |
168 } | |
169 | |
170 | |
171 public this(QDateTime datetime) { | |
172 void* __qt_return_value = qtd_QVariant_QVariant_QDateTime(datetime is null ? null : datetime.nativeId); | |
173 super(__qt_return_value); | |
174 } | |
175 | |
176 | |
46 | 177 public this(string str) { |
1 | 178 void* __qt_return_value = qtd_QVariant_QVariant_String(str.ptr, str.length); |
179 super(__qt_return_value); | |
180 } | |
181 | |
182 | |
183 public this(QLine line) { | |
3
323efbe5c2f7
native wrap of QLine and QLineF, fixes in opEquals, updated QPainter to the use of native structs
eldar
parents:
1
diff
changeset
|
184 void* __qt_return_value = qtd_QVariant_QVariant_QLine(&line); |
1 | 185 super(__qt_return_value); |
186 } | |
187 | |
188 | |
189 public this(QLineF line) { | |
3
323efbe5c2f7
native wrap of QLine and QLineF, fixes in opEquals, updated QPainter to the use of native structs
eldar
parents:
1
diff
changeset
|
190 void* __qt_return_value = qtd_QVariant_QVariant_QLineF(&line); |
1 | 191 super(__qt_return_value); |
192 } | |
193 | |
194 | |
195 public this(QLocale locale) { | |
196 void* __qt_return_value = qtd_QVariant_QVariant_QLocale(locale is null ? null : locale.nativeId); | |
197 super(__qt_return_value); | |
198 } | |
199 | |
200 | |
201 public this(QPoint pt) { | |
202 void* __qt_return_value = qtd_QVariant_QVariant_QPoint(&pt); | |
203 super(__qt_return_value); | |
204 } | |
205 | |
206 | |
207 public this(QPointF pt) { | |
208 void* __qt_return_value = qtd_QVariant_QVariant_QPointF(&pt); | |
209 super(__qt_return_value); | |
210 } | |
211 | |
212 | |
213 public this(QRect rect) { | |
6 | 214 void* __qt_return_value = qtd_QVariant_QVariant_QRect(&rect); |
1 | 215 super(__qt_return_value); |
216 } | |
217 | |
218 | |
219 public this(QRectF rect) { | |
6 | 220 void* __qt_return_value = qtd_QVariant_QVariant_QRectF(&rect); |
1 | 221 super(__qt_return_value); |
222 } | |
223 | |
224 | |
225 public this(QRegExp regExp) { | |
226 void* __qt_return_value = qtd_QVariant_QVariant_QRegExp(regExp is null ? null : regExp.nativeId); | |
227 super(__qt_return_value); | |
228 } | |
229 | |
230 | |
231 public this(QSize size) { | |
232 void* __qt_return_value = qtd_QVariant_QVariant_QSize(&size); | |
233 super(__qt_return_value); | |
234 } | |
235 | |
236 | |
237 public this(QSizeF size) { | |
238 void* __qt_return_value = qtd_QVariant_QVariant_QSizeF(&size); | |
239 super(__qt_return_value); | |
240 } | |
241 | |
242 | |
243 public this(QTime time) { | |
244 void* __qt_return_value = qtd_QVariant_QVariant_QTime(time is null ? null : time.nativeId); | |
245 super(__qt_return_value); | |
246 } | |
247 | |
248 | |
249 public this(QUrl url) { | |
250 void* __qt_return_value = qtd_QVariant_QVariant_QUrl(url is null ? null : url.nativeId); | |
251 super(__qt_return_value); | |
252 } | |
253 | |
254 | |
255 public this(QVariant other) { | |
256 void* __qt_return_value = qtd_QVariant_QVariant_QVariant(other is null ? null : other.nativeId); | |
257 super(__qt_return_value); | |
258 } | |
259 | |
260 | |
261 public this(char* str) { | |
262 void* __qt_return_value = qtd_QVariant_QVariant_nativepointerchar(str); | |
263 super(__qt_return_value); | |
264 } | |
265 | |
266 | |
267 public this(double d) { | |
268 void* __qt_return_value = qtd_QVariant_QVariant_double(d); | |
269 super(__qt_return_value); | |
270 } | |
271 | |
272 | |
273 public this(int i) { | |
274 void* __qt_return_value = qtd_QVariant_QVariant_int(i); | |
275 super(__qt_return_value); | |
276 } | |
277 | |
278 | |
279 public this(int typeOrUserType, void* copy) { | |
280 void* __qt_return_value = qtd_QVariant_QVariant_int_nativepointervoid(typeOrUserType, copy); | |
281 super(__qt_return_value); | |
282 } | |
283 | |
284 | |
285 public this(long ll) { | |
286 void* __qt_return_value = qtd_QVariant_QVariant_long(ll); | |
287 super(__qt_return_value); | |
288 } | |
289 | |
290 | |
291 public this(uint ui) { | |
292 void* __qt_return_value = qtd_QVariant_QVariant_uint(ui); | |
293 super(__qt_return_value); | |
294 } | |
295 | |
296 | |
297 public this(ulong ull) { | |
298 void* __qt_return_value = qtd_QVariant_QVariant_ulong(ull); | |
299 super(__qt_return_value); | |
300 } | |
301 | |
302 public final bool canConvert(Type type) { | |
303 return qtd_QVariant_canConvert(nativeId, type); | |
304 } | |
305 | |
87
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
306 public final Type value(Type)() { |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
307 static if ( is(Type == QBitArray) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
308 return toBitArra; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
309 else static if ( is(Type == bool) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
310 return toBool; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
311 else static if ( is(Type == QByteArray) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
312 return toByteArray; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
313 else static if ( is(Type == QDate) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
314 return toDate; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
315 else static if ( is(Type == QDateTime) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
316 return toDateTime; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
317 else static if ( is(Type == double) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
318 return toDouble; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
319 else static if ( is(Type == int) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
320 return toInt; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
321 else static if ( is(Type == QLine) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
322 return toLine; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
323 else static if ( is(Type == QLineF) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
324 return toLineF; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
325 else static if ( is(Type == QLocale) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
326 return toLocale; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
327 else static if ( is(Type == long) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
328 return toLongLong; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
329 else static if ( is(Type == QPoint) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
330 return toPoint; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
331 else static if ( is(Type == QPointF) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
332 return toPointF; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
333 else static if ( is(Type == QRect) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
334 return toRect; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
335 else static if ( is(Type == QRectF) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
336 return toRectF; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
337 else static if ( is(Type == QRegExp) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
338 return toRegExp; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
339 else static if ( is(Type == QSize) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
340 return toSize; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
341 else static if ( is(Type == QSizeF) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
342 return toSizeF; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
343 else static if ( is(Type == string) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
344 return toString; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
345 else static if ( is(Type == QTime) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
346 return toTime; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
347 else static if ( is(Type == uint) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
348 return toUInt; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
349 else static if ( is(Type == ulong) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
350 return toULongLong; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
351 else static if ( is(Type == QUrl) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
352 return toUrl; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
353 else static if( is( Type == class ) || is( Type == interface ) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
354 { |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
355 Object object = cast(Object)qtd_QVariant_data(nativeId); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
356 if(object) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
357 return cast(Type)(object); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
358 return null; |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
359 } |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
360 else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
361 { |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
362 auto array = cast(DArrayToC*)qtd_QVariant_data(nativeId); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
363 return cast(Type)(array.array); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
364 } |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
365 else |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
366 { |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
367 return *cast(Type*)qtd_QVariant_data(nativeId); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
368 } |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
369 } |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
370 |
1 | 371 public final void clear() { |
372 qtd_QVariant_clear(nativeId); | |
373 } | |
374 | |
375 protected final bool cmp(QVariant other) { | |
376 return qtd_QVariant_cmp_QVariant(nativeId, other is null ? null : other.nativeId); | |
377 } | |
378 | |
379 protected final void create(int type, void* copy) { | |
380 qtd_QVariant_create_int_nativepointervoid(nativeId, type, copy); | |
381 } | |
382 | |
383 public final bool isNull() { | |
384 return qtd_QVariant_isNull(nativeId); | |
385 } | |
386 | |
387 public final bool isValid() { | |
388 return qtd_QVariant_isValid(nativeId); | |
389 } | |
390 | |
391 public final void load(QDataStream ds) { | |
392 qtd_QVariant_load_QDataStream(nativeId, ds is null ? null : ds.nativeId); | |
393 } | |
394 | |
395 public final void writeTo(QDataStream s) { | |
396 qtd_QVariant_writeTo_QDataStream(nativeId, s is null ? null : s.nativeId); | |
397 } | |
398 | |
399 public final QVariant operator_assign(QVariant other) { | |
400 void* __qt_return_value = qtd_QVariant_operator_assign_QVariant(nativeId, other is null ? null : other.nativeId); | |
401 return new QVariant(__qt_return_value, true); | |
402 } | |
403 | |
404 private final bool operator_equal(QVariant v) { | |
405 return qtd_QVariant_operator_equal_QVariant(nativeId, v is null ? null : v.nativeId); | |
406 } | |
407 | |
408 public final void readFrom(QDataStream s) { | |
409 qtd_QVariant_readFrom_QDataStream(nativeId, s is null ? null : s.nativeId); | |
410 } | |
411 | |
412 public final void save(QDataStream ds) { | |
413 qtd_QVariant_save_QDataStream(nativeId, ds is null ? null : ds.nativeId); | |
414 } | |
415 | |
416 public final QBitArray toBitArray() { | |
417 void* __qt_return_value = qtd_QVariant_toBitArray(nativeId); | |
418 return new QBitArray(__qt_return_value, false); | |
419 } | |
420 | |
421 public final bool toBool() { | |
422 return qtd_QVariant_toBool(nativeId); | |
423 } | |
424 | |
425 public final QByteArray toByteArray() { | |
426 void* __qt_return_value = qtd_QVariant_toByteArray(nativeId); | |
427 return new QByteArray(__qt_return_value, false); | |
428 } | |
429 | |
430 public final QDate toDate() { | |
431 void* __qt_return_value = qtd_QVariant_toDate(nativeId); | |
432 return new QDate(__qt_return_value, false); | |
433 } | |
434 | |
435 public final QDateTime toDateTime() { | |
436 void* __qt_return_value = qtd_QVariant_toDateTime(nativeId); | |
437 return new QDateTime(__qt_return_value, false); | |
438 } | |
439 | |
440 public final double toDouble(bool* ok = null) { | |
441 return qtd_QVariant_toDouble_nativepointerbool(nativeId, ok); | |
442 } | |
443 | |
444 public final int toInt(bool* ok = null) { | |
445 return qtd_QVariant_toInt_nativepointerbool(nativeId, ok); | |
446 } | |
447 | |
448 public final QLine toLine() { | |
3
323efbe5c2f7
native wrap of QLine and QLineF, fixes in opEquals, updated QPainter to the use of native structs
eldar
parents:
1
diff
changeset
|
449 return qtd_QVariant_toLine(nativeId); |
1 | 450 } |
451 | |
452 public final QLineF toLineF() { | |
3
323efbe5c2f7
native wrap of QLine and QLineF, fixes in opEquals, updated QPainter to the use of native structs
eldar
parents:
1
diff
changeset
|
453 return qtd_QVariant_toLineF(nativeId); |
1 | 454 } |
455 | |
456 public final QLocale toLocale() { | |
457 void* __qt_return_value = qtd_QVariant_toLocale(nativeId); | |
458 return new QLocale(__qt_return_value, false); | |
459 } | |
460 | |
461 public final long toLongLong(bool* ok = null) { | |
462 return qtd_QVariant_toLongLong_nativepointerbool(nativeId, ok); | |
463 } | |
464 | |
465 public final QPoint toPoint() { | |
466 return qtd_QVariant_toPoint(nativeId); | |
467 } | |
468 | |
469 public final QPointF toPointF() { | |
470 return qtd_QVariant_toPointF(nativeId); | |
471 } | |
472 | |
473 public final QRect toRect() { | |
6 | 474 return qtd_QVariant_toRect(nativeId); |
1 | 475 } |
476 | |
477 public final QRectF toRectF() { | |
6 | 478 return qtd_QVariant_toRectF(nativeId); |
1 | 479 } |
480 | |
481 public final QRegExp toRegExp() { | |
482 void* __qt_return_value = qtd_QVariant_toRegExp(nativeId); | |
483 return new QRegExp(__qt_return_value, false); | |
484 } | |
485 | |
486 public final QSize toSize() { | |
487 return qtd_QVariant_toSize(nativeId); | |
488 } | |
489 | |
490 public final QSizeF toSizeF() { | |
491 return qtd_QVariant_toSizeF(nativeId); | |
492 } | |
493 | |
494 public final string toString() { | |
46 | 495 string res; |
1 | 496 qtd_QVariant_toString(nativeId, &res); |
46 | 497 return res; |
1 | 498 } |
499 | |
500 public final QTime toTime() { | |
501 void* __qt_return_value = qtd_QVariant_toTime(nativeId); | |
502 return new QTime(__qt_return_value, false); | |
503 } | |
504 | |
505 public final uint toUInt(bool* ok = null) { | |
506 return qtd_QVariant_toUInt_nativepointerbool(nativeId, ok); | |
507 } | |
508 | |
509 public final ulong toULongLong(bool* ok = null) { | |
510 return qtd_QVariant_toULongLong_nativepointerbool(nativeId, ok); | |
511 } | |
512 | |
513 public final QUrl toUrl() { | |
514 void* __qt_return_value = qtd_QVariant_toUrl(nativeId); | |
515 return new QUrl(__qt_return_value, false); | |
516 } | |
517 | |
518 public final char* typeName() { | |
519 return qtd_QVariant_typeName(nativeId); | |
520 } | |
521 | |
522 public final int userType() { | |
523 return qtd_QVariant_userType(nativeId); | |
524 } | |
525 // Field accessors | |
526 | |
527 public this(void* native_id, bool no_real_delete = false) { | |
528 super(native_id, no_real_delete); | |
529 } | |
530 | |
531 | |
532 ~this() { | |
533 if(!__no_real_delete) | |
534 __free_native_resources(); | |
535 } | |
536 | |
537 protected void __free_native_resources() { | |
538 qtd_QVariant_destructor(nativeId()); | |
539 } | |
540 | |
541 // Injected code in class | |
542 } | |
543 extern (C) void qtd_QVariant_destructor(void *ptr); | |
544 | |
545 | |
546 // C wrappers | |
547 private extern(C) void* qtd_QVariant_QVariant(); | |
548 private extern(C) void* qtd_QVariant_QVariant_QDataStream(void* s0); | |
549 private extern(C) void* qtd_QVariant_QVariant_GlobalColor(int color0); | |
550 private extern(C) void* qtd_QVariant_QVariant_bool(bool b0); | |
551 private extern(C) void* qtd_QVariant_QVariant_QBitArray(void* bitarray0); | |
552 private extern(C) void* qtd_QVariant_QVariant_QByteArray(void* bytearray0); | |
553 private extern(C) void* qtd_QVariant_QVariant_QDate(void* date0); | |
554 private extern(C) void* qtd_QVariant_QVariant_QDateTime(void* datetime0); | |
555 private extern(C) void* qtd_QVariant_QVariant_String(char* string0, uint string0_size); | |
556 private extern(C) void* qtd_QVariant_QVariant_QLine(void* line0); | |
557 private extern(C) void* qtd_QVariant_QVariant_QLineF(void* line0); | |
558 private extern(C) void* qtd_QVariant_QVariant_QLocale(void* locale0); | |
559 private extern(C) void* qtd_QVariant_QVariant_QPoint(void* pt0); | |
560 private extern(C) void* qtd_QVariant_QVariant_QPointF(void* pt0); | |
561 private extern(C) void* qtd_QVariant_QVariant_QRect(void* rect0); | |
562 private extern(C) void* qtd_QVariant_QVariant_QRectF(void* rect0); | |
563 private extern(C) void* qtd_QVariant_QVariant_QRegExp(void* regExp0); | |
564 private extern(C) void* qtd_QVariant_QVariant_QSize(void* size0); | |
565 private extern(C) void* qtd_QVariant_QVariant_QSizeF(void* size0); | |
566 private extern(C) void* qtd_QVariant_QVariant_QTime(void* time0); | |
567 private extern(C) void* qtd_QVariant_QVariant_QUrl(void* url0); | |
568 private extern(C) void* qtd_QVariant_QVariant_QVariant(void* other0); | |
569 private extern(C) void* qtd_QVariant_QVariant_nativepointerchar(char* str0); | |
570 private extern(C) void* qtd_QVariant_QVariant_double(double d0); | |
571 private extern(C) void* qtd_QVariant_QVariant_int(int i0); | |
572 private extern(C) void* qtd_QVariant_QVariant_int_nativepointervoid(int typeOrUserType0, | |
573 void* copy1); | |
574 private extern(C) void* qtd_QVariant_QVariant_long(long ll0); | |
575 private extern(C) void* qtd_QVariant_QVariant_uint(uint ui0); | |
576 private extern(C) void* qtd_QVariant_QVariant_ulong(ulong ull0); | |
577 private extern(C) bool qtd_QVariant_canConvert(void* __this_nativeId, int); | |
578 private extern(C) void qtd_QVariant_clear(void* __this_nativeId); | |
579 private extern(C) bool qtd_QVariant_cmp_QVariant(void* __this_nativeId, | |
580 void* other0); | |
581 private extern(C) void qtd_QVariant_create_int_nativepointervoid(void* __this_nativeId, | |
582 int type0, | |
583 void* copy1); | |
584 private extern(C) bool qtd_QVariant_isNull(void* __this_nativeId); | |
585 private extern(C) bool qtd_QVariant_isValid(void* __this_nativeId); | |
586 private extern(C) void qtd_QVariant_load_QDataStream(void* __this_nativeId, | |
587 void* ds0); | |
588 private extern(C) void qtd_QVariant_writeTo_QDataStream(void* __this_nativeId, | |
589 void* s0); | |
590 private extern(C) void* qtd_QVariant_operator_assign_QVariant(void* __this_nativeId, | |
591 void* other0); | |
592 private extern(C) bool qtd_QVariant_operator_equal_QVariant(void* __this_nativeId, | |
593 void* v0); | |
594 private extern(C) void qtd_QVariant_readFrom_QDataStream(void* __this_nativeId, | |
595 void* s0); | |
596 private extern(C) void qtd_QVariant_save_QDataStream(void* __this_nativeId, | |
597 void* ds0); | |
598 private extern(C) void* qtd_QVariant_toBitArray(void* __this_nativeId); | |
599 private extern(C) bool qtd_QVariant_toBool(void* __this_nativeId); | |
600 private extern(C) void* qtd_QVariant_toByteArray(void* __this_nativeId); | |
601 private extern(C) void* qtd_QVariant_toDate(void* __this_nativeId); | |
602 private extern(C) void* qtd_QVariant_toDateTime(void* __this_nativeId); | |
603 private extern(C) double qtd_QVariant_toDouble_nativepointerbool(void* __this_nativeId, | |
604 bool* ok0); | |
605 private extern(C) int qtd_QVariant_toInt_nativepointerbool(void* __this_nativeId, | |
606 bool* ok0); | |
3
323efbe5c2f7
native wrap of QLine and QLineF, fixes in opEquals, updated QPainter to the use of native structs
eldar
parents:
1
diff
changeset
|
607 private extern(C) QLine qtd_QVariant_toLine(void* __this_nativeId); |
323efbe5c2f7
native wrap of QLine and QLineF, fixes in opEquals, updated QPainter to the use of native structs
eldar
parents:
1
diff
changeset
|
608 private extern(C) QLineF qtd_QVariant_toLineF(void* __this_nativeId); |
1 | 609 private extern(C) void* qtd_QVariant_toLocale(void* __this_nativeId); |
610 private extern(C) long qtd_QVariant_toLongLong_nativepointerbool(void* __this_nativeId, | |
611 bool* ok0); | |
612 private extern(C) QPoint qtd_QVariant_toPoint(void* __this_nativeId); | |
613 private extern(C) QPointF qtd_QVariant_toPointF(void* __this_nativeId); | |
6 | 614 private extern(C) QRect qtd_QVariant_toRect(void* __this_nativeId); |
615 private extern(C) QRectF qtd_QVariant_toRectF(void* __this_nativeId); | |
1 | 616 private extern(C) void* qtd_QVariant_toRegExp(void* __this_nativeId); |
617 private extern(C) QSize qtd_QVariant_toSize(void* __this_nativeId); | |
618 private extern(C) QSizeF qtd_QVariant_toSizeF(void* __this_nativeId); | |
619 private extern(C) void qtd_QVariant_toString(void* __this_nativeId, | |
620 void* __java_return_value); | |
621 private extern(C) void* qtd_QVariant_toTime(void* __this_nativeId); | |
622 private extern(C) uint qtd_QVariant_toUInt_nativepointerbool(void* __this_nativeId, | |
623 bool* ok0); | |
624 private extern(C) ulong qtd_QVariant_toULongLong_nativepointerbool(void* __this_nativeId, | |
625 bool* ok0); | |
626 private extern(C) void* qtd_QVariant_toUrl(void* __this_nativeId); | |
627 private extern(C) char* qtd_QVariant_typeName(void* __this_nativeId); | |
628 private extern(C) int qtd_QVariant_userType(void* __this_nativeId); | |
87
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
629 private extern(C) void *qtd_QVariant_data(void* __this_nativeId); |
f46133029d8b
qtd: Implement QMetaType. QVariant may save D types now.
SokoL_SD
parents:
46
diff
changeset
|
630 |
1 | 631 // Just the private functions for abstract functions implemeneted in superclasses |
632 | |
633 // Virtual Dispatch functions |