Mercurial > projects > qtd
annotate d2/qt/QGlobal.d @ 414:b2a803c73b89 default tip
Declare tabArray const.
author | David Nadlinger <code@klickverbot.at> |
---|---|
date | Fri, 06 May 2011 13:39:49 +0200 |
parents | 403d98bd47f6 |
children |
rev | line source |
---|---|
1 | 1 module qt.QGlobal; |
2 | |
194
ba7abb5c9e03
move the generated data from qt.QGlobal to qt.QDefines.
SokoL_SD
parents:
191
diff
changeset
|
3 public import qt.QDefines; |
1 | 4 |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
5 import |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
6 std.stdio, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
7 std.c.stdlib, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
8 core.memory; |
254 | 9 |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
10 public import // TODO: import privately |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
11 qtd.String, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
12 qtd.Core; |
1 | 13 |
390
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
14 template QT_BEGIN_NAMESPACE() { |
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
15 } |
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
16 |
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
17 template QT_END_NAMESPACE() { |
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
18 } |
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
19 |
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
20 template QT_BEGIN_HEADER() { |
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
21 } |
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
22 |
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
23 template QT_END_HEADER() { |
403d98bd47f6
Added QT_{BEGIN,END}_{HEADER,NAMESPACE} also to the D2 version ? they are empty, but referenced in the output of duic.
David Nadlinger <code@klickverbot.at>
parents:
371
diff
changeset
|
24 } |
1 | 25 |
353 | 26 string tr(string arg) { |
1 | 27 return arg; |
28 } | |
29 | |
30 /* | |
31 can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) | |
32 */ | |
33 bool QT_VERSION_CHECK( ushort major, ushort minor, ushort patch ) | |
34 { | |
35 return cast(bool)((major<<16)|(minor<<8)|(patch)); | |
36 } | |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
37 |
1 | 38 const char[] QT_PACKAGEDATE_STR = "2008-09-27"; |
39 const char[] QT_PACKAGE_TAG = "gc9953de622c6a0f655322e0d9f5bd6dc2803b470"; | |
40 | |
41 /* | |
42 Size-dependent types (architechture-dependent byte order) | |
43 | |
44 Make sure to update QMetaType when changing these typedefs | |
45 */ | |
46 | |
47 alias char qint8; /* 8 bit signed */ | |
48 alias char quint8; /* 8 bit unsigned */ | |
49 alias short qint16; /* 16 bit signed */ | |
50 alias ushort quint16; /* 16 bit unsigned */ | |
51 alias int qint32; /* 32 bit signed */ | |
52 alias uint quint32; /* 32 bit unsigned */ | |
53 alias long qint64; /* 64 bit signed */ | |
54 alias ulong quint64; /* 64 bit unsigned */ | |
55 | |
39 | 56 version (X86) |
57 { | |
58 alias quint32 quintptr; | |
59 alias qint32 qptrdiff; | |
60 } | |
61 else version (X86_64) | |
62 { | |
63 alias quint64 quintptr; | |
64 alias qint64 qptrdiff; | |
65 } | |
66 | |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
67 enum byte QT_POINTER_SIZE = 8; |
1 | 68 |
69 alias int QNoImplicitBoolCast; | |
70 | |
71 alias double qreal; | |
72 | |
73 | |
74 /* | |
75 Utility macros and inline functions | |
76 TODO(katrina) see if we need to do anything to make these | |
77 able to be evaluated at compile time | |
78 */ | |
79 | |
80 T qAbs(T)(T t) { return t >= 0 ? t : -t; } | |
81 | |
82 int qRound(qreal d) | |
83 { return d >= 0.0 ? cast(int)(d + 0.5) : cast(int)(d - cast(int)(d-1) + 0.5) + cast(int)(d-1); } | |
84 | |
85 qint64 qRound64(qreal d) | |
86 { return d >= 0.0 ? cast(qint64)(d + 0.5) : cast(qint64)(d - cast(qint64)(d-1) + 0.5) + cast(qint64)(d-1); } | |
87 | |
88 T qMin(T)(T a,T b) { if (a < b) return a; return b; } | |
89 T qMax(T)(T a, T b) { if (a < b) return b; return a; } | |
90 T qBound(T)(T min, T val,T max) { return qMax(min, qMin(max, val)); } | |
91 | |
92 /* | |
93 Data stream functions are provided by many classes (defined in qdatastream.h) | |
94 */ | |
95 | |
96 //class QDataStream; | |
97 | |
98 /* | |
99 System information | |
100 */ | |
101 | |
102 class QSysInfo { | |
103 public: | |
104 enum Sizes { | |
105 WordSize = ((void *).sizeof<<3) | |
106 }; | |
107 | |
108 enum Endian { | |
109 BigEndian, | |
110 LittleEndian, | |
111 ByteOrder = BigEndian | |
112 }; | |
113 /* needed to bootstrap qmake */ | |
114 static const int ByteOrder; | |
115 | |
116 enum WinVersion { | |
117 WV_32s = 0x0001, | |
118 WV_95 = 0x0002, | |
119 WV_98 = 0x0003, | |
120 WV_Me = 0x0004, | |
121 WV_DOS_based= 0x000f, | |
122 | |
123 WV_NT = 0x0010, | |
124 WV_2000 = 0x0020, | |
125 WV_XP = 0x0030, | |
126 WV_2003 = 0x0040, | |
127 WV_VISTA = 0x0080, | |
128 WV_NT_based = 0x00f0, | |
129 | |
130 WV_CE = 0x0100, | |
131 WV_CENET = 0x0200, | |
132 WV_CE_5 = 0x0300, | |
133 WV_CE_6 = 0x0400, | |
134 WV_CE_based = 0x0f00 | |
135 }; | |
136 static const WinVersion WindowsVersion; | |
137 static WinVersion windowsVersion(); | |
138 | |
139 enum MacVersion { | |
140 MV_Unknown = 0x0000, | |
141 | |
142 /* version */ | |
143 MV_9 = 0x0001, | |
144 MV_10_0 = 0x0002, | |
145 MV_10_1 = 0x0003, | |
146 MV_10_2 = 0x0004, | |
147 MV_10_3 = 0x0005, | |
148 MV_10_4 = 0x0006, | |
149 MV_10_5 = 0x0007, | |
150 | |
151 /* codenames */ | |
152 MV_CHEETAH = MV_10_0, | |
153 MV_PUMA = MV_10_1, | |
154 MV_JAGUAR = MV_10_2, | |
155 MV_PANTHER = MV_10_3, | |
156 MV_TIGER = MV_10_4, | |
157 MV_LEOPARD = MV_10_5 | |
158 }; | |
159 static const MacVersion MacintoshVersion; | |
160 }; | |
161 | |
247 | 162 |
163 extern(C) stringz qtd_qVersion(); | |
164 /// | |
165 string qVersion() | |
166 { | |
167 return fromStringz(qtd_qVersion); | |
168 } | |
1 | 169 |
247 | 170 extern(C) bool qtd_qSharedBuild(); |
171 /// | |
172 bool qSharedBuild() | |
173 { | |
174 return qtd_qSharedBuild; | |
175 } | |
176 | |
177 /// | |
1 | 178 int qMacVersion() { return QSysInfo.MacintoshVersion; } |
179 | |
247 | 180 /// |
1 | 181 void qUnused(T)(T x) { cast(void) x; } |
247 | 182 /// |
1 | 183 void Q_UNUSED(T)(T x) { qUnused(x); } |
184 | |
185 /* | |
186 Debugging and error handling | |
187 */ | |
188 | |
189 //class QString; | |
190 //char[] qPrintable(QString string) { string.toLocal8Bit().constData(); } | |
191 //TODO(katrina) These should probably actually call into the c++ functions | |
291 | 192 void qFatal(string str) |
193 { | |
194 throw new Exception(str); | |
195 } | |
196 | |
1 | 197 void qDebug( char[] str ) /* print debug message */ |
198 { writeln(str); } | |
199 | |
200 extern (C) void Qt_qWarning( char * ); | |
201 | |
202 void qWarning(char[] str) /* print warning message */ | |
203 { writeln(str); } | |
204 | |
205 //QString qt_error_string(int errorCode = -1); | |
206 void qCritical(char[] str) /* print critical message */ | |
207 { writeln(str); } | |
208 | |
209 /* | |
210 Forward declarations only. | |
211 | |
212 In order to use the qDebug() stream, you must #include<QDebug> | |
213 */ | |
214 //class QDebug; | |
215 //class QNoDebug; | |
216 //QDebug qDebug(); | |
217 //QDebug qWarning(); | |
218 //QDebug qCritical(); | |
219 | |
220 void qt_noop() {} | |
221 //TODO(katrina) Implement these | |
222 void qt_assert(char[] assertion, char[] file, int line); | |
223 | |
224 void qt_assert_x(char[] where, char[] what, char[] file, int line); | |
225 | |
226 void qt_check_pointer(char[], int); | |
227 | |
228 enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg }; | |
229 | |
230 void qt_message_output(QtMsgType, char[] buf); | |
231 //class QtMsgHandler; | |
232 //QtMsgHandler qInstallMsgHandler(QtMsgHandler); | |
233 | |
234 // forward declaration, since qatomic.h needs qglobal.h | |
235 class QBasicAtomicPointer(T); | |
236 | |
237 // POD for Q_GLOBAL_STATIC | |
238 class QGlobalStatic(T) | |
239 { | |
240 public: | |
241 QBasicAtomicPointer!(T) pointer; | |
242 bool destroyed; | |
243 }; | |
244 | |
245 // Created as a function-local static to delete a QGlobalStatic<T> | |
246 class QGlobalStaticDeleter(T) | |
247 { | |
248 public: | |
249 QGlobalStatic!(T) globalStatic; | |
250 this(QGlobalStatic!(T) _globalStatic) { | |
251 globalStatic(_globalStatic); | |
252 } | |
253 | |
254 ~this() | |
255 { | |
256 delete globalStatic.pointer; | |
257 globalStatic.pointer = 0; | |
258 globalStatic.destroyed = true; | |
259 } | |
260 }; | |
261 | |
262 class QBool | |
263 { | |
264 bool b; | |
265 | |
266 public: | |
267 this(bool B) { b = B; } | |
268 // void *() const | |
269 // { return b ? static_cast<const void *>(this) : static_cast<const void *>(0); } | |
270 } | |
271 | |
272 bool qFuzzyCompare(double p1, double p2) | |
273 { | |
274 return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2))); | |
275 } | |
276 | |
277 bool qFuzzyCompare(float p1, float p2) | |
278 { | |
279 return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); | |
280 } | |
281 | |
282 /* | |
283 This function tests a double for a null value. It doesn't | |
284 check whether the actual value is 0 or close to 0, but whether | |
285 it is binary 0. | |
286 */ | |
287 bool qIsNull(double d) | |
288 { | |
289 union U { | |
290 double d; | |
291 quint64 u; | |
292 }; | |
293 U val; | |
294 val.d = d; | |
295 return val.u == cast(quint64)(0); | |
296 } | |
297 | |
298 /* | |
299 This function tests a float for a null value. It doesn't | |
300 check whether the actual value is 0 or close to 0, but whether | |
301 it is binary 0. | |
302 */ | |
303 bool qIsNull(float f) | |
304 { | |
305 union U { | |
306 float f; | |
307 quint32 u; | |
308 }; | |
309 U val; | |
310 val.f = f; | |
311 return val.u == 0u; | |
312 } | |
313 | |
314 /* | |
315 Compilers which follow outdated template instantiation rules | |
316 require a class to have a comparison operator to exist when | |
317 a QList of this type is instantiated. It's not actually | |
318 used in the list, though. Hence the dummy implementation. | |
319 Just in case other code relies on it we better trigger a warning | |
320 mandating a real implementation. | |
321 */ | |
322 | |
323 | |
324 /* | |
325 QTypeInfo - type trait functionality | |
326 qIsDetached - data sharing functionality | |
327 */ | |
328 | |
329 /* | |
330 The catch-all template. | |
331 */ | |
292 | 332 /* |
1 | 333 bool qIsDetached(T)(T) { return true; } |
334 | |
335 class QTypeInfossss(T) | |
336 { | |
337 public: | |
338 enum { | |
339 isPointer = false, | |
340 isComplex = true, | |
341 isStatic = true, | |
342 isLarge = ((T).sizeof>(void*).sizeof), | |
343 isDummy = false | |
344 }; | |
345 }; | |
346 | |
347 class QTypeInfo(T) | |
348 { | |
349 public: | |
350 enum { | |
351 isPointer = true, | |
352 isComplex = false, | |
353 isStatic = false, | |
354 isLarge = false, | |
355 isDummy = false | |
356 }; | |
357 }; | |
292 | 358 */ |
1 | 359 |
360 /* | |
361 Specialize a specific type with: | |
362 | |
363 Q_DECLARE_TYPEINFO(type, flags); | |
364 | |
365 where 'type' is the name of the type to specialize and 'flags' is | |
366 logically-OR'ed combination of the flags below. | |
367 */ | |
368 enum { /* TYPEINFO flags */ | |
369 Q_COMPLEX_TYPE = 0, | |
370 Q_PRIMITIVE_TYPE = 0x1, | |
371 Q_STATIC_TYPE = 0, | |
372 Q_MOVABLE_TYPE = 0x2, | |
373 Q_DUMMY_TYPE = 0x4 | |
374 }; | |
375 | |
376 /* | |
377 Specialize a shared type with: | |
378 | |
379 Q_DECLARE_SHARED(type); | |
380 | |
381 where 'type' is the name of the type to specialize. NOTE: shared | |
382 types must declare a 'bool isDetached(void) const;' member for this | |
383 to work. | |
384 */ | |
385 void qSwap_helper(T)(ref T value1, ref T value2, T*) | |
386 { | |
387 T t = value1; | |
388 value1 = value2; | |
389 value2 = t; | |
390 } | |
391 bool qIsDetached(T)(ref T t) { return t.isDetached(); } | |
392 void qSwap_helper(T)(ref T value1, ref T value2, T*) | |
393 { | |
394 const T.DataPtr t = value1.data_ptr(); | |
395 value1.data_ptr() = value2.data_ptr(); | |
396 value2.data_ptr() = t; | |
397 } | |
155 | 398 |
1 | 399 void qSwap(T)(ref T value1, ref T value2) |
400 { | |
155 | 401 T t = value1; |
402 value1 = value2; | |
403 value2 = t; | |
1 | 404 } |
405 | |
406 /* | |
407 QTypeInfo primitive specializations | |
408 TODO(katrina) Find out what we need to do here | |
409 */ | |
410 /* | |
411 Q_DECLARE_TYPEINFO(bool, Q_PRIMITIVE_TYPE); | |
412 Q_DECLARE_TYPEINFO(char, Q_PRIMITIVE_TYPE); | |
413 Q_DECLARE_TYPEINFO(signed char, Q_PRIMITIVE_TYPE); | |
414 Q_DECLARE_TYPEINFO(uchar, Q_PRIMITIVE_TYPE); | |
415 Q_DECLARE_TYPEINFO(short, Q_PRIMITIVE_TYPE); | |
416 Q_DECLARE_TYPEINFO(ushort, Q_PRIMITIVE_TYPE); | |
417 Q_DECLARE_TYPEINFO(int, Q_PRIMITIVE_TYPE); | |
418 Q_DECLARE_TYPEINFO(uint, Q_PRIMITIVE_TYPE); | |
419 Q_DECLARE_TYPEINFO(long, Q_PRIMITIVE_TYPE); | |
420 Q_DECLARE_TYPEINFO(ulong, Q_PRIMITIVE_TYPE); | |
421 Q_DECLARE_TYPEINFO(qint64, Q_PRIMITIVE_TYPE); | |
422 Q_DECLARE_TYPEINFO(quint64, Q_PRIMITIVE_TYPE); | |
423 Q_DECLARE_TYPEINFO(float, Q_PRIMITIVE_TYPE); | |
424 Q_DECLARE_TYPEINFO(double, Q_PRIMITIVE_TYPE); | |
425 #ifndef Q_OS_DARWIN | |
426 Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE); | |
427 #endif | |
428 */ | |
429 /* | |
430 These functions make it possible to use standard C++ functions with | |
431 a similar name from Qt header files (especially template classes). | |
432 TODO(katrina) Implement these | |
433 */ | |
434 void * qMalloc(size_t size); | |
435 void qFree(void * ptr); | |
436 void * qRealloc(void * ptr, size_t size); | |
437 void * qMemCopy(void * dest, void * src, size_t n); | |
438 void * qMemSet(void * dest, int c, size_t n); | |
439 | |
440 /* TODO typesafety | |
441 #define Q_DECLARE_FLAGS(Flags, Enum)\ | |
442 typedef QFlags<Enum> Flags; | |
443 #define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \ | |
444 QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \ | |
445 { return QFlags<Flags::enum_type>(f1) | f2; } \ | |
446 QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \ | |
447 { return f2 | f1; } | |
448 */ | |
449 | |
450 char[] QT_TR_NOOP(char[] x) { return x; } | |
451 char[] QT_TRANSLATE_NOOP(char[] s, char[] x) { return x; } | |
452 char[] QT_TRANSLATE_NOOP3(char[] s, char[] x, char[] comment) { return x; } | |
453 | |
454 //class QByteArray; | |
455 //QByteArray qgetenv(char[] varName); | |
456 //bool qputenv(char[] varName, QByteArray value); | |
457 | |
458 int qIntCast(double f) { return cast(int)(f); } | |
459 int qIntCast(float f) { return cast(int)(f); } | |
460 | |
461 /* | |
462 Reentrant versions of basic rand() functions for random number generation | |
463 */ | |
371
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
464 private extern(C) int qtd_qrand(); |
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
465 private extern(C) void qtd_qsrand(uint); |
1 | 466 |
371
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
467 void qsrand(uint seed) |
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
468 { |
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
469 qtd_qsrand(seed); |
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
470 } |
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
471 |
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
472 int qrand() |
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
473 { |
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
474 return qtd_qrand(); |
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
475 } |
1 | 476 |
477 /* | |
478 This gives us the possibility to check which modules the user can | |
479 use. These are purely compile time checks and will generate no code. | |
480 */ | |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
481 enum : ushort |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
482 { |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
483 /* Qt modules */ |
1 | 484 |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
485 QT_MODULE_CORE = 0x0001, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
486 QT_MODULE_GUI = 0x0002, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
487 QT_MODULE_NETWORK = 0x0004, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
488 QT_MODULE_OPENGL = 0x0008, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
489 QT_MODULE_SQL = 0x0010, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
490 QT_MODULE_XML = 0x0020, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
491 QT_MODULE_QT3SUPPORTLIGHT = 0x0040, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
492 QT_MODULE_QT3SUPPORT = 0x0080, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
493 QT_MODULE_SVG = 0x0100, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
494 QT_MODULE_ACTIVEQT = 0x0200, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
495 QT_MODULE_GRAPHICSVIEW = 0x0400, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
496 QT_MODULE_SCRIPT = 0x0800, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
497 QT_MODULE_XMLPATTERNS = 0x1000, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
498 QT_MODULE_HELP = 0x2000, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
499 QT_MODULE_TEST = 0x4000, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
500 QT_MODULE_DBUS = 0x8000, |
1 | 501 |
502 /* Qt editions */ | |
503 | |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
504 QT_EDITION_CONSOLE = (QT_MODULE_CORE |
1 | 505 | QT_MODULE_NETWORK |
506 | QT_MODULE_SQL | |
507 | QT_MODULE_SCRIPT | |
508 | QT_MODULE_XML | |
509 | QT_MODULE_XMLPATTERNS | |
510 | QT_MODULE_TEST | |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
511 | QT_MODULE_DBUS), |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
512 QT_EDITION_DESKTOPLIGHT = (QT_MODULE_CORE |
1 | 513 | QT_MODULE_GUI |
514 | QT_MODULE_QT3SUPPORTLIGHT | |
515 | QT_MODULE_TEST | |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
516 | QT_MODULE_DBUS), |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
517 QT_EDITION_OPENSOURCE = (QT_MODULE_CORE |
1 | 518 | QT_MODULE_GUI |
519 | QT_MODULE_NETWORK | |
520 | QT_MODULE_OPENGL | |
521 | QT_MODULE_SQL | |
522 | QT_MODULE_XML | |
523 | QT_MODULE_XMLPATTERNS | |
524 | QT_MODULE_SCRIPT | |
525 | QT_MODULE_QT3SUPPORTLIGHT | |
526 | QT_MODULE_QT3SUPPORT | |
527 | QT_MODULE_SVG | |
528 | QT_MODULE_GRAPHICSVIEW | |
529 | QT_MODULE_HELP | |
530 | QT_MODULE_TEST | |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
531 | QT_MODULE_DBUS), |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
532 QT_EDITION_DESKTOP = (QT_EDITION_OPENSOURCE |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
533 | QT_MODULE_ACTIVEQT), |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
534 QT_EDITION_UNIVERSAL = QT_EDITION_DESKTOP, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
535 QT_EDITION_ACADEMIC = QT_EDITION_DESKTOP, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
536 QT_EDITION_EDUCATIONAL = QT_EDITION_DESKTOP, |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
537 QT_EDITION_EVALUATION = QT_EDITION_DESKTOP |
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
538 } |
1 | 539 |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
356
diff
changeset
|
540 /+ |
183 | 541 |
184
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
542 private |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
543 struct Align |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
544 { |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
545 ubyte a; |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
546 void* b; |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
547 } |
247 | 548 |
184
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
549 private |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
550 const PTR_ALIGN = Align.tupleof[1].alignof; |
247 | 551 |
184
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
552 private |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
553 template AlignPad(size_t base, size_t aligned) |
183 | 554 { |
184
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
555 static if( aligned == 0 ) |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
556 const AlignPad = base; |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
557 else |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
558 const AlignPad = ((base+PTR_ALIGN-1)/PTR_ALIGN)*PTR_ALIGN |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
559 + aligned; |
183 | 560 } |
247 | 561 |
184
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
562 private |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
563 template Max(size_t a, size_t b) |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
564 { |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
565 static if( a > b ) |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
566 const Max = a; |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
567 else |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
568 const Max = b; |
7d9db724ee1d
QObject is now non GC'ed, to better integrate to Qt memory management
eldar
parents:
183
diff
changeset
|
569 } |
254 | 570 +/ |
183 | 571 |
371
12f60887ed15
add elasticnodes example and necessary changes to the library.
Eldar Insafutdinov
parents:
357
diff
changeset
|
572 alias void DArray; |