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