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