Mercurial > projects > qtd
annotate generator/typesystem_core-java.java @ 184:7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
author | eldar |
---|---|
date | Sat, 04 Jul 2009 13:04:46 +0000 |
parents | d3f4f14d43a5 |
children | 4fcf7ba2a791 |
rev | line source |
---|---|
1 | 1 /**************************************************************************** |
2 ** | |
3 ** Copyright (C) 1992-2008 Nokia. All rights reserved. | |
4 ** | |
5 ** This file is part of Qt Jambi. | |
6 ** | |
7 ** * Commercial Usage | |
8 * Licensees holding valid Qt Commercial licenses may use this file in | |
9 * accordance with the Qt Commercial License Agreement provided with the | |
10 * Software or, alternatively, in accordance with the terms contained in | |
11 * a written agreement between you and Nokia. | |
12 * | |
13 * | |
14 * GNU General Public License Usage | |
15 * Alternatively, this file may be used under the terms of the GNU | |
16 * General Public License versions 2.0 or 3.0 as published by the Free | |
17 * Software Foundation and appearing in the file LICENSE.GPL included in | |
18 * the packaging of this file. Please review the following information | |
19 * to ensure GNU General Public Licensing requirements will be met: | |
20 * http://www.fsf.org/licensing/licenses/info/GPLv2.html and | |
21 * http://www.gnu.org/copyleft/gpl.html. In addition, as a special | |
22 * exception, Nokia gives you certain additional rights. These rights | |
23 * are described in the Nokia Qt GPL Exception version 1.2, included in | |
24 * the file GPL_EXCEPTION.txt in this package. | |
25 * | |
26 * Qt for Windows(R) Licensees | |
27 * As a special exception, Nokia, as the sole copyright holder for Qt | |
28 * Designer, grants users of the Qt/Eclipse Integration plug-in the | |
29 * right for the Qt/Eclipse Integration to link to functionality | |
30 * provided by Qt Designer and its related libraries. | |
31 * | |
32 * | |
33 * If you are unsure which license is appropriate for your use, please | |
34 * contact the sales department at qt-sales@nokia.com. | |
35 | |
36 ** | |
37 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | |
38 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
39 ** | |
40 ****************************************************************************/ | |
41 | |
42 package generator; | |
43 | |
44 import qt.*; | |
45 import qt.core.*; | |
46 | |
47 class QObject___ extends QObject { | |
183 | 48 |
49 public bool __stackAllocated = false; | |
50 | |
51 public bool __qobject_is_deleting = false; | |
184
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
52 |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
53 new(size_t size, void* p = null) |
183 | 54 { |
55 if (!p) | |
56 { | |
57 p = malloc(size); | |
58 if (!p) | |
59 assert(false, "Out of memory"); | |
184
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
60 GC.addRange(p, size); |
183 | 61 } |
62 return p; | |
63 } | |
64 | |
65 delete(void* p) | |
66 { | |
184
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
67 if(p) |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
68 { |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
69 if (!(cast(typeof(this))p).__stackAllocated) { |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
70 free(p); |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
71 GC.removeRange(p); |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
72 } |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
73 } |
183 | 74 } |
184
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
75 |
183 | 76 // list of QObjects references to prevent them from garbage collecting if they are managed by Qt |
77 private static QObject[] __gc_ref_list; | |
1 | 78 |
79 // this flag controls whether QObject is managed by D's GC, or it has a parent and therefore managed by Qt | |
80 private bool __gc_managed = true; | |
183 | 81 |
82 // this flag needs to be set false when QObject is deleted from inside Qt so when deleting it from D it won't delete C++ object | |
83 public bool __no_real_delete = false; | |
1 | 84 }// class |
85 | |
86 abstract class QAbstractItemModel___ extends QAbstractItemModel { | |
87 /* private native boolean setData_native(long id, int row, int col, Object value, int role); | |
88 | |
89 public final boolean setData(int row, int col, Object value) { | |
90 return setData_native(nativeId(), row, col, value, qt.core.Qt.ItemDataRole.DisplayRole); | |
91 } | |
92 | |
93 public final boolean setData(int row, int col, Object value, int role) { | |
94 return setData_native(nativeId(), row, col, value, role); | |
95 } | |
96 | |
97 private native Object data_native(long id, int row, int col, int role); | |
98 | |
99 public final Object data(int row, int col, int role) { | |
100 return data_native(nativeId(), row, col, role); | |
101 } | |
102 | |
103 public final Object data(int row, int col) { | |
104 return data_native(nativeId(), row, col, Qt.ItemDataRole.DisplayRole); | |
105 }*/ | |
106 }// class | |
107 | |
108 class QTimer___ extends QTimer { | |
109 static private class QSingleShotTimer extends QObject { | |
110 private int timerId = -1; | |
111 public Signal0 timeout = new Signal0(); | |
112 | |
113 public QSingleShotTimer(int msec, QObject obj, String method) { | |
114 super(obj); | |
115 timeout.connect(obj, method); | |
116 timerId = startTimer(msec); | |
117 } | |
118 | |
119 protected void disposed() { | |
120 if (timerId > 0) | |
121 killTimer(timerId); | |
122 super.disposed(); | |
123 } | |
124 | |
125 protected void timerEvent(QTimerEvent e) { | |
126 if (timerId > 0) | |
127 killTimer(timerId); | |
128 timerId = -1; | |
129 timeout.emit(); | |
130 disposeLater(); | |
131 } | |
132 } | |
133 | |
134 public static void singleShot(int msec, QObject obj, String method) { | |
135 new QSingleShotTimer(msec, obj, method); | |
136 } | |
137 }// class | |
138 | |
139 class QCoreApplication___ extends QCoreApplication { | |
140 | |
141 protected static QCoreApplication m_instance = null; | |
142 | |
90 | 143 this(in string[] args) |
1 | 144 { |
145 // if (m_instance != null) | |
146 // throw new RuntimeException("QCoreApplication can only be initialized once"); | |
147 | |
148 argc = args.length; | |
149 argv = toStringzArray(args); | |
150 this(&argc, argv); | |
151 | |
152 // m_instance.aboutToQuit.connect(m_instance, "disposeOfMyself()"); | |
153 } | |
154 | |
155 private int argc; | |
156 private char **argv; | |
56
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
157 /* |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
158 public static string translate(string context, string key, string disambiguation, QCoreApplication_Encoding encoding) { |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
159 string res; |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
160 qtd_QCoreApplication_translate_nativepointerchar_nativepointerchar_nativepointerchar_Encoding(&res, toStringz(context), toStringz(key), toStringz(disambiguation), encoding); |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
161 return res; |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
162 } |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
163 |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
164 public static string translate(string context, string key, string disambiguation, QCoreApplication_Encoding encoding, int n) { |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
165 string res; |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
166 qtd_QCoreApplication_translate_nativepointerchar_nativepointerchar_nativepointerchar_Encoding_int(&res, toStringz(context), toStringz(key), toStringz(disambiguation), encoding, n); |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
167 return res; |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
168 } |
d5a6b6269f44
duic is working now on the first testcase, if there are any issues with it please report
eldar
parents:
1
diff
changeset
|
169 */ |
1 | 170 }// class |
171 | |
172 class QTranslator___ extends QTranslator { | |
173 public final bool load(ubyte[] data) { | |
174 return load(data.ptr, data.length); | |
175 } | |
176 }// class | |
177 | |
178 class QProcess___ extends QProcess { | |
179 | |
180 public static class DetachedProcessInfo { | |
181 public DetachedProcessInfo(boolean success, long pid) { | |
182 this.success = success; | |
183 this.pid = pid; | |
184 } | |
185 | |
186 public boolean success; | |
187 public long pid; | |
188 } | |
189 | |
190 public static DetachedProcessInfo startDetached(String program, java.util.List<String> arguments, String workingDirectory) { | |
191 QNativePointer pid = new QNativePointer(QNativePointer.Type.Long); | |
192 boolean success = startDetached(program, arguments, workingDirectory, pid); | |
193 return new DetachedProcessInfo(success, pid.longValue()); | |
194 } | |
195 }// class | |
196 | |
197 class QDataStream___ extends QDataStream { | |
198 | |
199 public final bool readBoolean() { | |
200 bool res; | |
201 operator_shift_right_boolean(&res); | |
202 return res; | |
203 } | |
204 | |
205 public final byte readByte() { | |
206 byte res; | |
207 operator_shift_right_byte(&res); | |
208 return res; | |
209 } | |
210 | |
211 public final short readShort() { | |
212 short res; | |
213 operator_shift_right_short(&res); | |
214 return res; | |
215 } | |
216 | |
217 public final int readInt() { | |
218 int res; | |
219 operator_shift_right_int(&res); | |
220 return res; | |
221 } | |
222 | |
223 public final long readLong() { | |
224 long res; | |
225 operator_shift_right_long(&res); | |
226 return res; | |
227 } | |
228 | |
229 public final ushort readChar() { | |
230 ushort res; | |
231 operator_shift_right_char(&res); | |
232 return res; | |
233 } | |
234 | |
235 public final float readFloat() { | |
236 float res; | |
237 operator_shift_right_float(&res); | |
238 return res; | |
239 } | |
240 | |
241 public final double readDouble() { | |
242 double res; | |
243 operator_shift_right_double(&res); | |
244 return res; | |
245 } | |
246 | |
247 public final QDataStream writeShort(short s) { | |
248 writeShort_char(s); | |
249 return this; | |
250 } | |
251 /* | |
252 private static extern(C) void qtd_QDataStream_readString_private(void* __this_nativeId); | |
253 | |
254 private native void writeString_private(long nativeId, String string); | |
255 | |
256 public final String readString() { | |
257 if (nativeId() == 0) | |
258 throw new QNoNativeResourcesException("Function call on incomplete object of type: " + getClass().getName()); | |
259 return readString_private(nativeId()); | |
260 } | |
261 | |
262 public final void writeString(String string) { | |
263 if (nativeId() == 0) | |
264 throw new QNoNativeResourcesException("Function call on incomplete object of type: " + getClass().getName()); | |
265 writeString_private(nativeId(), string); | |
266 } | |
267 | |
268 private native int writeBytes(long id, byte buffer[], int length); | |
269 | |
270 private native int readBytes(long id, byte buffer[], int length); | |
271 | |
272 public final int writeBytes(byte buffer[]) { | |
273 return writeBytes(buffer, buffer.length); | |
274 } | |
275 | |
276 public final int writeBytes(byte buffer[], int length) { | |
277 return writeBytes(nativeId(), buffer, length); | |
278 } | |
279 | |
280 public final int readBytes(byte buffer[]) { | |
281 return readBytes(buffer, buffer.length); | |
282 } | |
283 | |
284 public final int readBytes(byte buffer[], int length) { | |
285 return readBytes(nativeId(), buffer, length); | |
286 } | |
287 */ | |
288 }// class | |
289 | |
290 class QTextStream___ extends QTextStream { | |
291 /* public final void setCodec(String codecName) { | |
292 setCodec(QNativePointer.createCharPointer(codecName)); | |
293 if (codec() != __rcCodec) | |
294 __rcCodec = null; | |
295 } | |
296 | |
297 private QNativePointer srb = new QNativePointer(QNativePointer.Type.Byte, 32) { | |
298 { | |
299 setVerificationEnabled(false); | |
300 } | |
301 }; | |
302 | |
303 public final byte readByte() { | |
304 operator_shift_right_byte(srb); | |
305 return srb.byteValue(); | |
306 } | |
307 | |
308 public final short readShort() { | |
309 operator_shift_right_short(srb); | |
310 return srb.shortValue(); | |
311 } | |
312 | |
313 public final int readInt() { | |
314 operator_shift_right_int(srb); | |
315 return srb.intValue(); | |
316 } | |
317 | |
318 public final long readLong() { | |
319 operator_shift_right_long(srb); | |
320 return srb.longValue(); | |
321 } | |
322 | |
323 public final float readFloat() { | |
324 operator_shift_right_float(srb); | |
325 return srb.floatValue(); | |
326 } | |
327 | |
328 public final double readDouble() { | |
329 operator_shift_right_double(srb); | |
330 return srb.doubleValue(); | |
331 } | |
332 | |
333 public final QTextStream writeShort(short s) { | |
334 writeShort_char((char) s); | |
335 return this; | |
336 } | |
337 | |
338 public final QTextStream writeChar(char c) { | |
339 writeShort_char(c); | |
340 return this; | |
341 } | |
342 | |
343 public final char readChar() { | |
344 operator_shift_right_short(srb); | |
345 return srb.charValue(); | |
346 } | |
347 | |
348 public final String readString() { | |
349 return readString_native(nativeId()); | |
350 } | |
351 | |
352 public final void writeString(String string) { | |
353 writeString_native(nativeId(), string); | |
354 } | |
355 | |
356 private final native String readString_native(long id); | |
357 | |
358 private final native void writeString_native(long id, String string); | |
359 */ | |
360 }// class | |
361 | |
362 class QBitArray___ extends QBitArray { | |
363 /* | |
364 @qt.QtBlockedSlot | |
365 public final void xor(QBitArray other) { | |
366 operator_xor_assign(other); | |
367 } | |
368 | |
369 @qt.QtBlockedSlot | |
370 public final void and(QBitArray other) { | |
371 operator_and_assign(other); | |
372 } | |
373 | |
374 @qt.QtBlockedSlot | |
375 public final void or(QBitArray other) { | |
376 operator_or_assign(other); | |
377 } | |
378 | |
379 @qt.QtBlockedSlot | |
380 public final void set(QBitArray other) { | |
381 operator_assign(other); | |
382 } | |
383 | |
384 @qt.QtBlockedSlot | |
385 public final QBitArray inverted() { | |
386 return operator_negate(); | |
387 } | |
388 */ | |
389 }// class | |
390 | |
391 // hfr | |
392 | |
393 class QDate___ extends QDate { | |
394 | |
395 public final int weekNumber() { | |
396 return weekNumber(null); | |
397 } | |
398 | |
399 public final int yearOfWeekNumber() { | |
400 int np; | |
401 weekNumber(&np); | |
402 return np; | |
403 } | |
404 | |
405 }// class | |
406 | |
407 class QDir___ extends QDir { | |
408 /* | |
409 @qt.QtBlockedSlot | |
410 public String at(int i) { | |
411 return operator_subscript(i); | |
412 } | |
413 */ | |
414 }// class | |
415 | |
416 class QByteArray___ extends QByteArray { | |
417 public QByteArray(String s) { | |
418 this(); | |
419 append(s); | |
420 } | |
421 | |
422 public QByteArray(byte data[]) { | |
423 this(qt.internal.QtJambiInternal.byteArrayToNativePointer(data), data.length); | |
424 } | |
425 | |
426 public final boolean contains(String str) { | |
427 return contains(new QByteArray(str)); | |
428 } | |
429 | |
430 public final int count(String str) { | |
431 return count(new QByteArray(str)); | |
432 } | |
433 | |
434 public final boolean endsWith(String str) { | |
435 return endsWith(new QByteArray(str)); | |
436 } | |
437 | |
438 public final QByteArray prepend(String str) { | |
439 return prepend(new QByteArray(str)); | |
440 } | |
441 | |
442 public final QByteArray replace(QByteArray before, String after) { | |
443 return replace(before, new QByteArray(after)); | |
444 } | |
445 | |
446 public final QByteArray replace(String before, String after) { | |
447 return replace(new QByteArray(before), new QByteArray(after)); | |
448 } | |
449 | |
450 public final boolean startsWith(String str) { | |
451 return startsWith(new QByteArray(str)); | |
452 } | |
453 | |
454 public final byte[] toByteArray() { | |
455 byte[] res = new byte[size()]; | |
456 | |
457 for (int i = 0; i < size(); i++) { | |
458 res[i] = at(i); | |
459 } | |
460 return res; | |
461 } | |
462 | |
463 @qt.QtBlockedSlot | |
464 public final QByteArray set(QByteArray other) { | |
465 operator_assign(other); | |
466 return this; | |
467 } | |
468 | |
469 }// class | |
470 | |
471 class QFile___ extends QFile { | |
472 /* | |
473 public static String decodeName(String localFileName) { | |
474 return decodeName(qt.QNativePointer.createCharPointer(localFileName)); | |
475 } | |
476 */ | |
477 }// class | |
478 | |
479 class QIODevice___ extends QIODevice { | |
480 | |
481 /** | |
482 * Gets a byte from the device. | |
483 * | |
484 * @return -1 on failure, or the value of the byte on success | |
485 */ | |
486 /* public final int getByte() { | |
487 QNativePointer np = new QNativePointer(QNativePointer.Type.Byte); | |
488 boolean success = getByte(np); | |
489 return success ? np.byteValue() : -1; | |
490 } | |
491 */ | |
180 | 492 |
493 public final long write(string str) { | |
494 return write(str.ptr, str.length); | |
495 } | |
1 | 496 }// class |
497 | |
498 class QCryptographicHash___ extends QCryptographicHash { | |
499 | |
500 public final void addData(byte data[]) { | |
501 QNativePointer np = qt.internal.QtJambiInternal.byteArrayToNativePointer(data); | |
502 addData(np, data.length); | |
503 } | |
504 | |
505 }// class | |
506 | |
507 class QTextCodec___ extends QTextCodec { | |
508 /* | |
509 static { | |
510 setCodecForTr(QTextCodec.codecForName("UTF-8")); | |
511 } | |
512 | |
513 public static QTextCodec codecForName(String name) { | |
514 return codecForName(qt.QNativePointer.createCharPointer(name)); | |
515 } | |
516 */ | |
517 }// class | |
518 | |
519 class QBuffer___ extends QBuffer { | |
520 | |
521 // retain a reference to avoid gc | |
522 private Object strongDataReference = null; | |
523 public final void setBuffer(QByteArray byteArray) { | |
90 | 524 setBuffer_private(byteArray); |
1 | 525 strongDataReference = byteArray; |
526 } | |
527 | |
528 public final void setData(byte data[]) { | |
90 | 529 setData(cast(char*)data.ptr, data.length); |
1 | 530 } |
531 | |
532 }// class | |
533 | |
534 class QSignalMapper___ extends QSignalMapper { | |
535 | |
536 private java.util.Hashtable<QObject, QObject> __rcObjectForObject = new java.util.Hashtable<QObject, QObject>(); | |
537 | |
538 private java.util.Hashtable<QObject, Object> __rcWidgetForObject = new java.util.Hashtable<QObject, Object>(); | |
539 | |
540 }// class | |
541 | |
542 class QAbstractFileEngine_MapExtensionReturn___ extends QAbstractFileEngine_MapExtensionReturn { | |
543 /* private QNativePointer currentAddressNativePointer; // don't garbage collect while in use | |
544 public final void setAddress(String address) { | |
545 currentAddressNativePointer = address != null ? QNativePointer.createCharPointer(address) : null; | |
546 address_private(currentAddressNativePointer); | |
547 } | |
548 | |
549 public final String address() { | |
550 QNativePointer np = address_private(); | |
551 return np != null ? qt.internal.QtJambiInternal.charPointerToString(np) : null; | |
552 }*/ | |
553 }// class | |
554 | |
555 class QAbstractFileEngine___ extends QAbstractFileEngine { | |
556 /** | |
557 * Adds <tt>path</tt> to the set of paths in which Qt Jambi should search for resources. Resources | |
558 * can be accessed using the "classpath:" scheme. | |
559 */ | |
560 /* public static void addSearchPathForResourceEngine(String path) | |
561 { | |
562 qt.internal.QClassPathEngine.addSearchPath(path); | |
563 } | |
564 */ | |
565 /** | |
566 * Removes <tt>path</tt> from the set of paths in which Qt Jambi searches | |
567 * for resources. | |
568 */ | |
569 /* public static void removeSearchPathForResourceEngine(String path) | |
570 { | |
571 qt.internal.QClassPathEngine.removeSearchPath(path); | |
572 } | |
573 */ | |
574 }// class | |
575 | |
576 class QAbstractFileEngine_UnMapExtensionOption___ extends QAbstractFileEngine_UnMapExtensionOption { | |
577 private QNativePointer currentAddressNativePointer; // don't garbage collect while in use | |
578 public final void setAddress(String address) { | |
579 currentAddressNativePointer = address != null ? QNativePointer.createCharPointer(address) : null; | |
580 address_private(currentAddressNativePointer); | |
581 } | |
582 | |
583 public final String address() { | |
584 QNativePointer np = address_private(); | |
585 return np != null ? qt.internal.QtJambiInternal.charPointerToString(np) : null; | |
586 } | |
587 }// class | |
588 | |
589 class QFutureWatcher___ extends QFutureWatcher { | |
590 | |
591 public final QFuture<T> future() { | |
592 if (nativeId() == 0) | |
593 throw new QNoNativeResourcesException("Function call on incomplete object of type: " +getClass().getName()); | |
594 return __qt_future(nativeId()); | |
595 } | |
596 private native QFuture<T> __qt_future(long nativeId); | |
597 | |
598 }// class | |
599 | |
600 class QFutureWatcherVoid___ extends QFutureWatcherVoid { | |
601 | |
602 public final QFutureVoid future() { | |
603 if (nativeId() == 0) | |
604 throw new QNoNativeResourcesException("Function call on incomplete object of type: " +getClass().getName()); | |
605 return __qt_future(nativeId()); | |
606 } | |
607 | |
608 private native QFutureVoid __qt_future(long nativeId); | |
609 | |
610 }// class | |
611 | |
612 class QFutureSynchronizer___ extends QFutureSynchronizer { | |
613 | |
614 public final java.util.List<QFuture<T>> futures() { | |
615 if (nativeId() == 0) | |
616 throw new QNoNativeResourcesException("Function call on incomplete object of type: " +getClass().getName()); | |
617 return __qt_futures(nativeId()); | |
618 } | |
619 private native java.util.List<QFuture<T>> __qt_futures(long nativeId); | |
620 | |
621 }// class | |
622 | |
623 class QFutureSynchronizerVoid___ extends QFutureSynchronizerVoid { | |
624 | |
625 public final java.util.List<QFutureVoid> futures() { | |
626 if (nativeId() == 0) | |
627 throw new QNoNativeResourcesException("Function call on incomplete object of type: " +getClass().getName()); | |
628 return __qt_futures(nativeId()); | |
629 } | |
630 private native java.util.List<QFutureVoid> __qt_futures(long nativeId); | |
631 | |
632 }// class | |
633 | |
634 class QLineF___ extends QLineF { | |
635 /* | |
636 public final QLineF.IntersectType intersect(QLineF line, qt.core.QPointF intersectionPoint) { | |
637 return intersect(line, intersectionPoint != null ? intersectionPoint.nativePointer() : null); | |
638 } | |
639 */ | |
640 }// class | |
641 | |
642 /** | |
643 The QtConcurrent class contains static methods for running computations in parallel (using separate threads) | |
644 on the items in a java.util.Collection, such as a Vector or LinkedList. We will now describe these methods. | |
645 | |
646 The QtConcurrent::map(), QtConcurrent::mapped() and QtConcurrent::mappedReduced() functions run computations in parallel on the items in a sequence such as a QList or a QVector. QtConcurrent::map() modifies a sequence in-place, QtConcurrent::mapped() returns a new sequence containing the modified content, and QtConcurrent::mappedReduced() returns a single result. | |
647 Concurrent Map | |
648 <p> | |
649 QtConcurrent::mapped() takes an input sequence and a map function. This map function is then called for each item in the sequence, and a new sequence containing the return values from the map function is returned. | |
650 <p> | |
651 The map function must be of the form: | |
652 <pre> | |
653 U function(const T &t); | |
654 </pre> | |
655 T and U can be any type (and they can even be the same type), but T must match the type stored in the sequence. The function returns the modified or mapped content. | |
656 <p> | |
657 This example shows how to apply a scale function to all the items in a sequence: | |
658 <pre> | |
659 QImage scaled(const QImage &image) | |
660 { | |
661 return image.scaled(100, 100); | |
662 } | |
663 | |
664 QList <QImage> images = ...; | |
665 QFuture<QImage> thumbnails = QtConcurrent::mapped(images, scaled); | |
666 </pre> | |
667 The results of the map are made available through QFuture. See the QFuture and QFutureWatcher documentation for more information on how to use QFuture in your applications. | |
668 <p> | |
669 If you want to modify a sequence in-place, use QtConcurrent::map(). The map function must then be of the form: | |
670 <pre> | |
671 U function(T &t); | |
672 </pre> | |
673 Note that the return value and return type of the map function are not used. | |
674 <p> | |
675 Using QtConcurrent::map() is similar to using QtConcurrent::mapped(): | |
676 <pre> | |
677 void scale(QImage &image) | |
678 { | |
679 image = image.scaled(100, 100); | |
680 } | |
681 | |
682 QList<QImage> images = ...; | |
683 QFuture<void> future = QtConcurrent::map(images, scale); | |
684 </pre> | |
685 Since the sequence is modified in place, QtConcurrent::map() does not return any results via QFuture. However, you can still use QFuture and QFutureWatcher to monitor the status of the map. | |
686 Concurrent Map-Reduce | |
687 <p> | |
688 QtConcurrent::mappedReduced() is similar to QtConcurrent::mapped(), but instead of returning a sequence with the new results, the results are combined into a single value using a reduce function. | |
689 <p> | |
690 The reduce function must be of the form: | |
691 <pre> | |
692 V function(T &result, const U &intermediate) | |
693 </pre> | |
694 T is the type of the final result, U is the return type of the map function. Note that the return value and return type of the reduce function are not used. | |
695 <p> | |
696 Call QtConcurrent::mappedReduced() like this: | |
697 <pre> | |
698 void addToCollage(QImage &collage, const QImage &thumbnail) | |
699 { | |
700 QPainter p(&collage); | |
701 static QPoint offset = QPoint(0, 0); | |
702 p.drawImage(offset, thumbnail); | |
703 offset += ...; | |
704 } | |
705 | |
706 QList<QImage> images = ...; | |
707 QFuture<QImage> collage = QtConcurrent::mappedReduced(images, scaled, addToCollage); | |
708 </pre> | |
709 The reduce function will be called once for each result returned by the map function, and should merge the intermediate into the result variable. QtConcurrent::mappedReduced() guarantees that only one thread will call reduce at a time, so using a mutex to lock the result variable is not neccesary. The QtConcurrent::ReduceOptions enum provides a way to control the order in which the reduction is done. If QtConcurrent::UnorderedReduce is used (the default), the order is undefined, while QtConcurrent::OrderedReduce ensures that the reduction is done in the order of the original sequence. | |
710 Additional API Features | |
711 Using Iterators instead of Sequence | |
712 <p> | |
713 Each of the above functions has a variant that takes an iterator range instead of a sequence. You use them in the same way as the sequence variants: | |
714 <pre> | |
715 QList<QImage> images = ...; | |
716 | |
717 QFuture<QImage> thumbnails = QtConcurrent::mapped(images.constBegin(), images.constEnd(), scaled); | |
718 | |
719 // map in-place only works on non-const iterators | |
720 QFuture<void> future = QtConcurrent::map(images.begin(), images.end(), scale); | |
721 | |
722 QFuture<QImage> collage = QtConcurrent::mappedReduced(images.constBegin(), images.constEnd(), scaled, addToCollage); | |
723 </pre> | |
724 Blocking Variants | |
725 <p> | |
726 Each of the above functions has a blocking variant that returns the final result instead of a QFuture. You use them in the same way as the asynchronous variants. | |
727 <pre> | |
728 QList<QImage> images = ...; | |
729 | |
730 // each call blocks until the entire operation is finished | |
731 QList<QImage> future = QtConcurrent::blockingMapped(images, scaled); | |
732 | |
733 QtConcurrent::blockingMap(images, scale); | |
734 | |
735 QImage collage = QtConcurrent::blockingMappedReduced(images, scaled, addToCollage); | |
736 </pre> | |
737 Note that the result types above are not QFuture objects, but real result types (in this case, QList<QImage> and QImage). | |
738 Using Member Functions | |
739 <p> | |
740 QtConcurrent::map(), QtConcurrent::mapped(), and QtConcurrent::mappedReduced() accept pointers to member functions. The member function class type must match the type stored in the sequence: | |
741 <pre> | |
742 // squeeze all strings in a QStringList | |
743 QStringList strings = ...; | |
744 QFuture<void> squeezedStrings = QtConcurrent::map(strings, &QString::squeeze); | |
745 | |
746 // swap the rgb values of all pixels on a list of images | |
747 QList<QImage> images = ...; | |
748 QFuture<QImage> bgrImages = QtConcurrent::mapped(images, &QImage::rgbSwapped); | |
749 | |
750 // create a set of the lengths of all strings in a list | |
751 QStringList strings = ...; | |
752 QFuture<QSet<int> > wordLengths = QtConcurrent::mappedReduced(string, &QString::length, &QSet<int>::insert); | |
753 </pre> | |
754 Note that when using QtConcurrent::mappedReduced(), you can mix the use of normal and member functions freely: | |
755 <p> | |
756 <pre> | |
757 // can mix normal functions and member functions with QtConcurrent::mappedReduced() | |
758 | |
759 // compute the average length of a list of strings | |
760 extern void computeAverage(int &average, int length); | |
761 QStringList strings = ...; | |
762 QFuture<int> averageWordLength = QtConcurrent::mappedReduced(strings, &QString::length, computeAverage); | |
763 | |
764 // create a set of the color distribution of all images in a list | |
765 extern int colorDistribution(const QImage &string); | |
766 QList<QImage> images = ...; | |
767 QFuture<QSet<int> > totalColorDistribution = QtConcurrent::mappedReduced(images, colorDistribution, QSet<int>::insert); | |
768 </pre> | |
769 Using Function Objects | |
770 <p> | |
771 QtConcurrent::map(), QtConcurrent::mapped(), and QtConcurrent::mappedReduced() accept function objects, which can be used to add state to a function call. The result_type typedef must define the result type of the function call operator: | |
772 <pre> | |
773 struct Scaled | |
774 { | |
775 Scaled(int size) | |
776 : m_size(size) { } | |
777 | |
778 typedef QImage result_type; | |
779 | |
780 QImage operator()(const QImage &image) | |
781 { | |
782 return image.scaled(m_size, m_size); | |
783 } | |
784 | |
785 int m_size; | |
786 }; | |
787 | |
788 QList<QImage> images = ...; | |
789 QFuture<QImage> thumbnails = QtConcurrent::mapped(images, Scaled(100)); | |
790 </pre> | |
791 Using Bound Function Arguments | |
792 <p> | |
793 Note that Qt does not provide support for bound functions. This is provided by 3rd party libraries like Boost or C++ TR1 Library Extensions. | |
794 <p> | |
795 If you want to use a map function that takes more than one argument you can use boost::bind() or std::tr1::bind() to transform it onto a function that takes one argument. | |
796 <p> | |
797 As an example, we'll use QImage::scaledToWidth(): | |
798 <pre> | |
799 QImage QImage::scaledToWidth(int width, Qt::TransformationMode) const; | |
800 </pre> | |
801 scaledToWidth takes three arguments (including the "this" pointer) and can't be used with QtConcurrent::mapped() directly, because QtConcurrent::mapped() expects a function that takes one argument. To use QImage::scaledToWidth() with QtConcurrent::mapped() we have to provide a value for the width and the transformation mode: | |
802 <pre> | |
803 boost::bind(&QImage::scaledToWidth, 100 Qt::SmoothTransformation) | |
804 </pre> | |
805 The return value from boost::bind() is a function object (functor) with the following signature: | |
806 <pre> | |
807 QImage scaledToWith(const QImage &image) | |
808 </pre> | |
809 This matches what QtConcurrent::mapped() expects, and the complete example becomes: | |
810 <pre> | |
811 QList>QImage< images = ...; | |
812 QFuture>QImage< thumbnails = QtConcurrent::mapped(images, boost::bind(&QImage::scaledToWidth, 100 Qt::SmoothTransformation)); | |
813 </pre> | |
814 */ | |
815 class QtConcurrent___ extends QtConcurrent { | |
816 | |
817 static { | |
818 qt.QtJambi_LibraryInitializer.init(); | |
819 qt.core.QtJambi_LibraryInitializer.init(); | |
820 } | |
821 | |
822 /** | |
823 * An implemetation of this interface is given one to QtConcurrent's map() methods. | |
824 * The map() method of this interface is called for each object in a java.util.Collection. | |
825 * | |
826 */ | |
827 public interface MapFunctor<T> { | |
828 | |
829 /** | |
830 * This function is called for each item in the Collection. The function is then free to alter <tt>object</tt> as it see fit. | |
831 */ | |
832 public void map(T object); | |
833 } | |
834 /** | |
835 * Calls function once for each item in sequence. The function is passed a reference to the item, so that any modifications done to the item will appear in sequence. | |
836 */ | |
837 public static native <T> QFutureVoid map(java.util.Collection<T> sequence, MapFunctor<T> functor); | |
838 | |
839 /** | |
840 * Calls function once for each item in sequence. The function is passed a reference to the item, so that any modifications done to the item will appear in sequence. | |
841 */ | |
842 public static native <T> void blockingMap(java.util.Collection<T> sequence, MapFunctor<T> functor); | |
843 | |
844 /** | |
845 * Implement this interface to perform a mapped operation. An implementation of the interface is sendt | |
846 * to ome of the mapped methods of QtConcurrent, which applies the MappedFunctor.map() method to all elements in a collection, | |
847 * and returns the result. | |
848 */ | |
849 public interface MappedFunctor<U, T> { | |
850 | |
851 /** | |
852 * This method is called for each object in a collection. It should returned a new altered | |
853 * object. | |
854 */ | |
855 public U map(T object); | |
856 } | |
857 | |
858 /** | |
859 * Calls function once for each item in sequence and returns a future with each mapped item as a result. You can QFutureIterator to iterate through the results. | |
860 * | |
861 */ | |
862 public static native <U, T> QFuture<U> mapped(java.util.Collection<T> sequence, MappedFunctor<U, T> functor); | |
863 | |
864 /** | |
865 * Calls function once for each item in sequence and returns a future with each mapped item as a result. You can QFutureIterator to iterate through the results. | |
866 */ | |
867 public static native <U, T> java.util.List<U> blockingMapped(java.util.Collection<T> sequence, MappedFunctor<U, T> functor); | |
868 | |
869 /** | |
870 * Implement this interface in order to perform a reduce operation. | |
871 * <p> | |
872 * The reduce method will be called once per intermediate result (the result of the mapping of the data) | |
873 * and the very first time the reduce() method is called for the particular data set, the result is set to | |
874 * the returned value of the defaultResult() method. | |
875 */ | |
876 public interface ReducedFunctor<U, T> { | |
877 public U defaultResult(); | |
878 | |
879 /** | |
880 * Performs a reduce operation on <tt>intermediate</tt>. <tt>result</tt> is the result of the reduction. | |
881 */ | |
882 public void reduce(U result, T intermediate); | |
883 } | |
884 | |
885 /** | |
886 * This is an overloaded method provided for convenience. | |
887 * <p> | |
888 * It is equivalent of mappedReduced(sequence, functor, reducedFunctor, ReduceOption.UnorderedReduce, ReduceOption.SequentialReduce) | |
889 */ | |
890 public static <U, V, T> QFuture<U> mappedReduced(java.util.Collection<T> sequence, MappedFunctor<V, T> functor, ReducedFunctor<U, V> reducedFunctor) { | |
891 return mappedReduced(sequence, functor, reducedFunctor, ReduceOption.UnorderedReduce, ReduceOption.SequentialReduce); | |
892 } | |
893 | |
894 | |
895 /** | |
896 * This is an overloaded method provided for convenience. | |
897 * <p> | |
898 * Note that while mapFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is determined by reduceOptions. | |
899 * | |
900 */ | |
901 public static <U, V, T> QFuture<U> mappedReduced(java.util.Collection<T> sequence, MappedFunctor<V, T> functor, ReducedFunctor<U, V> reducedFunctor, ReduceOption ... options) { | |
902 return mappedReduced(sequence, functor, reducedFunctor, new ReduceOptions(options)); | |
903 } | |
904 | |
905 /** | |
906 * Calls mapFunction once for each item in sequence. The return value of each mapFunction is passed to reduceFunction. | |
907 * <p> | |
908 * Note that while mapFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is determined by reduceOptions. | |
909 * | |
910 */ | |
911 public static <U, V, T> QFuture<U> mappedReduced(java.util.Collection<T> sequence, MappedFunctor<V, T> functor, ReducedFunctor<U, V> reducedFunctor, ReduceOptions options) { | |
912 return mappedReduced(sequence, functor, reducedFunctor, options.value()); | |
913 } | |
914 | |
915 private native static <U, V, T> QFuture<U> mappedReduced(java.util.Collection<T> sequence, MappedFunctor<V, T> functor, ReducedFunctor<U, V> reducedFunctor, int options); | |
916 | |
917 | |
918 /** | |
919 * This is an overloaded method provided for convenience. | |
920 * <p> | |
921 * It is equivalent of calling blockingMappedReduced(sequence, functor, reducedFunctor, ReduceOption.UnorderedReduce, ReduceOption.SequentialReduce) | |
922 * | |
923 */ | |
924 public static <U, V, T> U blockingMappedReduced(java.util.Collection<T> sequence, MappedFunctor<V, T> functor, ReducedFunctor<U, V> reducedFunctor) { | |
925 return blockingMappedReduced(sequence, functor, reducedFunctor, ReduceOption.UnorderedReduce, ReduceOption.SequentialReduce); | |
926 } | |
927 | |
928 /** | |
929 * Calls mapFunction once for each item in sequence. The return value of each mapFunction is passed to reduceFunction. | |
930 * <p> | |
931 * Note that while mapFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is determined by reduceOptions. | |
932 * <p> | |
933 * Note: This function will block until all items in the sequence have been processed. | |
934 */ | |
935 public static <U, V, T> U blockingMappedReduced(java.util.Collection<T> sequence, MappedFunctor<V, T> functor, ReducedFunctor<U, V> reducedFunctor, ReduceOption ... options) { | |
936 return blockingMappedReduced(sequence, functor, reducedFunctor, new ReduceOptions(options)); | |
937 } | |
938 | |
939 /** | |
940 * Calls mapFunction once for each item in sequence. The return value of each mapFunction is passed to reduceFunction. | |
941 * <p> | |
942 * Note that while mapFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is determined by reduceOptions. | |
943 * <p> | |
944 * Note: This function will block until all items in the sequence have been processed. | |
945 */ | |
946 public static <U, V, T> U blockingMappedReduced(java.util.Collection<T> sequence, MappedFunctor<V, T> functor, ReducedFunctor<U, V> reducedFunctor, ReduceOptions options) { | |
947 return blockingMappedReduced(sequence, functor, reducedFunctor, options.value()); | |
948 } | |
949 | |
950 private native static <U, V, T> U blockingMappedReduced(java.util.Collection<T> sequence, MappedFunctor<V, T> functor, ReducedFunctor<U, V> reducedFunctor, int options); | |
951 | |
952 /** | |
953 * An implementation of this interface is given to one of QtConcurrent's filtered() methods. | |
954 * The filter method if this interface is called for each item in a java.util.Collection. | |
955 * | |
956 */ | |
957 public interface FilteredFunctor<T> { | |
958 | |
959 /** | |
960 * This method is called for each item in a java.util.Collection. The items for which | |
961 * this method returns true are removed from the collection. | |
962 */ | |
963 public boolean filter(T object); | |
964 } | |
965 | |
966 /** | |
967 * Calls filterFunctor's filtered() method once for each item in sequence and returns a new Sequence of kept items. If filterFunction returns true, a copy of the item is put in the new Sequence. Otherwise, the item will not appear in the new Sequence. | |
968 */ | |
969 public native static <T> QFuture<T> filtered(java.util.Collection<T> sequence, FilteredFunctor<T> filteredFunctor); | |
970 | |
971 /** | |
972 * Calls filterFunctor's filtered() method once for each item in sequence and returns a new Sequence of kept items. If filterFunction returns true, a copy of the item is put in the new Sequence. Otherwise, the item will not appear in the new Sequence. | |
973 */ | |
974 public native static <T> java.util.List<T> blockingFiltered(java.util.Collection<T> sequence, FilteredFunctor<T> filteredFunctor); | |
975 | |
976 | |
977 /** | |
978 * This is an overloaded method provided for convenience. It is equivalent of calling filteredReduced(sequence, filteredFunctor, ReduceOption.UnorderedReduce, ReduceOption.Seq This is an overloaded method provided for convenience. It is equivalent of calling filteredReduced) | |
979 */ | |
980 public static <U, T> QFuture<U> filteredReduced(java.util.Collection<T> sequence, FilteredFunctor<T> filteredFunctor, ReducedFunctor<U, T> reducedFunctor) { | |
981 return filteredReduced(sequence, filteredFunctor, reducedFunctor, ReduceOption.UnorderedReduce, ReduceOption.SequentialReduce); | |
982 } | |
983 | |
984 /** | |
985 * Calls filterFunction once for each item in sequence. If filterFunction returns true for an item, that item is then passed to reduceFunction. In other words, the return value is the result of reduceFunction for each item where filterFunction returns true. | |
986 * <p> | |
987 * Note that while filterFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is undefined if reduceOptions is QtConcurrent::UnorderedReduce. If reduceOptions is QtConcurrent::OrderedReduce, reduceFunction is called in the order of the original sequence. | |
988 */ | |
989 public static <U, T> QFuture<U> filteredReduced(java.util.Collection<T> sequence, FilteredFunctor<T> filteredFunctor, ReducedFunctor<U, T> reducedFunctor, ReduceOption ... options) { | |
990 return filteredReduced(sequence, filteredFunctor, reducedFunctor, new ReduceOptions(options)); | |
991 } | |
992 | |
993 /** | |
994 * Calls filterFunction once for each item in sequence. If filterFunction returns true for an item, that item is then passed to reduceFunction. In other words, the return value is the result of reduceFunction for each item where filterFunction returns true. | |
995 * <p> | |
996 * Note that while filterFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is undefined if reduceOptions is QtConcurrent::UnorderedReduce. If reduceOptions is QtConcurrent::OrderedReduce, reduceFunction is called in the order of the original sequence. | |
997 */ | |
998 public static <U, T> QFuture<U> filteredReduced(java.util.Collection<T> sequence, FilteredFunctor<T> filteredFunctor, ReducedFunctor<U, T> reducedFunctor, ReduceOptions options) { | |
999 return filteredReduced(sequence, filteredFunctor, reducedFunctor, options.value()); | |
1000 } | |
1001 private native static <U, T> QFuture<U> filteredReduced(java.util.Collection<T> sequence, FilteredFunctor<T> filteredFunctor, ReducedFunctor<U, T> reducedFunctor, int options); | |
1002 | |
1003 /** | |
1004 * This is an overloaded method provided for convenience. It is the equivalent of calling blockingFilteredReduced(sequence, filteredFunctor, reducedFunctor, ReduceOption.UnorderedReduce, ReduceOption.SequentialReduce) | |
1005 */ | |
1006 public static <U, T> U blockingFilteredReduced(java.util.Collection<T> sequence, FilteredFunctor<T> filteredFunctor, ReducedFunctor<U, T> reducedFunctor) { | |
1007 return blockingFilteredReduced(sequence, filteredFunctor, reducedFunctor, ReduceOption.UnorderedReduce, ReduceOption.SequentialReduce); | |
1008 } | |
1009 | |
1010 /** | |
1011 * Calls filterFunction once for each item in sequence. If filterFunction returns true for an item, that item is then passed to reduceFunction. In other words, the return value is the result of reduceFunction for each item where filterFunction returns true. | |
1012 * <p> | |
1013 * Note that while filterFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is undefined if reduceOptions is QtConcurrent::UnorderedReduce. If reduceOptions is QtConcurrent::OrderedReduce, reduceFunction is called in the order of the original sequence. | |
1014 */ | |
1015 public static <U, T> U blockingFilteredReduced(java.util.Collection<T> sequence, FilteredFunctor<T> filteredFunctor, ReducedFunctor<U, T> reducedFunctor, ReduceOption ... options) { | |
1016 return blockingFilteredReduced(sequence, filteredFunctor, reducedFunctor, new ReduceOptions(options)); | |
1017 } | |
1018 | |
1019 /** | |
1020 * Calls filterFunction once for each item in sequence. If filterFunction returns true for an item, that item is then passed to reduceFunction. In other words, the return value is the result of reduceFunction for each item where filterFunction returns true. | |
1021 * <p> | |
1022 * Note that while filterFunction is called concurrently, only one thread at a time will call reduceFunction. The order in which reduceFunction is called is undefined if reduceOptions is QtConcurrent::UnorderedReduce. If reduceOptions is QtConcurrent::OrderedReduce, reduceFunction is called in the order of the original sequence. | |
1023 */ | |
1024 public static <U, T> U blockingFilteredReduced(java.util.Collection<T> sequence, FilteredFunctor<T> filteredFunctor, ReducedFunctor<U, T> reducedFunctor, ReduceOptions options) { | |
1025 return blockingFilteredReduced(sequence, filteredFunctor, reducedFunctor, options.value()); | |
1026 } | |
1027 | |
1028 private native static <U, T> U blockingFilteredReduced(java.util.Collection<T> sequence, FilteredFunctor<T> filteredFunctor, ReducedFunctor<U, T> reducedFunctor, int options); | |
1029 | |
1030 /** | |
1031 * Executes the method <tt>m</tt> through the QtConcurrent framework with the given arguments. The returned QFuture object's result wil be the | |
1032 * return value of <tt>m</tt>. Note that this method does not accept function that return void. use runVoidMethod() for this. | |
1033 */ | |
1034 public static <T> QFuture<T> run(Object _this, java.lang.reflect.Method m, Object ... args) { | |
1035 if (m.getReturnType() == null || m.getReturnType().equals(Void.TYPE)) | |
1036 throw new IllegalArgumentException("Cannot call run on method returning void. Use 'runVoidMethod' instead."); | |
1037 | |
1038 return runPrivate(_this, m.getDeclaringClass(), m, args, qt.internal.QtJambiInternal.resolveConversionSchema(m.getParameterTypes(), m.getParameterTypes()), qt.internal.QtJambiInternal.typeConversionCode(m.getReturnType())); | |
1039 } | |
1040 private native static <T> QFuture<T> runPrivate(Object _this, Class<?> declaringClass, java.lang.reflect.Method m, Object args[], int conversionScheme[], byte returnType); | |
1041 | |
1042 /** | |
1043 * Executes the method <tt>m</tt> with the given arguments using the QtConcurrent framework. Notice that runVoidMethod() does not | |
1044 * accept methods that has a return value. Use the run() method for this purpose. | |
1045 */ | |
1046 public static QFutureVoid runVoidMethod(Object _this, java.lang.reflect.Method m, Object ... args) { | |
1047 if (m.getReturnType() != null && !m.getReturnType().equals(Void.TYPE)) | |
1048 throw new IllegalArgumentException("Cannot call runVoidMethod on method returning non-void type. Use 'run' instead."); | |
1049 | |
1050 return runVoidMethodPrivate(_this, m.getDeclaringClass(), m, args, qt.internal.QtJambiInternal.resolveConversionSchema(m.getParameterTypes(), m.getParameterTypes())); | |
1051 } | |
1052 private native static QFutureVoid runVoidMethodPrivate(Object _this, Class<?> declaringClass, java.lang.reflect.Method m, Object args[], int conversionScheme[]); | |
1053 | |
1054 | |
1055 }// class |