1 /*
2  * DQt - D bindings for the Qt Toolkit
3  *
4  * GNU Lesser General Public License Usage
5  * This file may be used under the terms of the GNU Lesser
6  * General Public License version 3 as published by the Free Software
7  * Foundation and appearing in the file LICENSE.LGPL3 included in the
8  * packaging of this file. Please review the following information to
9  * ensure the GNU Lesser General Public License version 3 requirements
10  * will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
11  */
12 module qt.core.global;
13 extern(C++):
14 
15 version(OSX)
16     version = Apple;
17 version(iOS)
18     version = Apple;
19 version(TVOS)
20     version = Apple;
21 version(WatchOS)
22     version = Apple;
23 
24 import core.stdc.config;
25 import qt.config;
26 import qt.core.bytearray;
27 import qt.core.config;
28 import qt.core.string;
29 import qt.helpers;
30 
31 /+ #define Q_STATIC_ASSERT(Condition) static_assert(Condition) +/
32 /+ #define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message) +/
33 extern(D) alias Q_STATIC_ASSERT_X = function string(string Condition, string Message)
34 {
35     return mixin(interpolateMixin(q{static assert(bool($(Condition)), $(Message));}));
36 };
37 /+ #define Q_ASSERT(cond) assert(cond) +/
38 extern(D) alias Q_ASSERT = function string(string cond)
39 {
40     return mixin(interpolateMixin(q{assert($(cond))}));
41 };
42 /+ #define Q_ASSERT_X(cond, where, what) assert(cond) +/
43 extern(D) alias Q_ASSERT_X = function string(string cond, string where, string what)
44 {
45     return mixin(interpolateMixin(q{assert($(cond))}));
46 };
47 
48 /+ #ifdef __cplusplus
49 #endif
50 #ifndef __ASSEMBLER__
51 #endif +/
52 
53 /*
54    QT_VERSION is (major << 16) + (minor << 8) + patch.
55 */
56 /+ #define QT_VERSION      QT_VERSION_CHECK(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH) +/
57 enum QT_VERSION =      QT_VERSION_CHECK!(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH);
58 /*
59    can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
60 */
61 /+ #define QT_VERSION_CHECK(major, minor, patch) ((major<<16)|(minor<<8)|(patch)) +/
62 template QT_VERSION_CHECK(params...) if(params.length == 3)
63 {
64     enum major = params[0];
65     enum minor = params[1];
66     enum patch = params[2];
67     enum QT_VERSION_CHECK = ((major<<16)|(minor<<8)|(patch));
68 }
69 
70 /+ #ifdef QT_BOOTSTRAPPED
71 #else
72 #endif
73 
74 /*
75     The QT_CONFIG macro implements a safe compile time check for features of Qt.
76     Features can be in three states:
77         0 or undefined: This will lead to a compile error when testing for it
78         -1: The feature is not available
79         1: The feature is available
80 */
81 #define QT_CONFIG(feature) (1/QT_FEATURE_##feature == 1)
82 #define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.")
83 
84 /* These two macros makes it possible to turn the builtin line expander into a
85  * string literal. */
86 #define QT_STRINGIFY2(x) #x
87 #define QT_STRINGIFY(x) QT_STRINGIFY2(x)
88 
89 // This could go to the very beginning of this file, but we're using compiler
90 // detection, so it's here.
91 #if defined(__cplusplus) && (__cplusplus < 201703L)
92 #  ifdef Q_CC_MSVC
93 #    error "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler."
94 #  else
95 #    error "Qt requires a C++17 compiler"
96 #  endif
97 #endif // __cplusplus
98 
99 #if defined (__ELF__)
100 #  define Q_OF_ELF
101 #endif
102 #if defined (__MACH__) && defined (__APPLE__)
103 #  define Q_OF_MACH_O
104 #endif
105 
106 /*
107    Avoid "unused parameter" warnings
108 */
109 #define Q_UNUSED(x) (void)x;
110 
111 #if defined(__cplusplus)
112 // Don't use these in C++ mode, use static_assert directly.
113 // These are here only to keep old code compiling.
114 #  define Q_STATIC_ASSERT(Condition) static_assert(bool(Condition), #Condition)
115 #  define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
116 #elif defined(Q_COMPILER_STATIC_ASSERT)
117 // C11 mode - using the _S version in case <assert.h> doesn't do the right thing
118 #  define Q_STATIC_ASSERT(Condition) _Static_assert(!!(Condition), #Condition)
119 #  define Q_STATIC_ASSERT_X(Condition, Message) _Static_assert(!!(Condition), Message)
120 #else
121 // C89 & C99 version
122 #  define Q_STATIC_ASSERT_PRIVATE_JOIN(A, B) Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B)
123 #  define Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B) A ## B
124 #  ifdef __COUNTER__
125 #  define Q_STATIC_ASSERT(Condition) \
126     typedef char Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __COUNTER__) [(Condition) ? 1 : -1];
127 #  else
128 #  define Q_STATIC_ASSERT(Condition) \
129     typedef char Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __LINE__) [(Condition) ? 1 : -1];
130 #  endif /* __COUNTER__ */
131 #  define Q_STATIC_ASSERT_X(Condition, Message) Q_STATIC_ASSERT(Condition)
132 #endif
133 
134 #ifdef __cplusplus
135 
136 #if !defined(QT_NAMESPACE) || defined(Q_MOC_RUN) /* user namespace */
137 
138 # define QT_PREPEND_NAMESPACE(name) ::name
139 # define QT_USE_NAMESPACE
140 # define QT_BEGIN_NAMESPACE
141 # define QT_END_NAMESPACE
142 # define QT_BEGIN_INCLUDE_NAMESPACE
143 # define QT_END_INCLUDE_NAMESPACE
144 #ifndef QT_BEGIN_MOC_NAMESPACE
145 # define QT_BEGIN_MOC_NAMESPACE
146 #endif
147 #ifndef QT_END_MOC_NAMESPACE
148 # define QT_END_MOC_NAMESPACE
149 #endif
150 # define QT_FORWARD_DECLARE_CLASS(name) class name;
151 # define QT_FORWARD_DECLARE_STRUCT(name) struct name;
152 # define QT_MANGLE_NAMESPACE(name) name
153 
154 #else /* user namespace */
155 
156 # define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
157 # define QT_USE_NAMESPACE using namespace ::QT_NAMESPACE;
158 # define QT_BEGIN_NAMESPACE namespace QT_NAMESPACE {
159 # define QT_END_NAMESPACE }
160 # define QT_BEGIN_INCLUDE_NAMESPACE }
161 # define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE {
162 #ifndef QT_BEGIN_MOC_NAMESPACE
163 # define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE
164 #endif
165 #ifndef QT_END_MOC_NAMESPACE
166 # define QT_END_MOC_NAMESPACE
167 #endif
168 # define QT_FORWARD_DECLARE_CLASS(name) \
169     QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE \
170     using QT_PREPEND_NAMESPACE(name);
171 
172 # define QT_FORWARD_DECLARE_STRUCT(name) \
173     QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE \
174     using QT_PREPEND_NAMESPACE(name);
175 
176 # define QT_MANGLE_NAMESPACE0(x) x
177 # define QT_MANGLE_NAMESPACE1(a, b) a##_##b
178 # define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b)
179 # define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2( \
180         QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE))
181 
182 namespace QT_NAMESPACE {}
183 
184 # ifndef QT_BOOTSTRAPPED
185 # ifndef QT_NO_USING_NAMESPACE
186    /*
187     This expands to a "using QT_NAMESPACE" also in _header files_.
188     It is the only way the feature can be used without too much
189     pain, but if people _really_ do not want it they can add
190     DEFINES += QT_NO_USING_NAMESPACE to their .pro files.
191     */
192    QT_USE_NAMESPACE
193 # endif
194 # endif
195 
196 #endif /* user namespace */
197 
198 #else /* __cplusplus */
199 
200 # define QT_BEGIN_NAMESPACE
201 # define QT_END_NAMESPACE
202 # define QT_USE_NAMESPACE
203 # define QT_BEGIN_INCLUDE_NAMESPACE
204 # define QT_END_INCLUDE_NAMESPACE
205 
206 #endif /* __cplusplus */
207 
208 #if defined(Q_OS_DARWIN) && !defined(QT_LARGEFILE_SUPPORT)
209 #  define QT_LARGEFILE_SUPPORT 64
210 #endif
211 
212 #ifndef __ASSEMBLER__ +/
213 
214 /*
215    Size-dependent types (architechture-dependent byte order)
216 
217    Make sure to update QMetaType when changing these typedefs
218 */
219 
220 alias qint8 = byte;         /* 8 bit signed */
221 alias quint8 = ubyte;      /* 8 bit unsigned */
222 alias qint16 = short;              /* 16 bit signed */
223 alias quint16 = ushort;    /* 16 bit unsigned */
224 alias qint32 = int;                /* 32 bit signed */
225 alias quint32 = uint;      /* 32 bit unsigned */
226 // Unlike LL / ULL in C++, for historical reasons, we force the
227 // result to be of the requested type.
228 /+ #ifdef __cplusplus
229 #  define Q_INT64_C(c) static_cast<long long>(c ## LL)     /* signed 64 bit constant */
230 #  define Q_UINT64_C(c) static_cast<unsigned long long>(c ## ULL) /* unsigned 64 bit constant */
231 #else
232 #  define Q_INT64_C(c) ((long long)(c ## LL))               /* signed 64 bit constant */
233 #  define Q_UINT64_C(c) ((unsigned long long)(c ## ULL))    /* unsigned 64 bit constant */
234 #endif +/
235 alias qint64 = cpp_longlong;           /* 64 bit signed */
236 alias quint64 = cpp_ulonglong; /* 64 bit unsigned */
237 
238 alias qlonglong = qint64;
239 alias qulonglong = quint64;
240 
241 /+ #ifndef __cplusplus
242 // In C++ mode, we define below using QIntegerForSize template
243 Q_STATIC_ASSERT_X(sizeof(ptrdiff_t) == sizeof(size_t), "Weird ptrdiff_t and size_t definitions");
244 typedef ptrdiff_t qptrdiff;
245 typedef ptrdiff_t qsizetype;
246 typedef ptrdiff_t qintptr;
247 typedef size_t quintptr;
248 
249 #define PRIdQPTRDIFF "td"
250 #define PRIiQPTRDIFF "ti"
251 
252 #define PRIdQSIZETYPE "td"
253 #define PRIiQSIZETYPE "ti"
254 
255 #define PRIdQINTPTR "td"
256 #define PRIiQINTPTR "ti"
257 
258 #define PRIuQUINTPTR "zu"
259 #define PRIoQUINTPTR "zo"
260 #define PRIxQUINTPTR "zx"
261 #define PRIXQUINTPTR "zX"
262 #endif
263 
264 /*
265    Useful type definitions for Qt
266 */
267 
268 QT_BEGIN_INCLUDE_NAMESPACE +/
269 alias uchar = ubyte;
270 // self alias: alias ushort_ = ushort;
271 // self alias: alias uint_ = uint;
272 /+ QT_END_INCLUDE_NAMESPACE
273 
274 #if defined(QT_COORD_TYPE)
275 typedef QT_COORD_TYPE qreal;
276 #else +/
277 alias qreal = double;
278 /+ #endif
279 
280 #if defined(QT_NO_DEPRECATED)
281 #  undef QT_DEPRECATED
282 #  undef QT_DEPRECATED_X
283 #  undef QT_DEPRECATED_VARIABLE
284 #  undef QT_DEPRECATED_CONSTRUCTOR
285 #elif !defined(QT_NO_DEPRECATED_WARNINGS)
286 #  undef QT_DEPRECATED
287 #  define QT_DEPRECATED Q_DECL_DEPRECATED
288 #  undef QT_DEPRECATED_X
289 #  define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text)
290 #  undef QT_DEPRECATED_VARIABLE
291 #  define QT_DEPRECATED_VARIABLE Q_DECL_VARIABLE_DEPRECATED
292 #  undef QT_DEPRECATED_CONSTRUCTOR
293 #  define QT_DEPRECATED_CONSTRUCTOR Q_DECL_CONSTRUCTOR_DEPRECATED explicit
294 #else
295 #  undef QT_DEPRECATED
296 #  define QT_DEPRECATED
297 #  undef QT_DEPRECATED_X
298 #  define QT_DEPRECATED_X(text)
299 #  undef QT_DEPRECATED_VARIABLE
300 #  define QT_DEPRECATED_VARIABLE
301 #  undef QT_DEPRECATED_CONSTRUCTOR
302 #  define QT_DEPRECATED_CONSTRUCTOR
303 #  undef Q_DECL_ENUMERATOR_DEPRECATED
304 #  define Q_DECL_ENUMERATOR_DEPRECATED
305 #endif
306 
307 #ifndef QT_DEPRECATED_WARNINGS_SINCE
308 # ifdef QT_DISABLE_DEPRECATED_BEFORE
309 #  define QT_DEPRECATED_WARNINGS_SINCE QT_DISABLE_DEPRECATED_BEFORE
310 # else
311 #  define QT_DEPRECATED_WARNINGS_SINCE QT_VERSION
312 # endif
313 #endif
314 
315 #ifndef QT_DISABLE_DEPRECATED_BEFORE
316 #define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(5, 0, 0)
317 #endif
318 
319 /*
320     QT_DEPRECATED_SINCE(major, minor) evaluates as true if the Qt version is greater than
321     the deprecation point specified.
322 
323     Use it to specify from which version of Qt a function or class has been deprecated
324 
325     Example:
326         #if QT_DEPRECATED_SINCE(5,1)
327             QT_DEPRECATED void deprecatedFunction(); //function deprecated since Qt 5.1
328         #endif
329 
330 */
331 #ifdef QT_DEPRECATED
332 #define QT_DEPRECATED_SINCE(major, minor) (QT_VERSION_CHECK(major, minor, 0) > QT_DISABLE_DEPRECATED_BEFORE)
333 #else
334 #define QT_DEPRECATED_SINCE(major, minor) 0
335 #endif
336 
337 /*
338   QT_DEPRECATED_VERSION(major, minor) and QT_DEPRECATED_VERSION_X(major, minor, text)
339   outputs a deprecation warning if QT_DEPRECATED_WARNINGS_SINCE is equal or greater
340   than the version specified as major, minor. This makes it possible to deprecate a
341   function without annoying a user who needs to stick at a specified minimum version
342   and therefore can't use the new function.
343 */
344 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 12, 0)
345 # define QT_DEPRECATED_VERSION_X_5_12(text) QT_DEPRECATED_X(text)
346 # define QT_DEPRECATED_VERSION_5_12         QT_DEPRECATED
347 #else
348 # define QT_DEPRECATED_VERSION_X_5_12(text)
349 # define QT_DEPRECATED_VERSION_5_12
350 #endif
351 
352 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 13, 0)
353 # define QT_DEPRECATED_VERSION_X_5_13(text) QT_DEPRECATED_X(text)
354 # define QT_DEPRECATED_VERSION_5_13         QT_DEPRECATED
355 #else
356 # define QT_DEPRECATED_VERSION_X_5_13(text)
357 # define QT_DEPRECATED_VERSION_5_13
358 #endif
359 
360 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 14, 0)
361 # define QT_DEPRECATED_VERSION_X_5_14(text) QT_DEPRECATED_X(text)
362 # define QT_DEPRECATED_VERSION_5_14         QT_DEPRECATED
363 #else
364 # define QT_DEPRECATED_VERSION_X_5_14(text)
365 # define QT_DEPRECATED_VERSION_5_14
366 #endif
367 
368 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(5, 15, 0)
369 # define QT_DEPRECATED_VERSION_X_5_15(text) QT_DEPRECATED_X(text)
370 # define QT_DEPRECATED_VERSION_5_15         QT_DEPRECATED
371 #else
372 # define QT_DEPRECATED_VERSION_X_5_15(text)
373 # define QT_DEPRECATED_VERSION_5_15
374 #endif
375 
376 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(6, 0, 0)
377 # define QT_DEPRECATED_VERSION_X_6_0(text) QT_DEPRECATED_X(text)
378 # define QT_DEPRECATED_VERSION_6_0         QT_DEPRECATED
379 #else
380 # define QT_DEPRECATED_VERSION_X_6_0(text)
381 # define QT_DEPRECATED_VERSION_6_0
382 #endif
383 
384 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(6, 1, 0)
385 # define QT_DEPRECATED_VERSION_X_6_1(text) QT_DEPRECATED_X(text)
386 # define QT_DEPRECATED_VERSION_6_1         QT_DEPRECATED
387 #else
388 # define QT_DEPRECATED_VERSION_X_6_1(text)
389 # define QT_DEPRECATED_VERSION_6_1
390 #endif
391 
392 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(6, 2, 0)
393 # define QT_DEPRECATED_VERSION_X_6_2(text) QT_DEPRECATED_X(text)
394 # define QT_DEPRECATED_VERSION_6_2         QT_DEPRECATED
395 #else
396 # define QT_DEPRECATED_VERSION_X_6_2(text)
397 # define QT_DEPRECATED_VERSION_6_2
398 #endif
399 
400 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(6, 3, 0)
401 # define QT_DEPRECATED_VERSION_X_6_3(text) QT_DEPRECATED_X(text)
402 # define QT_DEPRECATED_VERSION_6_3         QT_DEPRECATED
403 #else
404 # define QT_DEPRECATED_VERSION_X_6_3(text)
405 # define QT_DEPRECATED_VERSION_6_3
406 #endif
407 
408 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(6, 4, 0)
409 # define QT_DEPRECATED_VERSION_X_6_4(text) QT_DEPRECATED_X(text)
410 # define QT_DEPRECATED_VERSION_6_4         QT_DEPRECATED
411 #else
412 # define QT_DEPRECATED_VERSION_X_6_4(text)
413 # define QT_DEPRECATED_VERSION_6_4
414 #endif
415 
416 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(6, 5, 0)
417 # define QT_DEPRECATED_VERSION_X_6_5(text) QT_DEPRECATED_X(text)
418 # define QT_DEPRECATED_VERSION_6_5         QT_DEPRECATED
419 #else
420 # define QT_DEPRECATED_VERSION_X_6_5(text)
421 # define QT_DEPRECATED_VERSION_6_5
422 #endif
423 
424 #if QT_DEPRECATED_WARNINGS_SINCE >= QT_VERSION_CHECK(6, 6, 0)
425 # define QT_DEPRECATED_VERSION_X_6_6(text) QT_DEPRECATED_X(text)
426 # define QT_DEPRECATED_VERSION_6_6         QT_DEPRECATED
427 #else
428 # define QT_DEPRECATED_VERSION_X_6_6(text)
429 # define QT_DEPRECATED_VERSION_6_6
430 #endif
431 
432 #define QT_DEPRECATED_VERSION_X_5(minor, text)      QT_DEPRECATED_VERSION_X_5_##minor(text)
433 #define QT_DEPRECATED_VERSION_X(major, minor, text) QT_DEPRECATED_VERSION_X_##major##_##minor(text)
434 
435 #define QT_DEPRECATED_VERSION_5(minor)      QT_DEPRECATED_VERSION_5_##minor
436 #define QT_DEPRECATED_VERSION(major, minor) QT_DEPRECATED_VERSION_##major##_##minor
437 
438 #ifdef __cplusplus +/
439 // A tag to help mark stuff deprecated (cf. QStringViewLiteral)
440 extern(C++, "QtPrivate") {
441 enum /+ class +/ Deprecated_t {init}
442 extern(D) immutable Deprecated_t Deprecated = Deprecated_t();
443 }
444 /+ #endif
445 
446 /*
447    The Qt modules' export macros.
448    The options are:
449     - defined(QT_STATIC): Qt was built or is being built in static mode
450     - defined(QT_SHARED): Qt was built or is being built in shared/dynamic mode
451    If neither was defined, then QT_SHARED is implied. If Qt was compiled in static
452    mode, QT_STATIC is defined in qconfig.h. In shared mode, QT_STATIC is implied
453    for the bootstrapped tools.
454 */
455 
456 #ifdef QT_BOOTSTRAPPED
457 #  ifdef QT_SHARED
458 #    error "QT_SHARED and QT_BOOTSTRAPPED together don't make sense. Please fix the build"
459 #  elif !defined(QT_STATIC)
460 #    define QT_STATIC
461 #  endif
462 #endif
463 
464 #if defined(QT_SHARED) || !defined(QT_STATIC)
465 #  ifdef QT_STATIC
466 #    error "Both QT_SHARED and QT_STATIC defined, please make up your mind"
467 #  endif
468 #  ifndef QT_SHARED
469 #    define QT_SHARED
470 #  endif
471 #  if defined(QT_BUILD_CORE_LIB)
472 #    define Q_CORE_EXPORT Q_DECL_EXPORT
473 #  else
474 #    define Q_CORE_EXPORT Q_DECL_IMPORT
475 #  endif
476 #else
477 #  define Q_CORE_EXPORT
478 #endif
479 
480 /*
481    Some classes do not permit copies to be made of an object. These
482    classes contains a private copy constructor and assignment
483    operator to disable copying (the compiler gives an error message).
484 */
485 #define Q_DISABLE_COPY(Class) \
486     Class(const Class &) = delete;\
487     Class &operator=(const Class &) = delete;
488 
489 #define Q_DISABLE_COPY_MOVE(Class) \
490     Q_DISABLE_COPY(Class) \
491     Class(Class &&) = delete; \
492     Class &operator=(Class &&) = delete;
493 
494 /*
495     Implementing a move assignment operator using an established
496     technique (move-and-swap, pure swap) is just boilerplate.
497     Here's a couple of *private* macros for convenience.
498 
499     To know which one to use:
500 
501     * if you don't have a move constructor (*) => use pure swap;
502     * if you have a move constructor, then
503       * if your class holds just memory (no file handles, no user-defined
504         datatypes, etc.) => use pure swap;
505       * use move and swap.
506 
507     The preference should always go for the move-and-swap one, as it
508     will deterministically destroy the data previously held in *this,
509     and not "dump" it in the moved-from object (which may then be alive
510     for longer).
511 
512     The requirement for either macro is the presence of a member swap(),
513     which any value class that defines its own special member functions
514     should have anyhow.
515 
516     (*) Many value classes in Qt do not have move constructors; mostly,
517     the implicitly shared classes using QSharedDataPointer and friends.
518     The reason is mostly historical: those classes require either an
519     out-of-line move constructor, which we could not provide before we
520     made C++11 mandatory (and that we don't like anyhow), or
521     an out-of-line dtor for the Q(E)DSP<Private> member (cf. QPixmap).
522 
523     If you can however add a move constructor to a class lacking it,
524     consider doing so, then reevaluate which macro to choose.
525 */
526 #define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(Class) \
527     Class &operator=(Class &&other) noexcept { \
528         Class moved(std::move(other)); \
529         swap(moved); \
530         return *this; \
531     }
532 
533 #define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Class) \
534     Class &operator=(Class &&other) noexcept { \
535         swap(other); \
536         return *this; \
537     }
538 
539 /*
540    No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols
541    for Qt's internal unit tests. If you want slower loading times and more
542    symbols that can vanish from version to version, feel free to define QT_BUILD_INTERNAL.
543 */
544 #if defined(QT_BUILD_INTERNAL) && defined(QT_BUILDING_QT) && defined(QT_SHARED)
545 #    define Q_AUTOTEST_EXPORT Q_DECL_EXPORT
546 #elif defined(QT_BUILD_INTERNAL) && defined(QT_SHARED)
547 #    define Q_AUTOTEST_EXPORT Q_DECL_IMPORT
548 #else
549 #    define Q_AUTOTEST_EXPORT
550 #endif
551 
552 #define Q_INIT_RESOURCE(name) \
553     do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) ();       \
554         QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (false)
555 #define Q_CLEANUP_RESOURCE(name) \
556     do { extern int QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) ();    \
557         QT_MANGLE_NAMESPACE(qCleanupResources_ ## name) (); } while (false)
558 
559 /*
560  * If we're compiling C++ code:
561  *  - and this is a non-namespace build, declare qVersion as extern "C"
562  *  - and this is a namespace build, declare it as a regular function
563  *    (we're already inside QT_BEGIN_NAMESPACE / QT_END_NAMESPACE)
564  * If we're compiling C code, simply declare the function. If Qt was compiled
565  * in a namespace, qVersion isn't callable anyway.
566  */
567 #if !defined(QT_NAMESPACE) && defined(__cplusplus) && !defined(Q_QDOC) +/
568 extern(C)
569 /+ #endif +/
570 /+ Q_CORE_EXPORT +/ /+ Q_DECL_CONST_FUNCTION +/ const(char)* qVersion()/+ /+ Q_DECL_NOEXCEPT +/noexcept+/;
571 
572 /+ #if defined(__cplusplus) +/
573 
574 /+ #ifndef Q_CONSTRUCTOR_FUNCTION
575 # define Q_CONSTRUCTOR_FUNCTION0(AFUNC) \
576     namespace { \
577     static const struct AFUNC ## _ctor_class_ { \
578         inline AFUNC ## _ctor_class_() { AFUNC(); } \
579     } AFUNC ## _ctor_instance_; \
580     }
581 
582 # define Q_CONSTRUCTOR_FUNCTION(AFUNC) Q_CONSTRUCTOR_FUNCTION0(AFUNC)
583 #endif
584 
585 #ifndef Q_DESTRUCTOR_FUNCTION
586 # define Q_DESTRUCTOR_FUNCTION0(AFUNC) \
587     namespace { \
588     static const struct AFUNC ## _dtor_class_ { \
589         inline AFUNC ## _dtor_class_() { } \
590         inline ~ AFUNC ## _dtor_class_() { AFUNC(); } \
591     } AFUNC ## _dtor_instance_; \
592     }
593 # define Q_DESTRUCTOR_FUNCTION(AFUNC) Q_DESTRUCTOR_FUNCTION0(AFUNC)
594 #endif +/
595 
596 /*
597   quintptr and qptrdiff is guaranteed to be the same size as a pointer, i.e.
598 
599       sizeof(void *) == sizeof(quintptr)
600       && sizeof(void *) == sizeof(qptrdiff)
601 
602   size_t and qsizetype are not guaranteed to be the same size as a pointer, but
603   they usually are. We actually check for that in qglobal.cpp.
604 */
605 template QIntegerForSize(int size) if(size == 1) { alias Unsigned = ubyte; alias Signed = byte; }
606 template QIntegerForSize(int size) if(size == 2) { alias Unsigned = ushort; alias Signed = short; }
607 template QIntegerForSize(int size) if(size == 4 && size != cpp_longlong.sizeof) { alias Unsigned = uint; alias Signed = int; }
608 template QIntegerForSize(int size) if(size == 8 && size != cpp_longlong.sizeof) { alias Unsigned = ulong; alias Signed = long; }
609 template QIntegerForSize(int size) if(size == cpp_longlong.sizeof) { alias Unsigned = cpp_ulonglong; alias Signed = cpp_longlong; }
610 /+ #if defined(Q_CC_GNU) && defined(__SIZEOF_INT128__)
611 template <>    struct QIntegerForSize<16> { __extension__ typedef unsigned __int128 Unsigned; __extension__ typedef __int128 Signed; };
612 #endif +/
613 alias QIntegerForSizeof(T) = QIntegerForSize!(T.sizeof);
614 /+ typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Signed qregisterint;
615 typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Unsigned qregisteruint; +/
616 alias quintptr = QIntegerForSizeof!(void*).Unsigned;
617 alias qptrdiff = QIntegerForSizeof!(void*).Signed;
618 alias qintptr = qptrdiff;
619 alias qsizetype = QIntegerForSizeof!(/+ std:: +/size_t).Signed;
620 
621 // These custom definitions are necessary as we're not defining our
622 // datatypes in terms of the language ones, but in terms of integer
623 // types that have the sime size. For instance, on a 32-bit platform,
624 // qptrdiff is int, while ptrdiff_t may be aliased to long; therefore
625 // using %td to print a qptrdiff would be wrong (and raise -Wformat
626 // warnings), although both int and long have same bit size on that
627 // platform.
628 //
629 // We know that sizeof(size_t) == sizeof(void *) == sizeof(qptrdiff).
630 /+ #if SIZE_MAX == 4294967295ULL
631 #define PRIuQUINTPTR "u"
632 #define PRIoQUINTPTR "o"
633 #define PRIxQUINTPTR "x"
634 #define PRIXQUINTPTR "X"
635 
636 #define PRIdQPTRDIFF "d"
637 #define PRIiQPTRDIFF "i"
638 
639 #define PRIdQINTPTR "d"
640 #define PRIiQINTPTR "i"
641 
642 #define PRIdQSIZETYPE "d"
643 #define PRIiQSIZETYPE "i"
644 #elif SIZE_MAX == 18446744073709551615ULL
645 #define PRIuQUINTPTR "llu"
646 #define PRIoQUINTPTR "llo"
647 #define PRIxQUINTPTR "llx"
648 #define PRIXQUINTPTR "llX"
649 
650 #define PRIdQPTRDIFF "lld"
651 #define PRIiQPTRDIFF "lli"
652 
653 #define PRIdQINTPTR "lld"
654 #define PRIiQINTPTR "lli"
655 
656 #define PRIdQSIZETYPE "lld"
657 #define PRIiQSIZETYPE "lli"
658 #else
659 #error Unsupported platform (unknown value for SIZE_MAX)
660 #endif
661 
662 /* moc compats (signals/slots) */
663 #ifndef QT_MOC_COMPAT
664 #  define QT_MOC_COMPAT
665 #else
666 #  undef QT_MOC_COMPAT
667 #  define QT_MOC_COMPAT
668 #endif
669 
670 #ifdef QT_ASCII_CAST_WARNINGS
671 #  define QT_ASCII_CAST_WARN Q_DECL_DEPRECATED_X("Use fromUtf8, QStringLiteral, or QLatin1String")
672 #else
673 #  define QT_ASCII_CAST_WARN
674 #endif
675 
676 #ifdef Q_PROCESSOR_X86_32
677 #  if defined(Q_CC_GNU)
678 #    define QT_FASTCALL __attribute__((regparm(3)))
679 #  elif defined(Q_CC_MSVC)
680 #    define QT_FASTCALL __fastcall
681 #  else
682 #     define QT_FASTCALL
683 #  endif
684 #else
685 #  define QT_FASTCALL
686 #endif
687 
688 // enable gcc warnings for printf-style functions
689 #if defined(Q_CC_GNU) && !defined(__INSURE__)
690 #  if defined(Q_CC_MINGW) && !defined(Q_CC_CLANG)
691 #    define Q_ATTRIBUTE_FORMAT_PRINTF(A, B) \
692          __attribute__((format(gnu_printf, (A), (B))))
693 #  else
694 #    define Q_ATTRIBUTE_FORMAT_PRINTF(A, B) \
695          __attribute__((format(printf, (A), (B))))
696 #  endif
697 #else
698 #  define Q_ATTRIBUTE_FORMAT_PRINTF(A, B)
699 #endif
700 
701 #ifdef Q_CC_MSVC
702 #  define Q_NEVER_INLINE __declspec(noinline)
703 #  define Q_ALWAYS_INLINE __forceinline
704 #elif defined(Q_CC_GNU)
705 #  define Q_NEVER_INLINE __attribute__((noinline))
706 #  define Q_ALWAYS_INLINE inline __attribute__((always_inline))
707 #else
708 #  define Q_NEVER_INLINE
709 #  define Q_ALWAYS_INLINE inline
710 #endif
711 
712 //defines the type for the WNDPROC on windows
713 //the alignment needs to be forced for sse2 to not crash with mingw
714 #if defined(Q_OS_WIN)
715 #  if defined(Q_CC_MINGW) && defined(Q_PROCESSOR_X86_32)
716 #    define QT_ENSURE_STACK_ALIGNED_FOR_SSE __attribute__ ((force_align_arg_pointer))
717 #  else
718 #    define QT_ENSURE_STACK_ALIGNED_FOR_SSE
719 #  endif
720 #  define QT_WIN_CALLBACK CALLBACK QT_ENSURE_STACK_ALIGNED_FOR_SSE
721 #endif +/
722 
723 /*
724    Utility macros and inline functions
725 */
726 
727 pragma(inline, true) T qAbs(T)(ref const(T) t) { return t >= 0 ? t : -t; }
728 pragma(inline, true) T qAbs(T)(const(T) t) { return t >= 0 ? t : -t; }
729 
730 // gcc < 10 doesn't have __has_builtin
731 static if(defined!"Q_PROCESSOR_ARM_64" || defined!"_M_ARM64" || defined!"__ARM64__" || versionIsSet!("AArch64"))
732 {
733 // ARM64 has a single instruction that can do C++ rounding with conversion to integer.
734 // Note current clang versions have non-constexpr __builtin_round, ### allow clang this path when they fix it.
735 pragma(inline, true) int qRound(double d)
736 { return int(__builtin_round(d)); }
737 pragma(inline, true) int qRound(float f)
738 { return int(__builtin_roundf(f)); }
739 pragma(inline, true) qint64 qRound64(double d)
740 { return qint64(__builtin_round(d)); }
741 pragma(inline, true) qint64 qRound64(float f)
742 { return qint64(__builtin_roundf(f)); }
743 }
744 static if(!defined!"Q_PROCESSOR_ARM_64" && !defined!"_M_ARM64" && !defined!"__ARM64__" && defined!"__SSE2__" && !versionIsSet!("AArch64"))
745 {
746 // SSE has binary operations directly on floating point making copysign fast
747 pragma(inline, true) int qRound(double d)
748 { return cast(int)(d + __builtin_copysign(0.5, d)); }
749 pragma(inline, true) int qRound(float f)
750 { return cast(int)(f + __builtin_copysignf(0.5f, f)); }
751 pragma(inline, true) qint64 qRound64(double d)
752 { return cast(qint64)(d + __builtin_copysign(0.5, d)); }
753 pragma(inline, true) qint64 qRound64(float f)
754 { return cast(qint64)(f + __builtin_copysignf(0.5f, f)); }
755 }
756 static if(!defined!"Q_PROCESSOR_ARM_64" && !defined!"_M_ARM64" && !defined!"__ARM64__" && !defined!"__SSE2__" && !versionIsSet!("AArch64"))
757 {
758 pragma(inline, true) int qRound(double d)
759 { return d >= 0.0 ? cast(int)(d + 0.5) : cast(int)(d - 0.5); }
760 pragma(inline, true) int qRound(float d)
761 { return d >= 0.0f ? cast(int)(d + 0.5f) : cast(int)(d - 0.5f); }
762 
763 pragma(inline, true) qint64 qRound64(double d)
764 { return d >= 0.0 ? cast(qint64)(d + 0.5) : cast(qint64)(d - 0.5); }
765 pragma(inline, true) qint64 qRound64(float d)
766 { return d >= 0.0f ? cast(qint64)(d + 0.5f) : cast(qint64)(d - 0.5f); }
767 }
768 
769 extern(C++, "QTypeTraits") {
770 
771 extern(C++, "detail") {
772 struct Promoted(T, U,
773          
774 )
775 {
776     alias type = /+ decltype(T() + U()) +/T;
777 }
778 }
779 
780 alias Promoted(T, U) = /+ detail:: +/Promoted!(T, U).type;
781 
782 }
783 
784 pragma(inline, true) ref const(T) qMin(T)(ref const(T) a, ref const(T) b) { return (a < b) ? a : b; }
785 pragma(inline, true) const(T)  qMin(T)(const(T) a, const(T) b) { return (a < b) ? a : b; }
786 pragma(inline, true) ref const(T) qMax(T)(ref const(T) a, ref const(T) b) { return (a < b) ? b : a; }
787 pragma(inline, true) const(T)  qMax(T)(const(T) a, const(T) b) { return (a < b) ? b : a; }
788 pragma(inline, true) ref const(T) qBound(T)(ref const(T) min, ref const(T) val, ref const(T) max)
789 { return qMax(min, qMin(max, val)); }
790 pragma(inline, true) const(T) qBound(T)(const(T) min, const(T) val, const(T) max)
791 { return qMax(min, qMin(max, val)); }
792 /+pragma(inline, true) /+ QTypeTraits:: +/Promoted!(T, U) qMin(T, U)(ref const(T) a, ref const(U) b)
793 {
794     alias P = /+ QTypeTraits:: +/Promoted!(T, U);
795     P _a = a;
796     P _b = b;
797     return (_a < _b) ? _a : _b;
798 }
799 pragma(inline, true) /+ QTypeTraits:: +/Promoted!(T, U) qMax(T, U)(ref const(T) a, ref const(U) b)
800 {
801     alias P = /+ QTypeTraits:: +/Promoted!(T, U);
802     P _a = a;
803     P _b = b;
804     return (_a < _b) ? _b : _a;
805 }
806 pragma(inline, true) /+ QTypeTraits:: +/Promoted!(T, U) qBound(T, U)(ref const(T) min, ref const(U) val, ref const(T) max)
807 { return qMax(min, qMin(max, val)); }
808 pragma(inline, true) /+ QTypeTraits:: +/Promoted!(T, U) qBound(T, U)(ref const(T) min, ref const(T) val, ref const(U) max)
809 { return qMax(min, qMin(max, val)); }
810 pragma(inline, true) /+ QTypeTraits:: +/Promoted!(T, U) qBound(T, U)(ref const(U) min, ref const(T) val, ref const(T) max)
811 { return qMax(min, qMin(max, val)); }+/
812 
813 /+ #ifndef Q_FORWARD_DECLARE_OBJC_CLASS
814 #  ifdef __OBJC__
815 #    define Q_FORWARD_DECLARE_OBJC_CLASS(classname) @class classname
816 #  else
817 #    define Q_FORWARD_DECLARE_OBJC_CLASS(classname) class classname
818 #  endif
819 #endif
820 #ifndef Q_FORWARD_DECLARE_CF_TYPE
821 #  define Q_FORWARD_DECLARE_CF_TYPE(type) typedef const struct __ ## type * type ## Ref
822 #endif
823 #ifndef Q_FORWARD_DECLARE_MUTABLE_CF_TYPE
824 #  define Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type) typedef struct __ ## type * type ## Ref
825 #endif
826 #ifndef Q_FORWARD_DECLARE_CG_TYPE
827 #define Q_FORWARD_DECLARE_CG_TYPE(type) typedef const struct type *type ## Ref;
828 #endif
829 #ifndef Q_FORWARD_DECLARE_MUTABLE_CG_TYPE
830 #define Q_FORWARD_DECLARE_MUTABLE_CG_TYPE(type) typedef struct type *type ## Ref;
831 #endif +/
832 
833 version(Apple)
834 {
835 /+ #  define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) \
836     ((defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && macos != __MAC_NA && __MAC_OS_X_VERSION_MAX_ALLOWED >= macos) || \
837      (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MAX_ALLOWED >= ios) || \
838      (defined(__TV_OS_VERSION_MAX_ALLOWED) && tvos != __TVOS_NA && __TV_OS_VERSION_MAX_ALLOWED >= tvos) || \
839      (defined(__WATCH_OS_VERSION_MAX_ALLOWED) && watchos != __WATCHOS_NA && __WATCH_OS_VERSION_MAX_ALLOWED >= watchos))
840 
841 #  define QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, ios, tvos, watchos) \
842     ((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && macos != __MAC_NA && __MAC_OS_X_VERSION_MIN_REQUIRED < macos) || \
843      (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && ios != __IPHONE_NA && __IPHONE_OS_VERSION_MIN_REQUIRED < ios) || \
844      (defined(__TV_OS_VERSION_MIN_REQUIRED) && tvos != __TVOS_NA && __TV_OS_VERSION_MIN_REQUIRED < tvos) || \
845      (defined(__WATCH_OS_VERSION_MIN_REQUIRED) && watchos != __WATCHOS_NA && __WATCH_OS_VERSION_MIN_REQUIRED < watchos))
846 
847 #  define QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios) \
848       QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, __TVOS_NA, __WATCHOS_NA)
849 #  define QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos) \
850       QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, __IPHONE_NA, __TVOS_NA, __WATCHOS_NA)
851 #  define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) \
852       QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, ios, __TVOS_NA, __WATCHOS_NA)
853 #  define QT_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(tvos) \
854       QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, tvos, __WATCHOS_NA)
855 #  define QT_WATCHOS_PLATFORM_SDK_EQUAL_OR_ABOVE(watchos) \
856       QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, __TVOS_NA, watchos)
857 
858 #  define QT_MACOS_IOS_DEPLOYMENT_TARGET_BELOW(macos, ios) \
859       QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, ios, __TVOS_NA, __WATCHOS_NA)
860 #  define QT_MACOS_DEPLOYMENT_TARGET_BELOW(macos) \
861       QT_DARWIN_DEPLOYMENT_TARGET_BELOW(macos, __IPHONE_NA, __TVOS_NA, __WATCHOS_NA)
862 #  define QT_IOS_DEPLOYMENT_TARGET_BELOW(ios) \
863       QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, ios, __TVOS_NA, __WATCHOS_NA)
864 #  define QT_TVOS_DEPLOYMENT_TARGET_BELOW(tvos) \
865       QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_NA, tvos, __WATCHOS_NA)
866 #  define QT_WATCHOS_DEPLOYMENT_TARGET_BELOW(watchos) \
867       QT_DARWIN_DEPLOYMENT_TARGET_BELOW(__MAC_NA, __IPHONE_NA, __TVOS_NA, watchos)
868 
869 // Compatibility synonyms, do not use
870 #  define QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, ios) QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, ios)
871 #  define QT_MAC_DEPLOYMENT_TARGET_BELOW(osx, ios) QT_MACOS_IOS_DEPLOYMENT_TARGET_BELOW(osx, ios)
872 #  define QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(osx) QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(osx)
873 #  define QT_OSX_DEPLOYMENT_TARGET_BELOW(osx) QT_MACOS_DEPLOYMENT_TARGET_BELOW(osx) +/
874 
875 // Implemented in qcore_mac_objc.mm
876 extern(C++, class) struct /+ Q_CORE_EXPORT +/ QMacAutoReleasePool
877 {
878 public:
879     @disable this();
880     pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this))))
881     ref typeof(this) rawConstructor();
882     static typeof(this) create()
883     {
884         typeof(this) r = typeof(this).init;
885         r.rawConstructor();
886         return r;
887     }
888 
889     ~this();
890 private:
891     /+ Q_DISABLE_COPY(QMacAutoReleasePool) +/
892 @disable this(this);
893 /+this(ref const(QMacAutoReleasePool));+//+ref QMacAutoReleasePool operator =(ref const(QMacAutoReleasePool));+/    void* pool;
894     mixin(CREATE_CONVENIENCE_WRAPPERS);
895 }
896 
897 }
898 version(OSX){}else
899 version(iOS){}else
900 version(TVOS){}else
901 version(WatchOS){}else
902 {
903 
904 /+ #define QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios, tvos, watchos) (0)
905 #define QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos, ios) (0)
906 #define QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(macos) (0)
907 #define QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(ios) (0)
908 #define QT_TVOS_PLATFORM_SDK_EQUAL_OR_ABOVE(tvos) (0)
909 #define QT_WATCHOS_PLATFORM_SDK_EQUAL_OR_ABOVE(watchos) (0)
910 
911 #define QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(osx, ios) (0)
912 #define QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(osx) (0) +/
913 
914 }
915 
916 /*
917    Data stream functions are provided by many classes (defined in qdatastream.h)
918 */
919 
920 pragma(inline, true) void qt_noop() {}
921 
922 /* These wrap try/catch so we can switch off exceptions later.
923 
924    Beware - do not use more than one QT_CATCH per QT_TRY, and do not use
925    the exception instance in the catch block.
926    If you can't live with those constraints, don't use these macros.
927    Use the QT_NO_EXCEPTIONS macro to protect your code instead.
928 */
929 
930 /+ #if !defined(QT_NO_EXCEPTIONS)
931 #  if !defined(Q_MOC_RUN)
932 #    if (defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !__has_feature(cxx_exceptions)) || \
933         (defined(Q_CC_GNU) && !defined(__EXCEPTIONS))
934 #      define QT_NO_EXCEPTIONS
935 #    endif
936 #  elif defined(QT_BOOTSTRAPPED)
937 #    define QT_NO_EXCEPTIONS
938 #  endif
939 #endif +/
940 
941 /+ Q_NORETURN +/ /+ Q_DECL_COLD_FUNCTION +/ /+ Q_CORE_EXPORT +/ void qTerminate()/+ noexcept+/;
942 /+ #ifdef QT_NO_EXCEPTIONS
943 #  define QT_TRY if (true)
944 #  define QT_CATCH(A) else
945 #  define QT_THROW(A) qt_noop()
946 #  define QT_RETHROW qt_noop()
947 #  define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
948 #else +/
949 /+ #  define QT_TRY try
950 #  define QT_CATCH(A) catch (A)
951 #  define QT_THROW(A) throw A +/
952 /+ #  define QT_RETHROW throw +/
953 enum QT_RETHROW = q{throw};
954 /+ #  ifdef Q_COMPILER_NOEXCEPT
955 #    define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
956 #  else
957 #    define QT_TERMINATE_ON_EXCEPTION(expr) do { try { expr; } catch (...) { qTerminate(); } } while (false)
958 #  endif +/
959 /+ #endif +/
960 
961 /+ Q_CORE_EXPORT +/ /+ Q_DECL_CONST_FUNCTION +/ bool qSharedBuild()/+ noexcept+/;
962 
963 /+ #ifndef Q_OUTOFLINE_TEMPLATE
964 #  define Q_OUTOFLINE_TEMPLATE
965 #endif
966 #ifndef Q_INLINE_TEMPLATE
967 #  define Q_INLINE_TEMPLATE inline
968 #endif
969 
970 /*
971    Debugging and error handling
972 */
973 
974 #if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG)
975 #  define QT_DEBUG
976 #endif
977 
978 // QtPrivate::asString defined in qstring.h
979 #ifndef qPrintable
980 #  define qPrintable(string) QtPrivate::asString(string).toLocal8Bit().constData()
981 #endif
982 
983 #ifndef qUtf8Printable
984 #  define qUtf8Printable(string) QtPrivate::asString(string).toUtf8().constData()
985 #endif
986 
987 /*
988     Wrap QString::utf16() with enough casts to allow passing it
989     to QString::asprintf("%ls") without warnings.
990 */
991 #ifndef qUtf16Printable
992 #  define qUtf16Printable(string) \
993     static_cast<const wchar_t*>(static_cast<const void*>(QString(string).utf16()))
994 #endif +/
995 
996 /+ Q_DECL_COLD_FUNCTION +/
997 /+ Q_CORE_EXPORT +/ QString qt_error_string(int errorCode = -1);
998 
999 /+ #ifndef Q_CC_MSVC +/
1000 /+ Q_NORETURN +/
1001 /+ #endif
1002 Q_DECL_COLD_FUNCTION +/
1003 /+ Q_CORE_EXPORT +/ void qt_assert(const(char)* assertion, const(char)* file, int line)/+ noexcept+/;
1004 
1005 /+ #if !defined(Q_ASSERT)
1006 #  if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
1007 #    define Q_ASSERT(cond) static_cast<void>(false && (cond))
1008 #  else
1009 #    define Q_ASSERT(cond) ((cond) ? static_cast<void>(0) : qt_assert(#cond, __FILE__, __LINE__))
1010 #  endif
1011 #endif
1012 
1013 #ifndef Q_CC_MSVC +/
1014 /+ Q_NORETURN +/
1015 /+ #endif
1016 Q_DECL_COLD_FUNCTION +/
1017 /+ Q_CORE_EXPORT +/ void qt_assert_x(const(char)* where, const(char)* what, const(char)* file, int line)/+ noexcept+/;
1018 
1019 /+ #if !defined(Q_ASSERT_X)
1020 #  if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
1021 #    define Q_ASSERT_X(cond, where, what) static_cast<void>(false && (cond))
1022 #  else
1023 #    define Q_ASSERT_X(cond, where, what) ((cond) ? static_cast<void>(0) : qt_assert_x(where, what, __FILE__, __LINE__))
1024 #  endif
1025 #endif +/
1026 
1027 /+ Q_NORETURN +/ /+ Q_CORE_EXPORT +/ void qt_check_pointer(const(char)* , int)/+ noexcept+/;
1028 /+ Q_NORETURN +/ /+ Q_DECL_COLD_FUNCTION +/
1029 /+ Q_CORE_EXPORT +/ void qBadAlloc();
1030 
1031 /+ #ifdef QT_NO_EXCEPTIONS
1032 #  if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
1033 #    define Q_CHECK_PTR(p) qt_noop()
1034 #  else
1035 #    define Q_CHECK_PTR(p) do {if (!(p)) qt_check_pointer(__FILE__,__LINE__);} while (false)
1036 #  endif
1037 #else +/
1038 /+ #  define Q_CHECK_PTR(p) do { if (!(p)) qBadAlloc(); } while (false) +/
1039 extern(D) alias Q_CHECK_PTR = function string(string p)
1040 {
1041     return mixin(interpolateMixin(q{do { if (!($(p))) qBadAlloc(); } while (false);}));
1042 };
1043 /+ #endif +/
1044 
1045 pragma(inline, true) T* q_check_ptr(T)(T* p) { mixin(Q_CHECK_PTR(q{p})); return p; }
1046 
1047 alias QFunctionPointer = ExternCPPFunc!(void function());
1048 
1049 /+ #if !defined(Q_UNIMPLEMENTED)
1050 #  define Q_UNIMPLEMENTED() qWarning("Unimplemented code.")
1051 #endif +/
1052 
1053 /+ [[nodiscard]] +/ bool qFuzzyCompare(double p1, double p2)
1054 {
1055     return (qAbs(p1 - p2) * 1000000000000. <= qMin(qAbs(p1), qAbs(p2)));
1056 }
1057 
1058 /+ [[nodiscard]] +/ bool qFuzzyCompare(float p1, float p2)
1059 {
1060     return (qAbs(p1 - p2) * 100000.0f <= qMin(qAbs(p1), qAbs(p2)));
1061 }
1062 
1063 /+ [[nodiscard]] +/ bool qFuzzyIsNull(double d)
1064 {
1065     return qAbs(d) <= 0.000000000001;
1066 }
1067 
1068 /+ [[nodiscard]] +/ bool qFuzzyIsNull(float f)
1069 {
1070     return qAbs(f) <= 0.00001f;
1071 }
1072 
1073 /+ QT_WARNING_PUSH
1074 QT_WARNING_DISABLE_FLOAT_COMPARE +/
1075 
1076 /+ [[nodiscard]] +/ bool qIsNull(double d)/+ noexcept+/
1077 {
1078     return d == 0.0;
1079 }
1080 
1081 /+ [[nodiscard]] +/ bool qIsNull(float f)/+ noexcept+/
1082 {
1083     return f == 0.0f;
1084 }
1085 
1086 /+ QT_WARNING_POP
1087 
1088 /*
1089    Compilers which follow outdated template instantiation rules
1090    require a class to have a comparison operator to exist when
1091    a QList of this type is instantiated. It's not actually
1092    used in the list, though. Hence the dummy implementation.
1093    Just in case other code relies on it we better trigger a warning
1094    mandating a real implementation.
1095 */
1096 
1097 #ifdef Q_FULL_TEMPLATE_INSTANTIATION
1098 #  define Q_DUMMY_COMPARISON_OPERATOR(C) \
1099     bool operator==(const C&) const { \
1100         qWarning(#C"::operator==(const "#C"&) was called"); \
1101         return false; \
1102     }
1103 #else
1104 
1105 #  define Q_DUMMY_COMPARISON_OPERATOR(C)
1106 #endif
1107 
1108 QT_WARNING_PUSH
1109 // warning: noexcept-expression evaluates to 'false' because of a call to 'void swap(..., ...)'
1110 QT_WARNING_DISABLE_GCC("-Wnoexcept") +/
1111 
1112 extern(C++, "QtPrivate")
1113 {
1114 extern(C++, "SwapExceptionTester") { // insulate users from the "using std::swap" below
1115     /+ using std::swap; +/ // import std::swap
1116     void checkSwap(T)(ref T t)
1117             /+ noexcept(noexcept(swap(t, t))) +/;
1118     // declared, but not implemented (only to be used in unevaluated contexts (noexcept operator))
1119 }
1120 } // namespace QtPrivate
1121 
1122 // Documented in ../tools/qalgorithm.qdoc
1123 void qSwap(T)(ref T value1, ref T value2)
1124     /+ noexcept(noexcept(QtPrivate::SwapExceptionTester::checkSwap(value1))) +/
1125 {
1126     /+ using std::swap; +/
1127     import std.algorithm;
1128     swap(value1, value2);
1129 }
1130 
1131 /+ QT_WARNING_POP +/
1132 
1133 /+ Q_CORE_EXPORT +/ void* qMallocAligned(size_t size, size_t alignment) /+ Q_ALLOC_SIZE(1) +/;
1134 /+ Q_CORE_EXPORT +/ void* qReallocAligned(void* ptr, size_t size, size_t oldsize, size_t alignment) /+ Q_ALLOC_SIZE(2) +/;
1135 /+ Q_CORE_EXPORT +/ void qFreeAligned(void* ptr);
1136 
1137 
1138 /*
1139    Avoid some particularly useless warnings from some stupid compilers.
1140    To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out
1141    the line "#define QT_NO_WARNINGS".
1142 */
1143 /+ #if !defined(QT_CC_WARNINGS)
1144 #  define QT_NO_WARNINGS
1145 #endif
1146 #if defined(QT_NO_WARNINGS)
1147 #  if defined(Q_CC_MSVC)
1148 QT_WARNING_DISABLE_MSVC(4251) /* class 'type' needs to have dll-interface to be used by clients of class 'type2' */
1149 QT_WARNING_DISABLE_MSVC(4244) /* conversion from 'type1' to 'type2', possible loss of data */
1150 QT_WARNING_DISABLE_MSVC(4275) /* non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' */
1151 QT_WARNING_DISABLE_MSVC(4514) /* unreferenced inline function has been removed */
1152 QT_WARNING_DISABLE_MSVC(4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */
1153 QT_WARNING_DISABLE_MSVC(4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
1154 QT_WARNING_DISABLE_MSVC(4706) /* assignment within conditional expression */
1155 QT_WARNING_DISABLE_MSVC(4355) /* 'this' : used in base member initializer list */
1156 QT_WARNING_DISABLE_MSVC(4710) /* function not inlined */
1157 QT_WARNING_DISABLE_MSVC(4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */
1158 #  elif defined(Q_CC_BOR)
1159 #    pragma option -w-inl
1160 #    pragma option -w-aus
1161 #    pragma warn -inl
1162 #    pragma warn -pia
1163 #    pragma warn -ccc
1164 #    pragma warn -rch
1165 #    pragma warn -sig
1166 #  endif
1167 #endif +/
1168 
1169 // this adds const to non-const objects (like std::as_const)
1170 ref /+ std:: +/add_const!(T).type qAsConst(T)(ref T t)/+ noexcept+/ { return t; }
1171 // prevent rvalue arguments:
1172 /+ template <typename T>
1173 void qAsConst(const T &&) = delete;
1174 
1175 // like std::exchange
1176 template <typename T, typename U = T>
1177 constexpr T qExchange(T &t, U &&newValue)
1178 {
1179     T old = std::move(t);
1180     t = std::forward<U>(newValue);
1181     return old;
1182 }
1183 
1184 // like std::to_underlying
1185 template <typename Enum>
1186 constexpr std::underlying_type_t<Enum> qToUnderlying(Enum e) noexcept
1187 {
1188     return static_cast<std::underlying_type_t<Enum>>(e);
1189 }
1190 
1191 #ifdef __cpp_conditional_explicit
1192 #define Q_IMPLICIT explicit(false)
1193 #else
1194 #define Q_IMPLICIT
1195 #endif +/
1196 
1197 /+version(QT_NO_FOREACH){}else
1198 {
1199 
1200 extern(C++, "QtPrivate") {
1201 
1202 /+ template <typename T>
1203 class QForeachContainer {
1204     Q_DISABLE_COPY(QForeachContainer)
1205 public:
1206     QForeachContainer(const T &t) : c(t), i(qAsConst(c).begin()), e(qAsConst(c).end()) {}
1207     QForeachContainer(T &&t) : c(std::move(t)), i(qAsConst(c).begin()), e(qAsConst(c).end())  {}
1208 
1209     QForeachContainer(QForeachContainer &&other)
1210         : c(std::move(other.c)),
1211           i(qAsConst(c).begin()),
1212           e(qAsConst(c).end()),
1213           control(std::move(other.control))
1214     {
1215     }
1216 
1217     QForeachContainer &operator=(QForeachContainer &&other)
1218     {
1219         c = std::move(other.c);
1220         i = qAsConst(c).begin();
1221         e = qAsConst(c).end();
1222         control = std::move(other.control);
1223         return *this;
1224     }
1225 
1226     T c;
1227     typename T::const_iterator i, e;
1228     int control = 1;
1229 }; +/
1230 
1231 // Containers that have a detach function are considered shared, and are OK in a foreach loop
1232 pragma(inline, true) void warnIfContainerIsNotShared(T, )(int) {}
1233 
1234 /+ #if QT_DEPRECATED_SINCE(6, 0) +/
1235 // Other containers will copy themselves if used in foreach, this use is deprecated
1236 /+ QT_DEPRECATED_VERSION_X_6_0("Do not use foreach/Q_FOREACH with containers which are not implicitly shared. "
1237     "Prefer using a range-based for loop with these containers: `for (const auto &it : container)`, "
1238     "keeping in mind that range-based for doesn't copy the container as Q_FOREACH does") +/
1239 pragma(inline, true) void warnIfContainerIsNotShared(T)(...) {}
1240 /+ #endif
1241 
1242 template<typename T>
1243 QForeachContainer<typename std::decay<T>::type> qMakeForeachContainer(T &&t)
1244 {
1245     warnIfContainerIsNotShared<typename std::decay<T>::type>(0);
1246     return QForeachContainer<typename std::decay<T>::type>(std::forward<T>(t));
1247 } +/
1248 
1249 }
1250 
1251 // Use C++17 if statement with initializer. User's code ends up in a else so
1252 // scoping of different ifs is not broken
1253 /+ #define Q_FOREACH_IMPL(variable, name, container)                                             \
1254     for (auto name = QtPrivate::qMakeForeachContainer(container); name.i != name.e; ++name.i) \
1255         if (variable = *name.i; false) {} else
1256 
1257 #define Q_FOREACH_JOIN(A, B) Q_FOREACH_JOIN_IMPL(A, B)
1258 #define Q_FOREACH_JOIN_IMPL(A, B) A ## B
1259 
1260 #define Q_FOREACH(variable, container) \
1261     Q_FOREACH_IMPL(variable, Q_FOREACH_JOIN(_container_, __LINE__), container) +/
1262 } +/
1263 
1264 /+ #define Q_FOREVER for(;;)
1265 #ifndef QT_NO_KEYWORDS
1266 # ifndef QT_NO_FOREACH
1267 #  ifndef foreach
1268 #    define foreach Q_FOREACH
1269 #  endif
1270 # endif // QT_NO_FOREACH
1271 #  ifndef forever
1272 #    define forever Q_FOREVER
1273 #  endif
1274 #endif +/
1275 
1276 pragma(inline, true) T* qGetPtrHelper(T)(T* ptr)/+ noexcept+/ { return ptr; }
1277 pragma(inline, true) auto qGetPtrHelper(Ptr)()/+ (Ptr &ptr) noexcept -> decltype(ptr.get()) +/
1278 { static assert(noexcept(ptr.get()), "Smart d pointers for Q_DECLARE_PRIVATE must have noexcept get()"); return ptr.get(); }
1279 
1280 // The body must be a statement:
1281 /+ #define Q_CAST_IGNORE_ALIGN(body) QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wcast-align") body QT_WARNING_POP +/
1282 extern(D) alias Q_CAST_IGNORE_ALIGN = function string(string body_)
1283 {
1284     return /+ QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wcast-align") +/ mixin(interpolateMixin(q{$(body_)})); /+ QT_WARNING_POP +/
1285 };
1286 /+ #define Q_DECLARE_PRIVATE(Class) \
1287     inline Class##Private* d_func() noexcept \
1288     { Q_CAST_IGNORE_ALIGN(return reinterpret_cast<Class##Private *>(qGetPtrHelper(d_ptr));) } \
1289     inline const Class##Private* d_func() const noexcept \
1290     { Q_CAST_IGNORE_ALIGN(return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr));) } \
1291     friend class Class##Private;
1292 
1293 #define Q_DECLARE_PRIVATE_D(Dptr, Class) \
1294     inline Class##Private* d_func() noexcept \
1295     { Q_CAST_IGNORE_ALIGN(return reinterpret_cast<Class##Private *>(qGetPtrHelper(Dptr));) } \
1296     inline const Class##Private* d_func() const noexcept \
1297     { Q_CAST_IGNORE_ALIGN(return reinterpret_cast<const Class##Private *>(qGetPtrHelper(Dptr));) } \
1298     friend class Class##Private;
1299 
1300 #define Q_DECLARE_PUBLIC(Class)                                    \
1301     inline Class* q_func() noexcept { return static_cast<Class *>(q_ptr); } \
1302     inline const Class* q_func() const noexcept { return static_cast<const Class *>(q_ptr); } \
1303     friend class Class;
1304 
1305 #define Q_D(Class) Class##Private * const d = d_func()
1306 #define Q_Q(Class) Class * const q = q_func()
1307 
1308 #define QT_TR_NOOP(x) x
1309 #define QT_TR_NOOP_UTF8(x) x
1310 #define QT_TRANSLATE_NOOP(scope, x) x
1311 #define QT_TRANSLATE_NOOP_UTF8(scope, x) x
1312 #define QT_TRANSLATE_NOOP3(scope, x, comment) {x, comment}
1313 #define QT_TRANSLATE_NOOP3_UTF8(scope, x, comment) {x, comment} +/
1314 
1315 version(QT_NO_TRANSLATION){}else
1316 {
1317 
1318 /+ #define QT_TR_N_NOOP(x) x
1319 #define QT_TRANSLATE_N_NOOP(scope, x) x
1320 #define QT_TRANSLATE_N_NOOP3(scope, x, comment) {x, comment} +/
1321 
1322 // Defined in qcoreapplication.cpp
1323 // The better name qTrId() is reserved for an upcoming function which would
1324 // return a much more powerful QStringFormatter instead of a QString.
1325 /+ Q_CORE_EXPORT +/ QString qtTrId(const(char)* id, int n = -1);
1326 
1327 /+ #define QT_TRID_NOOP(id) id +/
1328 
1329 }
1330 
1331 
1332 /+ #ifdef Q_QDOC
1333 // Just for documentation generation
1334 template<typename T>
1335 auto qOverload(T functionPointer);
1336 template<typename T>
1337 auto qConstOverload(T memberFunctionPointer);
1338 template<typename T>
1339 auto qNonConstOverload(T memberFunctionPointer);
1340 #else
1341 template <typename... Args>
1342 struct QNonConstOverload
1343 {
1344     template <typename R, typename T>
1345     constexpr auto operator()(R (T::*ptr)(Args...)) const noexcept -> decltype(ptr)
1346     { return ptr; }
1347 
1348     template <typename R, typename T>
1349     static constexpr auto of(R (T::*ptr)(Args...)) noexcept -> decltype(ptr)
1350     { return ptr; }
1351 };
1352 
1353 template <typename... Args>
1354 struct QConstOverload
1355 {
1356     template <typename R, typename T>
1357     constexpr auto operator()(R (T::*ptr)(Args...) const) const noexcept -> decltype(ptr)
1358     { return ptr; }
1359 
1360     template <typename R, typename T>
1361     static constexpr auto of(R (T::*ptr)(Args...) const) noexcept -> decltype(ptr)
1362     { return ptr; }
1363 };
1364 
1365 template <typename... Args>
1366 struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...>
1367 {
1368     using QConstOverload<Args...>::of;
1369     using QConstOverload<Args...>::operator();
1370     using QNonConstOverload<Args...>::of;
1371     using QNonConstOverload<Args...>::operator();
1372 
1373     template <typename R>
1374     constexpr auto operator()(R (*ptr)(Args...)) const noexcept -> decltype(ptr)
1375     { return ptr; }
1376 
1377     template <typename R>
1378     static constexpr auto of(R (*ptr)(Args...)) noexcept -> decltype(ptr)
1379     { return ptr; }
1380 };
1381 
1382 template <typename... Args> constexpr inline QOverload<Args...> qOverload = {};
1383 template <typename... Args> constexpr inline QConstOverload<Args...> qConstOverload = {};
1384 template <typename... Args> constexpr inline QNonConstOverload<Args...> qNonConstOverload = {};
1385 #endif +/
1386 
1387 
1388 /+ Q_CORE_EXPORT +/ QByteArray qgetenv(const(char)* varName);
1389 // need it as two functions because QString is only forward-declared here
1390 /+ Q_CORE_EXPORT +/ QString qEnvironmentVariable(const(char)* varName);
1391 /+ Q_CORE_EXPORT +/ QString qEnvironmentVariable(const(char)* varName, ref const(QString) defaultValue);
1392 /+ Q_CORE_EXPORT +/ bool qputenv(const(char)* varName, ref const(QByteArray) value);
1393 /+ Q_CORE_EXPORT +/ bool qunsetenv(const(char)* varName);
1394 
1395 /+ Q_CORE_EXPORT +/ bool qEnvironmentVariableIsEmpty(const(char)* varName)/+ noexcept+/;
1396 /+ Q_CORE_EXPORT +/ bool qEnvironmentVariableIsSet(const(char)* varName)/+ noexcept+/;
1397 /+ Q_CORE_EXPORT +/ int  qEnvironmentVariableIntValue(const(char)* varName, bool* ok=null)/+ noexcept+/;
1398 
1399 pragma(inline, true) int qIntCast(double f) { return cast(int)(f); }
1400 pragma(inline, true) int qIntCast(float f) { return cast(int)(f); }
1401 
1402 /+ #define QT_MODULE(x)
1403 
1404 #if !defined(QT_BOOTSTRAPPED) && defined(QT_REDUCE_RELOCATIONS) && defined(__ELF__) && \
1405     (!defined(__PIC__) || (defined(__PIE__) && defined(Q_CC_GNU) && Q_CC_GNU >= 500))
1406 #  error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\
1407          "Compile your code with -fPIC (and not with -fPIE)."
1408 #endif
1409 
1410 #define QT_VA_ARGS_CHOOSE(_1, _2, _3, _4, _5, _6, _7, _8, _9, N, ...) N
1411 #define QT_VA_ARGS_EXPAND(...) __VA_ARGS__ // Needed for MSVC
1412 #define QT_VA_ARGS_COUNT(...) QT_VA_ARGS_EXPAND(QT_VA_ARGS_CHOOSE(__VA_ARGS__, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
1413 #define QT_OVERLOADED_MACRO_EXPAND(MACRO, ARGC) MACRO##_##ARGC
1414 #define QT_OVERLOADED_MACRO_IMP(MACRO, ARGC) QT_OVERLOADED_MACRO_EXPAND(MACRO, ARGC)
1415 #define QT_OVERLOADED_MACRO(MACRO, ...) QT_VA_ARGS_EXPAND(QT_OVERLOADED_MACRO_IMP(MACRO, QT_VA_ARGS_COUNT(__VA_ARGS__))(__VA_ARGS__))
1416 
1417 // This macro can be used to calculate member offsets for types with a non standard layout.
1418 // It uses the fact that offsetof() is allowed to support those types since C++17 as an optional
1419 // feature. All our compilers do support this, but some issue a warning, so we wrap the offsetof()
1420 // call in a macro that disables the compiler warning.
1421 #define Q_OFFSETOF(Class, member) \
1422     []() -> size_t { \
1423         QT_WARNING_PUSH QT_WARNING_DISABLE_INVALID_OFFSETOF \
1424         return offsetof(Class, member); \
1425         QT_WARNING_POP \
1426     }() +/
1427 
1428 
1429 // We need to keep QTypeInfo, QSysInfo, QFlags, qDebug & family in qglobal.h for compatibility with Qt 4.
1430 // Be careful when changing the order of these files.
1431 /+ #endif +/ /* __cplusplus */
1432 /+ #endif +/ /* !__ASSEMBLER__ */
1433