Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtCore module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qplatformdefs.h" | - |
43 | #include "qstring.h" | - |
44 | #include "qvector.h" | - |
45 | #include "qlist.h" | - |
46 | #include "qthreadstorage.h" | - |
47 | #include "qdir.h" | - |
48 | #include "qdatetime.h" | - |
49 | | - |
50 | #ifndef QT_NO_QOBJECT | - |
51 | #include <private/qthread_p.h> | - |
52 | #endif | - |
53 | | - |
54 | #include <stdlib.h> | - |
55 | #include <limits.h> | - |
56 | #include <stdarg.h> | - |
57 | #include <string.h> | - |
58 | | - |
59 | #ifndef QT_NO_EXCEPTIONS | - |
60 | # include <string> | - |
61 | # include <exception> | - |
62 | #endif | - |
63 | | - |
64 | #if !defined(Q_OS_WINCE) | - |
65 | # include <errno.h> | - |
66 | # if defined(Q_CC_MSVC) | - |
67 | # include <crtdbg.h> | - |
68 | # endif | - |
69 | #endif | - |
70 | | - |
71 | #if defined(Q_OS_VXWORKS) | - |
72 | # include <envLib.h> | - |
73 | #endif | - |
74 | | - |
75 | #if defined(Q_OS_MAC) && !defined(Q_OS_IOS) | - |
76 | #include <CoreServices/CoreServices.h> | - |
77 | #endif | - |
78 | | - |
79 | QT_BEGIN_NAMESPACE | - |
80 | | - |
81 | #if !QT_DEPRECATED_SINCE(5, 0) | - |
82 | // Make sure they're defined to be exported | - |
83 | Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n); | - |
84 | Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n); | - |
85 | #endif | - |
86 | | - |
87 | /*! | - |
88 | \class QFlag | - |
89 | \inmodule QtCore | - |
90 | \brief The QFlag class is a helper data type for QFlags. | - |
91 | | - |
92 | It is equivalent to a plain \c int, except with respect to | - |
93 | function overloading and type conversions. You should never need | - |
94 | to use this class in your applications. | - |
95 | | - |
96 | \sa QFlags | - |
97 | */ | - |
98 | | - |
99 | /*! | - |
100 | \fn QFlag::QFlag(int value) | - |
101 | | - |
102 | Constructs a QFlag object that stores the given \a value. | - |
103 | */ | - |
104 | | - |
105 | /*! | - |
106 | \fn QFlag::operator int() const | - |
107 | | - |
108 | Returns the value stored by the QFlag object. | - |
109 | */ | - |
110 | | - |
111 | /*! | - |
112 | \class QFlags | - |
113 | \inmodule QtCore | - |
114 | \brief The QFlags class provides a type-safe way of storing | - |
115 | OR-combinations of enum values. | - |
116 | | - |
117 | | - |
118 | \ingroup tools | - |
119 | | - |
120 | The QFlags<Enum> class is a template class, where Enum is an enum | - |
121 | type. QFlags is used throughout Qt for storing combinations of | - |
122 | enum values. | - |
123 | | - |
124 | The traditional C++ approach for storing OR-combinations of enum | - |
125 | values is to use an \c int or \c uint variable. The inconvenience | - |
126 | with this approach is that there's no type checking at all; any | - |
127 | enum value can be OR'd with any other enum value and passed on to | - |
128 | a function that takes an \c int or \c uint. | - |
129 | | - |
130 | Qt uses QFlags to provide type safety. For example, the | - |
131 | Qt::Alignment type is simply a typedef for | - |
132 | QFlags<Qt::AlignmentFlag>. QLabel::setAlignment() takes a | - |
133 | Qt::Alignment parameter, which means that any combination of | - |
134 | Qt::AlignmentFlag values, or 0, is legal: | - |
135 | | - |
136 | \snippet code/src_corelib_global_qglobal.cpp 0 | - |
137 | | - |
138 | If you try to pass a value from another enum or just a plain | - |
139 | integer other than 0, the compiler will report an error. If you | - |
140 | need to cast integer values to flags in a untyped fashion, you can | - |
141 | use the explicit QFlags constructor as cast operator. | - |
142 | | - |
143 | If you want to use QFlags for your own enum types, use | - |
144 | the Q_DECLARE_FLAGS() and Q_DECLARE_OPERATORS_FOR_FLAGS(). | - |
145 | | - |
146 | Example: | - |
147 | | - |
148 | \snippet code/src_corelib_global_qglobal.cpp 1 | - |
149 | | - |
150 | You can then use the \c MyClass::Options type to store | - |
151 | combinations of \c MyClass::Option values. | - |
152 | | - |
153 | \section1 Flags and the Meta-Object System | - |
154 | | - |
155 | The Q_DECLARE_FLAGS() macro does not expose the flags to the meta-object | - |
156 | system, so they cannot be used by Qt Script or edited in Qt Designer. | - |
157 | To make the flags available for these purposes, the Q_FLAGS() macro must | - |
158 | be used: | - |
159 | | - |
160 | \snippet code/src_corelib_global_qglobal.cpp meta-object flags | - |
161 | | - |
162 | \section1 Naming Convention | - |
163 | | - |
164 | A sensible naming convention for enum types and associated QFlags | - |
165 | types is to give a singular name to the enum type (e.g., \c | - |
166 | Option) and a plural name to the QFlags type (e.g., \c Options). | - |
167 | When a singular name is desired for the QFlags type (e.g., \c | - |
168 | Alignment), you can use \c Flag as the suffix for the enum type | - |
169 | (e.g., \c AlignmentFlag). | - |
170 | | - |
171 | \sa QFlag | - |
172 | */ | - |
173 | | - |
174 | /*! | - |
175 | \typedef QFlags::Int | - |
176 | \since 5.0 | - |
177 | | - |
178 | Typedef for the integer type used for storage as well as for | - |
179 | implicit conversion. Either \c int or \c{unsigned int}, depending | - |
180 | on whether the enum's underlying type is signed or unsigned. | - |
181 | */ | - |
182 | | - |
183 | /*! | - |
184 | \typedef QFlags::enum_type | - |
185 | | - |
186 | Typedef for the Enum template type. | - |
187 | */ | - |
188 | | - |
189 | /*! | - |
190 | \fn QFlags::QFlags(const QFlags &other) | - |
191 | | - |
192 | Constructs a copy of \a other. | - |
193 | */ | - |
194 | | - |
195 | /*! | - |
196 | \fn QFlags::QFlags(Enum flag) | - |
197 | | - |
198 | Constructs a QFlags object storing the given \a flag. | - |
199 | */ | - |
200 | | - |
201 | /*! | - |
202 | \fn QFlags::QFlags(Zero zero) | - |
203 | | - |
204 | Constructs a QFlags object with no flags set. \a zero must be a | - |
205 | literal 0 value. | - |
206 | */ | - |
207 | | - |
208 | /*! | - |
209 | \fn QFlags::QFlags(QFlag value) | - |
210 | | - |
211 | Constructs a QFlags object initialized with the given integer \a | - |
212 | value. | - |
213 | | - |
214 | The QFlag type is a helper type. By using it here instead of \c | - |
215 | int, we effectively ensure that arbitrary enum values cannot be | - |
216 | cast to a QFlags, whereas untyped enum values (i.e., \c int | - |
217 | values) can. | - |
218 | */ | - |
219 | | - |
220 | /*! | - |
221 | \fn QFlags &QFlags::operator=(const QFlags &other) | - |
222 | | - |
223 | Assigns \a other to this object and returns a reference to this | - |
224 | object. | - |
225 | */ | - |
226 | | - |
227 | /*! | - |
228 | \fn QFlags &QFlags::operator&=(int mask) | - |
229 | | - |
230 | Performs a bitwise AND operation with \a mask and stores the | - |
231 | result in this QFlags object. Returns a reference to this object. | - |
232 | | - |
233 | \sa operator&(), operator|=(), operator^=() | - |
234 | */ | - |
235 | | - |
236 | /*! | - |
237 | \fn QFlags &QFlags::operator&=(uint mask) | - |
238 | | - |
239 | \overload | - |
240 | */ | - |
241 | | - |
242 | /*! | - |
243 | \fn QFlags &QFlags::operator|=(QFlags other) | - |
244 | | - |
245 | Performs a bitwise OR operation with \a other and stores the | - |
246 | result in this QFlags object. Returns a reference to this object. | - |
247 | | - |
248 | \sa operator|(), operator&=(), operator^=() | - |
249 | */ | - |
250 | | - |
251 | /*! | - |
252 | \fn QFlags &QFlags::operator|=(Enum other) | - |
253 | | - |
254 | \overload | - |
255 | */ | - |
256 | | - |
257 | /*! | - |
258 | \fn QFlags &QFlags::operator^=(QFlags other) | - |
259 | | - |
260 | Performs a bitwise XOR operation with \a other and stores the | - |
261 | result in this QFlags object. Returns a reference to this object. | - |
262 | | - |
263 | \sa operator^(), operator&=(), operator|=() | - |
264 | */ | - |
265 | | - |
266 | /*! | - |
267 | \fn QFlags &QFlags::operator^=(Enum other) | - |
268 | | - |
269 | \overload | - |
270 | */ | - |
271 | | - |
272 | /*! | - |
273 | \fn QFlags::operator Int() const | - |
274 | | - |
275 | Returns the value stored in the QFlags object as an integer. | - |
276 | | - |
277 | \sa Int | - |
278 | */ | - |
279 | | - |
280 | /*! | - |
281 | \fn QFlags QFlags::operator|(QFlags other) const | - |
282 | | - |
283 | Returns a QFlags object containing the result of the bitwise OR | - |
284 | operation on this object and \a other. | - |
285 | | - |
286 | \sa operator|=(), operator^(), operator&(), operator~() | - |
287 | */ | - |
288 | | - |
289 | /*! | - |
290 | \fn QFlags QFlags::operator|(Enum other) const | - |
291 | | - |
292 | \overload | - |
293 | */ | - |
294 | | - |
295 | /*! | - |
296 | \fn QFlags QFlags::operator^(QFlags other) const | - |
297 | | - |
298 | Returns a QFlags object containing the result of the bitwise XOR | - |
299 | operation on this object and \a other. | - |
300 | | - |
301 | \sa operator^=(), operator&(), operator|(), operator~() | - |
302 | */ | - |
303 | | - |
304 | /*! | - |
305 | \fn QFlags QFlags::operator^(Enum other) const | - |
306 | | - |
307 | \overload | - |
308 | */ | - |
309 | | - |
310 | /*! | - |
311 | \fn QFlags QFlags::operator&(int mask) const | - |
312 | | - |
313 | Returns a QFlags object containing the result of the bitwise AND | - |
314 | operation on this object and \a mask. | - |
315 | | - |
316 | \sa operator&=(), operator|(), operator^(), operator~() | - |
317 | */ | - |
318 | | - |
319 | /*! | - |
320 | \fn QFlags QFlags::operator&(uint mask) const | - |
321 | | - |
322 | \overload | - |
323 | */ | - |
324 | | - |
325 | /*! | - |
326 | \fn QFlags QFlags::operator&(Enum mask) const | - |
327 | | - |
328 | \overload | - |
329 | */ | - |
330 | | - |
331 | /*! | - |
332 | \fn QFlags QFlags::operator~() const | - |
333 | | - |
334 | Returns a QFlags object that contains the bitwise negation of | - |
335 | this object. | - |
336 | | - |
337 | \sa operator&(), operator|(), operator^() | - |
338 | */ | - |
339 | | - |
340 | /*! | - |
341 | \fn bool QFlags::operator!() const | - |
342 | | - |
343 | Returns true if no flag is set (i.e., if the value stored by the | - |
344 | QFlags object is 0); otherwise returns false. | - |
345 | */ | - |
346 | | - |
347 | /*! | - |
348 | \fn bool QFlags::testFlag(Enum flag) const | - |
349 | \since 4.2 | - |
350 | | - |
351 | Returns true if the \a flag is set, otherwise false. | - |
352 | */ | - |
353 | | - |
354 | /*! | - |
355 | \macro Q_DISABLE_COPY(Class) | - |
356 | \relates QObject | - |
357 | | - |
358 | Disables the use of copy constructors and assignment operators | - |
359 | for the given \a Class. | - |
360 | | - |
361 | Instances of subclasses of QObject should not be thought of as | - |
362 | values that can be copied or assigned, but as unique identities. | - |
363 | This means that when you create your own subclass of QObject | - |
364 | (director or indirect), you should \e not give it a copy constructor | - |
365 | or an assignment operator. However, it may not enough to simply | - |
366 | omit them from your class, because, if you mistakenly write some code | - |
367 | that requires a copy constructor or an assignment operator (it's easy | - |
368 | to do), your compiler will thoughtfully create it for you. You must | - |
369 | do more. | - |
370 | | - |
371 | The curious user will have seen that the Qt classes derived | - |
372 | from QObject typically include this macro in a private section: | - |
373 | | - |
374 | \snippet code/src_corelib_global_qglobal.cpp 43 | - |
375 | | - |
376 | It declares a copy constructor and an assignment operator in the | - |
377 | private section, so that if you use them by mistake, the compiler | - |
378 | will report an error. | - |
379 | | - |
380 | \snippet code/src_corelib_global_qglobal.cpp 44 | - |
381 | | - |
382 | But even this might not catch absolutely every case. You might be | - |
383 | tempted to do something like this: | - |
384 | | - |
385 | \snippet code/src_corelib_global_qglobal.cpp 45 | - |
386 | | - |
387 | First of all, don't do that. Most compilers will generate code that | - |
388 | uses the copy constructor, so the privacy violation error will be | - |
389 | reported, but your C++ compiler is not required to generate code for | - |
390 | this statement in a specific way. It could generate code using | - |
391 | \e{neither} the copy constructor \e{nor} the assignment operator we | - |
392 | made private. In that case, no error would be reported, but your | - |
393 | application would probably crash when you called a member function | - |
394 | of \c{w}. | - |
395 | */ | - |
396 | | - |
397 | /*! | - |
398 | \macro Q_DECLARE_FLAGS(Flags, Enum) | - |
399 | \relates QFlags | - |
400 | | - |
401 | The Q_DECLARE_FLAGS() macro expands to | - |
402 | | - |
403 | \snippet code/src_corelib_global_qglobal.cpp 2 | - |
404 | | - |
405 | \a Enum is the name of an existing enum type, whereas \a Flags is | - |
406 | the name of the QFlags<\e{Enum}> typedef. | - |
407 | | - |
408 | See the QFlags documentation for details. | - |
409 | | - |
410 | \sa Q_DECLARE_OPERATORS_FOR_FLAGS() | - |
411 | */ | - |
412 | | - |
413 | /*! | - |
414 | \macro Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) | - |
415 | \relates QFlags | - |
416 | | - |
417 | The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global \c | - |
418 | operator|() functions for \a Flags, which is of type QFlags<T>. | - |
419 | | - |
420 | See the QFlags documentation for details. | - |
421 | | - |
422 | \sa Q_DECLARE_FLAGS() | - |
423 | */ | - |
424 | | - |
425 | /*! | - |
426 | \headerfile <QtGlobal> | - |
427 | \title Global Qt Declarations | - |
428 | \ingroup funclists | - |
429 | | - |
430 | \brief The <QtGlobal> header file includes the fundamental global | - |
431 | declarations. It is included by most other Qt header files. | - |
432 | | - |
433 | The global declarations include \l{types}, \l{functions} and | - |
434 | \l{macros}. | - |
435 | | - |
436 | The type definitions are partly convenience definitions for basic | - |
437 | types (some of which guarantee certain bit-sizes on all platforms | - |
438 | supported by Qt), partly types related to Qt message handling. The | - |
439 | functions are related to generating messages, Qt version handling | - |
440 | and comparing and adjusting object values. And finally, some of | - |
441 | the declared macros enable programmers to add compiler or platform | - |
442 | specific code to their applications, while others are convenience | - |
443 | macros for larger operations. | - |
444 | | - |
445 | \section1 Types | - |
446 | | - |
447 | The header file declares several type definitions that guarantee a | - |
448 | specified bit-size on all platforms supported by Qt for various | - |
449 | basic types, for example \l qint8 which is a signed char | - |
450 | guaranteed to be 8-bit on all platforms supported by Qt. The | - |
451 | header file also declares the \l qlonglong type definition for \c | - |
452 | {long long int } (\c __int64 on Windows). | - |
453 | | - |
454 | Several convenience type definitions are declared: \l qreal for \c | - |
455 | double, \l uchar for \c unsigned char, \l uint for \c unsigned | - |
456 | int, \l ulong for \c unsigned long and \l ushort for \c unsigned | - |
457 | short. | - |
458 | | - |
459 | Finally, the QtMsgType definition identifies the various messages | - |
460 | that can be generated and sent to a Qt message handler; | - |
461 | QtMessageHandler is a type definition for a pointer to a function with | - |
462 | the signature | - |
463 | \c {void myMessageHandler(QtMsgType, const QMessageLogContext &, const char *)}. | - |
464 | QMessageLogContext class contains the line, file, and function the | - |
465 | message was logged at. This information is created by the QMessageLogger | - |
466 | class. | - |
467 | | - |
468 | \section1 Functions | - |
469 | | - |
470 | The <QtGlobal> header file contains several functions comparing | - |
471 | and adjusting an object's value. These functions take a template | - |
472 | type as argument: You can retrieve the absolute value of an object | - |
473 | using the qAbs() function, and you can bound a given object's | - |
474 | value by given minimum and maximum values using the qBound() | - |
475 | function. You can retrieve the minimum and maximum of two given | - |
476 | objects using qMin() and qMax() respectively. All these functions | - |
477 | return a corresponding template type; the template types can be | - |
478 | replaced by any other type. | - |
479 | | - |
480 | Example: | - |
481 | | - |
482 | \snippet code/src_corelib_global_qglobal.cpp 3 | - |
483 | | - |
484 | <QtGlobal> also contains functions that generate messages from the | - |
485 | given string argument: qCritical(), qDebug(), qFatal() and | - |
486 | qWarning(). These functions call the message handler with the | - |
487 | given message. | - |
488 | | - |
489 | Example: | - |
490 | | - |
491 | \snippet code/src_corelib_global_qglobal.cpp 4 | - |
492 | | - |
493 | The remaining functions are qRound() and qRound64(), which both | - |
494 | accept a \l qreal value as their argument returning the value | - |
495 | rounded up to the nearest integer and 64-bit integer respectively, | - |
496 | the qInstallMessageHandler() function which installs the given | - |
497 | QtMessageHandler, and the qVersion() function which returns the | - |
498 | version number of Qt at run-time as a string. | - |
499 | | - |
500 | \section1 Macros | - |
501 | | - |
502 | The <QtGlobal> header file provides a range of macros (Q_CC_*) | - |
503 | that are defined if the application is compiled using the | - |
504 | specified platforms. For example, the Q_CC_SUN macro is defined if | - |
505 | the application is compiled using Forte Developer, or Sun Studio | - |
506 | C++. The header file also declares a range of macros (Q_OS_*) | - |
507 | that are defined for the specified platforms. For example, | - |
508 | Q_OS_X11 which is defined for the X Window System. | - |
509 | | - |
510 | The purpose of these macros is to enable programmers to add | - |
511 | compiler or platform specific code to their application. | - |
512 | | - |
513 | The remaining macros are convenience macros for larger operations: | - |
514 | The QT_TRANSLATE_NOOP() and QT_TR_NOOP() macros provide the | - |
515 | possibility of marking text for dynamic translation, | - |
516 | i.e. translation without changing the stored source text. The | - |
517 | Q_ASSERT() and Q_ASSERT_X() enables warning messages of various | - |
518 | level of refinement. The Q_FOREACH() and foreach() macros | - |
519 | implement Qt's foreach loop. | - |
520 | | - |
521 | The Q_INT64_C() and Q_UINT64_C() macros wrap signed and unsigned | - |
522 | 64-bit integer literals in a platform-independent way. The | - |
523 | Q_CHECK_PTR() macro prints a warning containing the source code's | - |
524 | file name and line number, saying that the program ran out of | - |
525 | memory, if the pointer is 0. The qPrintable() macro represent an | - |
526 | easy way of printing text. | - |
527 | | - |
528 | Finally, the QT_POINTER_SIZE macro expands to the size of a | - |
529 | pointer in bytes, and the QT_VERSION and QT_VERSION_STR macros | - |
530 | expand to a numeric value or a string, respectively, specifying | - |
531 | Qt's version number, i.e the version the application is compiled | - |
532 | against. | - |
533 | | - |
534 | \sa <QtAlgorithms>, QSysInfo | - |
535 | */ | - |
536 | | - |
537 | /*! | - |
538 | \typedef qreal | - |
539 | \relates <QtGlobal> | - |
540 | | - |
541 | Typedef for \c double on all platforms except for those using CPUs with | - |
542 | ARM architectures. | - |
543 | On ARM-based platforms, \c qreal is a typedef for \c float for performance | - |
544 | reasons. | - |
545 | */ | - |
546 | | - |
547 | /*! \typedef uchar | - |
548 | \relates <QtGlobal> | - |
549 | | - |
550 | Convenience typedef for \c{unsigned char}. | - |
551 | */ | - |
552 | | - |
553 | /*! \typedef ushort | - |
554 | \relates <QtGlobal> | - |
555 | | - |
556 | Convenience typedef for \c{unsigned short}. | - |
557 | */ | - |
558 | | - |
559 | /*! \typedef uint | - |
560 | \relates <QtGlobal> | - |
561 | | - |
562 | Convenience typedef for \c{unsigned int}. | - |
563 | */ | - |
564 | | - |
565 | /*! \typedef ulong | - |
566 | \relates <QtGlobal> | - |
567 | | - |
568 | Convenience typedef for \c{unsigned long}. | - |
569 | */ | - |
570 | | - |
571 | /*! \typedef qint8 | - |
572 | \relates <QtGlobal> | - |
573 | | - |
574 | Typedef for \c{signed char}. This type is guaranteed to be 8-bit | - |
575 | on all platforms supported by Qt. | - |
576 | */ | - |
577 | | - |
578 | /*! | - |
579 | \typedef quint8 | - |
580 | \relates <QtGlobal> | - |
581 | | - |
582 | Typedef for \c{unsigned char}. This type is guaranteed to | - |
583 | be 8-bit on all platforms supported by Qt. | - |
584 | */ | - |
585 | | - |
586 | /*! \typedef qint16 | - |
587 | \relates <QtGlobal> | - |
588 | | - |
589 | Typedef for \c{signed short}. This type is guaranteed to be | - |
590 | 16-bit on all platforms supported by Qt. | - |
591 | */ | - |
592 | | - |
593 | /*! | - |
594 | \typedef quint16 | - |
595 | \relates <QtGlobal> | - |
596 | | - |
597 | Typedef for \c{unsigned short}. This type is guaranteed to | - |
598 | be 16-bit on all platforms supported by Qt. | - |
599 | */ | - |
600 | | - |
601 | /*! \typedef qint32 | - |
602 | \relates <QtGlobal> | - |
603 | | - |
604 | Typedef for \c{signed int}. This type is guaranteed to be 32-bit | - |
605 | on all platforms supported by Qt. | - |
606 | */ | - |
607 | | - |
608 | /*! | - |
609 | \typedef quint32 | - |
610 | \relates <QtGlobal> | - |
611 | | - |
612 | Typedef for \c{unsigned int}. This type is guaranteed to | - |
613 | be 32-bit on all platforms supported by Qt. | - |
614 | */ | - |
615 | | - |
616 | /*! \typedef qint64 | - |
617 | \relates <QtGlobal> | - |
618 | | - |
619 | Typedef for \c{long long int} (\c __int64 on Windows). This type | - |
620 | is guaranteed to be 64-bit on all platforms supported by Qt. | - |
621 | | - |
622 | Literals of this type can be created using the Q_INT64_C() macro: | - |
623 | | - |
624 | \snippet code/src_corelib_global_qglobal.cpp 5 | - |
625 | | - |
626 | \sa Q_INT64_C(), quint64, qlonglong | - |
627 | */ | - |
628 | | - |
629 | /*! | - |
630 | \typedef quint64 | - |
631 | \relates <QtGlobal> | - |
632 | | - |
633 | Typedef for \c{unsigned long long int} (\c{unsigned __int64} on | - |
634 | Windows). This type is guaranteed to be 64-bit on all platforms | - |
635 | supported by Qt. | - |
636 | | - |
637 | Literals of this type can be created using the Q_UINT64_C() | - |
638 | macro: | - |
639 | | - |
640 | \snippet code/src_corelib_global_qglobal.cpp 6 | - |
641 | | - |
642 | \sa Q_UINT64_C(), qint64, qulonglong | - |
643 | */ | - |
644 | | - |
645 | /*! | - |
646 | \typedef qintptr | - |
647 | \relates <QtGlobal> | - |
648 | | - |
649 | Integral type for representing pointers in a signed integer (useful for | - |
650 | hashing, etc.). | - |
651 | | - |
652 | Typedef for either qint32 or qint64. This type is guaranteed to | - |
653 | be the same size as a pointer on all platforms supported by Qt. On | - |
654 | a system with 32-bit pointers, qintptr is a typedef for qint32; | - |
655 | on a system with 64-bit pointers, qintptr is a typedef for | - |
656 | qint64. | - |
657 | | - |
658 | Note that qintptr is signed. Use quintptr for unsigned values. | - |
659 | | - |
660 | \sa qptrdiff, qint32, qint64 | - |
661 | */ | - |
662 | | - |
663 | /*! | - |
664 | \typedef quintptr | - |
665 | \relates <QtGlobal> | - |
666 | | - |
667 | Integral type for representing pointers in an unsigned integer (useful for | - |
668 | hashing, etc.). | - |
669 | | - |
670 | Typedef for either quint32 or quint64. This type is guaranteed to | - |
671 | be the same size as a pointer on all platforms supported by Qt. On | - |
672 | a system with 32-bit pointers, quintptr is a typedef for quint32; | - |
673 | on a system with 64-bit pointers, quintptr is a typedef for | - |
674 | quint64. | - |
675 | | - |
676 | Note that quintptr is unsigned. Use qptrdiff for signed values. | - |
677 | | - |
678 | \sa qptrdiff, quint32, quint64 | - |
679 | */ | - |
680 | | - |
681 | /*! | - |
682 | \typedef qptrdiff | - |
683 | \relates <QtGlobal> | - |
684 | | - |
685 | Integral type for representing pointer differences. | - |
686 | | - |
687 | Typedef for either qint32 or qint64. This type is guaranteed to be | - |
688 | the same size as a pointer on all platforms supported by Qt. On a | - |
689 | system with 32-bit pointers, quintptr is a typedef for quint32; on | - |
690 | a system with 64-bit pointers, quintptr is a typedef for quint64. | - |
691 | | - |
692 | Note that qptrdiff is signed. Use quintptr for unsigned values. | - |
693 | | - |
694 | \sa quintptr, qint32, qint64 | - |
695 | */ | - |
696 | | - |
697 | /*! | - |
698 | \enum QtMsgType | - |
699 | \relates <QtGlobal> | - |
700 | | - |
701 | This enum describes the messages that can be sent to a message | - |
702 | handler (QtMsgHandler). You can use the enum to identify and | - |
703 | associate the various message types with the appropriate | - |
704 | actions. | - |
705 | | - |
706 | \value QtDebugMsg | - |
707 | A message generated by the qDebug() function. | - |
708 | \value QtWarningMsg | - |
709 | A message generated by the qWarning() function. | - |
710 | \value QtCriticalMsg | - |
711 | A message generated by the qCritical() function. | - |
712 | \value QtFatalMsg | - |
713 | A message generated by the qFatal() function. | - |
714 | \value QtSystemMsg | - |
715 | | - |
716 | | - |
717 | \sa QtMessageHandler, qInstallMessageHandler() | - |
718 | */ | - |
719 | | - |
720 | /*! \typedef QFunctionPointer | - |
721 | \relates <QtGlobal> | - |
722 | | - |
723 | This is a typedef for \c{void (*)()}, a pointer to a function that takes | - |
724 | no arguments and returns void. | - |
725 | */ | - |
726 | | - |
727 | /*! \macro qint64 Q_INT64_C(literal) | - |
728 | \relates <QtGlobal> | - |
729 | | - |
730 | Wraps the signed 64-bit integer \a literal in a | - |
731 | platform-independent way. | - |
732 | | - |
733 | Example: | - |
734 | | - |
735 | \snippet code/src_corelib_global_qglobal.cpp 8 | - |
736 | | - |
737 | \sa qint64, Q_UINT64_C() | - |
738 | */ | - |
739 | | - |
740 | /*! \macro quint64 Q_UINT64_C(literal) | - |
741 | \relates <QtGlobal> | - |
742 | | - |
743 | Wraps the unsigned 64-bit integer \a literal in a | - |
744 | platform-independent way. | - |
745 | | - |
746 | Example: | - |
747 | | - |
748 | \snippet code/src_corelib_global_qglobal.cpp 9 | - |
749 | | - |
750 | \sa quint64, Q_INT64_C() | - |
751 | */ | - |
752 | | - |
753 | /*! \typedef qlonglong | - |
754 | \relates <QtGlobal> | - |
755 | | - |
756 | Typedef for \c{long long int} (\c __int64 on Windows). This is | - |
757 | the same as \l qint64. | - |
758 | | - |
759 | \sa qulonglong, qint64 | - |
760 | */ | - |
761 | | - |
762 | /*! | - |
763 | \typedef qulonglong | - |
764 | \relates <QtGlobal> | - |
765 | | - |
766 | Typedef for \c{unsigned long long int} (\c{unsigned __int64} on | - |
767 | Windows). This is the same as \l quint64. | - |
768 | | - |
769 | \sa quint64, qlonglong | - |
770 | */ | - |
771 | | - |
772 | /*! \fn T qAbs(const T &value) | - |
773 | \relates <QtGlobal> | - |
774 | | - |
775 | Compares \a value to the 0 of type T and returns the absolute | - |
776 | value. Thus if T is \e {double}, then \a value is compared to | - |
777 | \e{(double) 0}. | - |
778 | | - |
779 | Example: | - |
780 | | - |
781 | \snippet code/src_corelib_global_qglobal.cpp 10 | - |
782 | */ | - |
783 | | - |
784 | /*! \fn int qRound(qreal value) | - |
785 | \relates <QtGlobal> | - |
786 | | - |
787 | Rounds \a value to the nearest integer. | - |
788 | | - |
789 | Example: | - |
790 | | - |
791 | \snippet code/src_corelib_global_qglobal.cpp 11 | - |
792 | */ | - |
793 | | - |
794 | /*! \fn qint64 qRound64(qreal value) | - |
795 | \relates <QtGlobal> | - |
796 | | - |
797 | Rounds \a value to the nearest 64-bit integer. | - |
798 | | - |
799 | Example: | - |
800 | | - |
801 | \snippet code/src_corelib_global_qglobal.cpp 12 | - |
802 | */ | - |
803 | | - |
804 | /*! \fn const T &qMin(const T &value1, const T &value2) | - |
805 | \relates <QtGlobal> | - |
806 | | - |
807 | Returns the minimum of \a value1 and \a value2. | - |
808 | | - |
809 | Example: | - |
810 | | - |
811 | \snippet code/src_corelib_global_qglobal.cpp 13 | - |
812 | | - |
813 | \sa qMax(), qBound() | - |
814 | */ | - |
815 | | - |
816 | /*! \fn const T &qMax(const T &value1, const T &value2) | - |
817 | \relates <QtGlobal> | - |
818 | | - |
819 | Returns the maximum of \a value1 and \a value2. | - |
820 | | - |
821 | Example: | - |
822 | | - |
823 | \snippet code/src_corelib_global_qglobal.cpp 14 | - |
824 | | - |
825 | \sa qMin(), qBound() | - |
826 | */ | - |
827 | | - |
828 | /*! \fn const T &qBound(const T &min, const T &value, const T &max) | - |
829 | \relates <QtGlobal> | - |
830 | | - |
831 | Returns \a value bounded by \a min and \a max. This is equivalent | - |
832 | to qMax(\a min, qMin(\a value, \a max)). | - |
833 | | - |
834 | Example: | - |
835 | | - |
836 | \snippet code/src_corelib_global_qglobal.cpp 15 | - |
837 | | - |
838 | \sa qMin(), qMax() | - |
839 | */ | - |
840 | | - |
841 | /*! | - |
842 | \macro QT_VERSION_CHECK | - |
843 | \relates <QtGlobal> | - |
844 | | - |
845 | Turns the major, minor and patch numbers of a version into an | - |
846 | integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can | - |
847 | be compared with another similarly processed version id. | - |
848 | | - |
849 | Example: | - |
850 | | - |
851 | \snippet code/src_corelib_global_qglobal.cpp qt-version-check | - |
852 | | - |
853 | \sa QT_VERSION | - |
854 | */ | - |
855 | | - |
856 | /*! | - |
857 | \macro QT_VERSION | - |
858 | \relates <QtGlobal> | - |
859 | | - |
860 | This macro expands a numeric value of the form 0xMMNNPP (MM = | - |
861 | major, NN = minor, PP = patch) that specifies Qt's version | - |
862 | number. For example, if you compile your application against Qt | - |
863 | 4.1.2, the QT_VERSION macro will expand to 0x040102. | - |
864 | | - |
865 | You can use QT_VERSION to use the latest Qt features where | - |
866 | available. | - |
867 | | - |
868 | Example: | - |
869 | | - |
870 | \snippet code/src_corelib_global_qglobal.cpp 16 | - |
871 | | - |
872 | \sa QT_VERSION_STR, qVersion() | - |
873 | */ | - |
874 | | - |
875 | /*! | - |
876 | \macro QT_VERSION_STR | - |
877 | \relates <QtGlobal> | - |
878 | | - |
879 | This macro expands to a string that specifies Qt's version number | - |
880 | (for example, "4.1.2"). This is the version against which the | - |
881 | application is compiled. | - |
882 | | - |
883 | \sa qVersion(), QT_VERSION | - |
884 | */ | - |
885 | | - |
886 | /*! | - |
887 | \relates <QtGlobal> | - |
888 | | - |
889 | Returns the version number of Qt at run-time as a string (for | - |
890 | example, "4.1.2"). This may be a different version than the | - |
891 | version the application was compiled against. | - |
892 | | - |
893 | \sa QT_VERSION_STR | - |
894 | */ | - |
895 | | - |
896 | const char *qVersion() Q_DECL_NOTHROW | - |
897 | { | - |
898 | return QT_VERSION_STR; executed: return "5.0.2"; Execution Count:400 | 400 |
899 | } | - |
900 | | - |
901 | bool qSharedBuild() Q_DECL_NOTHROW | - |
902 | { | - |
903 | #ifdef QT_SHARED | - |
904 | return true; never executed: return true; | 0 |
905 | #else | - |
906 | return false; | - |
907 | #endif | - |
908 | } | - |
909 | | - |
910 | /***************************************************************************** | - |
911 | System detection routines | - |
912 | *****************************************************************************/ | - |
913 | | - |
914 | /*! | - |
915 | \class QSysInfo | - |
916 | \inmodule QtCore | - |
917 | \brief The QSysInfo class provides information about the system. | - |
918 | | - |
919 | \list | - |
920 | \li \l WordSize specifies the size of a pointer for the platform | - |
921 | on which the application is compiled. | - |
922 | \li \l ByteOrder specifies whether the platform is big-endian or | - |
923 | little-endian. | - |
924 | \li \l WindowsVersion specifies the version of the Windows operating | - |
925 | system on which the application is run (Windows only) | - |
926 | \li \l MacintoshVersion specifies the version of the Macintosh | - |
927 | operating system on which the application is run (Mac only). | - |
928 | \endlist | - |
929 | | - |
930 | Some constants are defined only on certain platforms. You can use | - |
931 | the preprocessor symbols Q_OS_WIN and Q_OS_MAC to test that | - |
932 | the application is compiled under Windows or Mac. | - |
933 | | - |
934 | \sa QLibraryInfo | - |
935 | */ | - |
936 | | - |
937 | /*! | - |
938 | \enum QSysInfo::Sizes | - |
939 | | - |
940 | This enum provides platform-specific information about the sizes of data | - |
941 | structures used by the underlying architecture. | - |
942 | | - |
943 | \value WordSize The size in bits of a pointer for the platform on which | - |
944 | the application is compiled (32 or 64). | - |
945 | */ | - |
946 | | - |
947 | /*! | - |
948 | \variable QSysInfo::WindowsVersion | - |
949 | \brief the version of the Windows operating system on which the | - |
950 | application is run (Windows only) | - |
951 | */ | - |
952 | | - |
953 | /*! | - |
954 | \fn QSysInfo::WindowsVersion QSysInfo::windowsVersion() | - |
955 | \since 4.4 | - |
956 | | - |
957 | Returns the version of the Windows operating system on which the | - |
958 | application is run (Windows only). | - |
959 | */ | - |
960 | | - |
961 | /*! | - |
962 | \variable QSysInfo::MacintoshVersion | - |
963 | \brief the version of the Macintosh operating system on which | - |
964 | the application is run (Mac only). | - |
965 | */ | - |
966 | | - |
967 | /*! | - |
968 | \fn QSysInfo::MacVersion QSysInfo::macVersion() | - |
969 | | - |
970 | Returns the version of Mac OS X on which the application is run (Mac OS X | - |
971 | Only). | - |
972 | */ | - |
973 | | - |
974 | /*! | - |
975 | \enum QSysInfo::Endian | - |
976 | | - |
977 | \value BigEndian Big-endian byte order (also called Network byte order) | - |
978 | \value LittleEndian Little-endian byte order | - |
979 | \value ByteOrder Equals BigEndian or LittleEndian, depending on | - |
980 | the platform's byte order. | - |
981 | */ | - |
982 | | - |
983 | /*! | - |
984 | \enum QSysInfo::WinVersion | - |
985 | | - |
986 | This enum provides symbolic names for the various versions of the | - |
987 | Windows operating system. On Windows, the | - |
988 | QSysInfo::WindowsVersion variable gives the version of the system | - |
989 | on which the application is run. | - |
990 | | - |
991 | MS-DOS-based versions: | - |
992 | | - |
993 | \value WV_32s Windows 3.1 with Win 32s | - |
994 | \value WV_95 Windows 95 | - |
995 | \value WV_98 Windows 98 | - |
996 | \value WV_Me Windows Me | - |
997 | | - |
998 | NT-based versions (note that each operating system version is only represented once rather than each Windows edition): | - |
999 | | - |
1000 | \value WV_NT Windows NT (operating system version 4.0) | - |
1001 | \value WV_2000 Windows 2000 (operating system version 5.0) | - |
1002 | \value WV_XP Windows XP (operating system version 5.1) | - |
1003 | \value WV_2003 Windows Server 2003, Windows Server 2003 R2, Windows Home Server, Windows XP Professional x64 Edition (operating system version 5.2) | - |
1004 | \value WV_VISTA Windows Vista, Windows Server 2008 (operating system version 6.0) | - |
1005 | \value WV_WINDOWS7 Windows 7, Windows Server 2008 R2 (operating system version 6.1) | - |
1006 | \value WV_WINDOWS8 Windows 8 (operating system version 6.2) | - |
1007 | | - |
1008 | Alternatively, you may use the following macros which correspond directly to the Windows operating system version number: | - |
1009 | | - |
1010 | \value WV_4_0 Operating system version 4.0, corresponds to Windows NT | - |
1011 | \value WV_5_0 Operating system version 5.0, corresponds to Windows 2000 | - |
1012 | \value WV_5_1 Operating system version 5.1, corresponds to Windows XP | - |
1013 | \value WV_5_2 Operating system version 5.2, corresponds to Windows Server 2003, Windows Server 2003 R2, Windows Home Server, and Windows XP Professional x64 Edition | - |
1014 | \value WV_6_0 Operating system version 6.0, corresponds to Windows Vista and Windows Server 2008 | - |
1015 | \value WV_6_1 Operating system version 6.1, corresponds to Windows 7 and Windows Server 2008 R2 | - |
1016 | \value WV_6_2 Operating system version 6.2, corresponds to Windows 8 | - |
1017 | | - |
1018 | CE-based versions: | - |
1019 | | - |
1020 | \value WV_CE Windows CE | - |
1021 | \value WV_CENET Windows CE .NET | - |
1022 | \value WV_CE_5 Windows CE 5.x | - |
1023 | \value WV_CE_6 Windows CE 6.x | - |
1024 | | - |
1025 | The following masks can be used for testing whether a Windows | - |
1026 | version is MS-DOS-based, NT-based, or CE-based: | - |
1027 | | - |
1028 | \value WV_DOS_based MS-DOS-based version of Windows | - |
1029 | \value WV_NT_based NT-based version of Windows | - |
1030 | \value WV_CE_based CE-based version of Windows | - |
1031 | | - |
1032 | \sa MacVersion | - |
1033 | */ | - |
1034 | | - |
1035 | /*! | - |
1036 | \enum QSysInfo::MacVersion | - |
1037 | | - |
1038 | This enum provides symbolic names for the various versions of the | - |
1039 | Macintosh operating system. On Mac, the | - |
1040 | QSysInfo::MacintoshVersion variable gives the version of the | - |
1041 | system on which the application is run. | - |
1042 | | - |
1043 | \value MV_9 Mac OS 9 (unsupported) | - |
1044 | \value MV_10_0 Mac OS X 10.0 (unsupported) | - |
1045 | \value MV_10_1 Mac OS X 10.1 (unsupported) | - |
1046 | \value MV_10_2 Mac OS X 10.2 (unsupported) | - |
1047 | \value MV_10_3 Mac OS X 10.3 | - |
1048 | \value MV_10_4 Mac OS X 10.4 | - |
1049 | \value MV_10_5 Mac OS X 10.5 | - |
1050 | \value MV_10_6 Mac OS X 10.6 | - |
1051 | \value MV_10_7 Mac OS X 10.7 | - |
1052 | \value MV_10_8 Mac OS X 10.8 | - |
1053 | \value MV_Unknown An unknown and currently unsupported platform | - |
1054 | | - |
1055 | \value MV_CHEETAH Apple codename for MV_10_0 | - |
1056 | \value MV_PUMA Apple codename for MV_10_1 | - |
1057 | \value MV_JAGUAR Apple codename for MV_10_2 | - |
1058 | \value MV_PANTHER Apple codename for MV_10_3 | - |
1059 | \value MV_TIGER Apple codename for MV_10_4 | - |
1060 | \value MV_LEOPARD Apple codename for MV_10_5 | - |
1061 | \value MV_SNOWLEOPARD Apple codename for MV_10_6 | - |
1062 | \value MV_LION Apple codename for MV_10_7 | - |
1063 | \value MV_MOUNTAINLION Apple codename for MV_10_8 | - |
1064 | | - |
1065 | \sa WinVersion | - |
1066 | */ | - |
1067 | | - |
1068 | /*! | - |
1069 | \macro Q_OS_DARWIN | - |
1070 | \relates <QtGlobal> | - |
1071 | | - |
1072 | Defined on Darwin OS (synonym for Q_OS_MAC). | - |
1073 | */ | - |
1074 | | - |
1075 | /*! | - |
1076 | \macro Q_OS_WIN32 | - |
1077 | \relates <QtGlobal> | - |
1078 | | - |
1079 | Defined on all supported versions of Windows. | - |
1080 | */ | - |
1081 | | - |
1082 | /*! | - |
1083 | \macro Q_OS_WINCE | - |
1084 | \relates <QtGlobal> | - |
1085 | | - |
1086 | Defined on Windows CE. | - |
1087 | */ | - |
1088 | | - |
1089 | /*! | - |
1090 | \macro Q_OS_CYGWIN | - |
1091 | \relates <QtGlobal> | - |
1092 | | - |
1093 | Defined on Cygwin. | - |
1094 | */ | - |
1095 | | - |
1096 | /*! | - |
1097 | \macro Q_OS_SOLARIS | - |
1098 | \relates <QtGlobal> | - |
1099 | | - |
1100 | Defined on Sun Solaris. | - |
1101 | */ | - |
1102 | | - |
1103 | /*! | - |
1104 | \macro Q_OS_HPUX | - |
1105 | \relates <QtGlobal> | - |
1106 | | - |
1107 | Defined on HP-UX. | - |
1108 | */ | - |
1109 | | - |
1110 | /*! | - |
1111 | \macro Q_OS_ULTRIX | - |
1112 | \relates <QtGlobal> | - |
1113 | | - |
1114 | Defined on DEC Ultrix. | - |
1115 | */ | - |
1116 | | - |
1117 | /*! | - |
1118 | \macro Q_OS_LINUX | - |
1119 | \relates <QtGlobal> | - |
1120 | | - |
1121 | Defined on Linux. | - |
1122 | */ | - |
1123 | | - |
1124 | /*! | - |
1125 | \macro Q_OS_FREEBSD | - |
1126 | \relates <QtGlobal> | - |
1127 | | - |
1128 | Defined on FreeBSD. | - |
1129 | */ | - |
1130 | | - |
1131 | /*! | - |
1132 | \macro Q_OS_NETBSD | - |
1133 | \relates <QtGlobal> | - |
1134 | | - |
1135 | Defined on NetBSD. | - |
1136 | */ | - |
1137 | | - |
1138 | /*! | - |
1139 | \macro Q_OS_OPENBSD | - |
1140 | \relates <QtGlobal> | - |
1141 | | - |
1142 | Defined on OpenBSD. | - |
1143 | */ | - |
1144 | | - |
1145 | /*! | - |
1146 | \macro Q_OS_BSDI | - |
1147 | \relates <QtGlobal> | - |
1148 | | - |
1149 | Defined on BSD/OS. | - |
1150 | */ | - |
1151 | | - |
1152 | /*! | - |
1153 | \macro Q_OS_IRIX | - |
1154 | \relates <QtGlobal> | - |
1155 | | - |
1156 | Defined on SGI Irix. | - |
1157 | */ | - |
1158 | | - |
1159 | /*! | - |
1160 | \macro Q_OS_OSF | - |
1161 | \relates <QtGlobal> | - |
1162 | | - |
1163 | Defined on HP Tru64 UNIX. | - |
1164 | */ | - |
1165 | | - |
1166 | /*! | - |
1167 | \macro Q_OS_SCO | - |
1168 | \relates <QtGlobal> | - |
1169 | | - |
1170 | Defined on SCO OpenServer 5. | - |
1171 | */ | - |
1172 | | - |
1173 | /*! | - |
1174 | \macro Q_OS_UNIXWARE | - |
1175 | \relates <QtGlobal> | - |
1176 | | - |
1177 | Defined on UnixWare 7, Open UNIX 8. | - |
1178 | */ | - |
1179 | | - |
1180 | /*! | - |
1181 | \macro Q_OS_AIX | - |
1182 | \relates <QtGlobal> | - |
1183 | | - |
1184 | Defined on AIX. | - |
1185 | */ | - |
1186 | | - |
1187 | /*! | - |
1188 | \macro Q_OS_HURD | - |
1189 | \relates <QtGlobal> | - |
1190 | | - |
1191 | Defined on GNU Hurd. | - |
1192 | */ | - |
1193 | | - |
1194 | /*! | - |
1195 | \macro Q_OS_DGUX | - |
1196 | \relates <QtGlobal> | - |
1197 | | - |
1198 | Defined on DG/UX. | - |
1199 | */ | - |
1200 | | - |
1201 | /*! | - |
1202 | \macro Q_OS_RELIANT | - |
1203 | \relates <QtGlobal> | - |
1204 | | - |
1205 | Defined on Reliant UNIX. | - |
1206 | */ | - |
1207 | | - |
1208 | /*! | - |
1209 | \macro Q_OS_DYNIX | - |
1210 | \relates <QtGlobal> | - |
1211 | | - |
1212 | Defined on DYNIX/ptx. | - |
1213 | */ | - |
1214 | | - |
1215 | /*! | - |
1216 | \macro Q_OS_QNX | - |
1217 | \relates <QtGlobal> | - |
1218 | | - |
1219 | Defined on QNX Neutrino. | - |
1220 | */ | - |
1221 | | - |
1222 | /*! | - |
1223 | \macro Q_OS_LYNX | - |
1224 | \relates <QtGlobal> | - |
1225 | | - |
1226 | Defined on LynxOS. | - |
1227 | */ | - |
1228 | | - |
1229 | /*! | - |
1230 | \macro Q_OS_BSD4 | - |
1231 | \relates <QtGlobal> | - |
1232 | | - |
1233 | Defined on Any BSD 4.4 system. | - |
1234 | */ | - |
1235 | | - |
1236 | /*! | - |
1237 | \macro Q_OS_UNIX | - |
1238 | \relates <QtGlobal> | - |
1239 | | - |
1240 | Defined on Any UNIX BSD/SYSV system. | - |
1241 | */ | - |
1242 | | - |
1243 | /*! | - |
1244 | \macro Q_CC_SYM | - |
1245 | \relates <QtGlobal> | - |
1246 | | - |
1247 | Defined if the application is compiled using Digital Mars C/C++ | - |
1248 | (used to be Symantec C++). | - |
1249 | */ | - |
1250 | | - |
1251 | /*! | - |
1252 | \macro Q_CC_MSVC | - |
1253 | \relates <QtGlobal> | - |
1254 | | - |
1255 | Defined if the application is compiled using Microsoft Visual | - |
1256 | C/C++, Intel C++ for Windows. | - |
1257 | */ | - |
1258 | | - |
1259 | /*! | - |
1260 | \macro Q_CC_BOR | - |
1261 | \relates <QtGlobal> | - |
1262 | | - |
1263 | Defined if the application is compiled using Borland/Turbo C++. | - |
1264 | */ | - |
1265 | | - |
1266 | /*! | - |
1267 | \macro Q_CC_WAT | - |
1268 | \relates <QtGlobal> | - |
1269 | | - |
1270 | Defined if the application is compiled using Watcom C++. | - |
1271 | */ | - |
1272 | | - |
1273 | /*! | - |
1274 | \macro Q_CC_GNU | - |
1275 | \relates <QtGlobal> | - |
1276 | | - |
1277 | Defined if the application is compiled using GNU C++. | - |
1278 | */ | - |
1279 | | - |
1280 | /*! | - |
1281 | \macro Q_CC_COMEAU | - |
1282 | \relates <QtGlobal> | - |
1283 | | - |
1284 | Defined if the application is compiled using Comeau C++. | - |
1285 | */ | - |
1286 | | - |
1287 | /*! | - |
1288 | \macro Q_CC_EDG | - |
1289 | \relates <QtGlobal> | - |
1290 | | - |
1291 | Defined if the application is compiled using Edison Design Group | - |
1292 | C++. | - |
1293 | */ | - |
1294 | | - |
1295 | /*! | - |
1296 | \macro Q_CC_OC | - |
1297 | \relates <QtGlobal> | - |
1298 | | - |
1299 | Defined if the application is compiled using CenterLine C++. | - |
1300 | */ | - |
1301 | | - |
1302 | /*! | - |
1303 | \macro Q_CC_SUN | - |
1304 | \relates <QtGlobal> | - |
1305 | | - |
1306 | Defined if the application is compiled using Forte Developer, or | - |
1307 | Sun Studio C++. | - |
1308 | */ | - |
1309 | | - |
1310 | /*! | - |
1311 | \macro Q_CC_MIPS | - |
1312 | \relates <QtGlobal> | - |
1313 | | - |
1314 | Defined if the application is compiled using MIPSpro C++. | - |
1315 | */ | - |
1316 | | - |
1317 | /*! | - |
1318 | \macro Q_CC_DEC | - |
1319 | \relates <QtGlobal> | - |
1320 | | - |
1321 | Defined if the application is compiled using DEC C++. | - |
1322 | */ | - |
1323 | | - |
1324 | /*! | - |
1325 | \macro Q_CC_HPACC | - |
1326 | \relates <QtGlobal> | - |
1327 | | - |
1328 | Defined if the application is compiled using HP aC++. | - |
1329 | */ | - |
1330 | | - |
1331 | /*! | - |
1332 | \macro Q_CC_USLC | - |
1333 | \relates <QtGlobal> | - |
1334 | | - |
1335 | Defined if the application is compiled using SCO OUDK and UDK. | - |
1336 | */ | - |
1337 | | - |
1338 | /*! | - |
1339 | \macro Q_CC_CDS | - |
1340 | \relates <QtGlobal> | - |
1341 | | - |
1342 | Defined if the application is compiled using Reliant C++. | - |
1343 | */ | - |
1344 | | - |
1345 | /*! | - |
1346 | \macro Q_CC_KAI | - |
1347 | \relates <QtGlobal> | - |
1348 | | - |
1349 | Defined if the application is compiled using KAI C++. | - |
1350 | */ | - |
1351 | | - |
1352 | /*! | - |
1353 | \macro Q_CC_INTEL | - |
1354 | \relates <QtGlobal> | - |
1355 | | - |
1356 | Defined if the application is compiled using Intel C++ for Linux, | - |
1357 | Intel C++ for Windows. | - |
1358 | */ | - |
1359 | | - |
1360 | /*! | - |
1361 | \macro Q_CC_HIGHC | - |
1362 | \relates <QtGlobal> | - |
1363 | | - |
1364 | Defined if the application is compiled using MetaWare High C/C++. | - |
1365 | */ | - |
1366 | | - |
1367 | /*! | - |
1368 | \macro Q_CC_PGI | - |
1369 | \relates <QtGlobal> | - |
1370 | | - |
1371 | Defined if the application is compiled using Portland Group C++. | - |
1372 | */ | - |
1373 | | - |
1374 | /*! | - |
1375 | \macro Q_CC_GHS | - |
1376 | \relates <QtGlobal> | - |
1377 | | - |
1378 | Defined if the application is compiled using Green Hills | - |
1379 | Optimizing C++ Compilers. | - |
1380 | */ | - |
1381 | | - |
1382 | /*! | - |
1383 | \macro Q_OS_MAC | - |
1384 | \relates <QtGlobal> | - |
1385 | | - |
1386 | Defined on MAC OS (synonym for Darwin). | - |
1387 | */ | - |
1388 | | - |
1389 | /*! | - |
1390 | \macro Q_PROCESSOR_ALPHA | - |
1391 | \relates <QtGlobal> | - |
1392 | | - |
1393 | Defined if the application is compiled for Alpha processors. | - |
1394 | */ | - |
1395 | | - |
1396 | /*! | - |
1397 | \macro Q_PROCESSOR_ARM | - |
1398 | \relates <QtGlobal> | - |
1399 | | - |
1400 | Defined if the application is compiled for ARM processors. Qt currently | - |
1401 | supports three optional ARM revisions: \l Q_PROCESSOR_ARM_V5, \l | - |
1402 | Q_PROCESSOR_ARM_V6, and \l Q_PROCESSOR_ARM_V7. | - |
1403 | */ | - |
1404 | /*! | - |
1405 | \macro Q_PROCESSOR_ARM_V5 | - |
1406 | \relates <QtGlobal> | - |
1407 | | - |
1408 | Defined if the application is compiled for ARMv5 processors. The \l | - |
1409 | Q_PROCESSOR_ARM macro is also defined when Q_PROCESSOR_ARM_V5 is defined. | - |
1410 | */ | - |
1411 | /*! | - |
1412 | \macro Q_PROCESSOR_ARM_V6 | - |
1413 | \relates <QtGlobal> | - |
1414 | | - |
1415 | Defined if the application is compiled for ARMv6 processors. The \l | - |
1416 | Q_PROCESSOR_ARM and \l Q_PROCESSOR_ARM_V5 macros are also defined when | - |
1417 | Q_PROCESSOR_ARM_V6 is defined. | - |
1418 | */ | - |
1419 | /*! | - |
1420 | \macro Q_PROCESSOR_ARM_V7 | - |
1421 | \relates <QtGlobal> | - |
1422 | | - |
1423 | Defined if the application is compiled for ARMv7 processors. The \l | - |
1424 | Q_PROCESSOR_ARM, \l Q_PROCESSOR_ARM_V5, and \l Q_PROCESSOR_ARM_V6 macros | - |
1425 | are also defined when Q_PROCESSOR_ARM_V7 is defined. | - |
1426 | */ | - |
1427 | | - |
1428 | /*! | - |
1429 | \macro Q_PROCESSOR_AVR32 | - |
1430 | \relates <QtGlobal> | - |
1431 | | - |
1432 | Defined if the application is compiled for AVR32 processors. | - |
1433 | */ | - |
1434 | | - |
1435 | /*! | - |
1436 | \macro Q_PROCESSOR_BLACKFIN | - |
1437 | \relates <QtGlobal> | - |
1438 | | - |
1439 | Defined if the application is compiled for Blackfin processors. | - |
1440 | */ | - |
1441 | | - |
1442 | /*! | - |
1443 | \macro Q_PROCESSOR_IA64 | - |
1444 | \relates <QtGlobal> | - |
1445 | | - |
1446 | Defined if the application is compiled for IA-64 processors. This includes | - |
1447 | all Itanium and Itanium 2 processors. | - |
1448 | */ | - |
1449 | | - |
1450 | /*! | - |
1451 | \macro Q_PROCESSOR_MIPS | - |
1452 | \relates <QtGlobal> | - |
1453 | | - |
1454 | Defined if the application is compiled for MIPS processors. Qt currently | - |
1455 | supports seven MIPS revisions: \l Q_PROCESSOR_MIPS_I, \l | - |
1456 | Q_PROCESSOR_MIPS_II, \l Q_PROCESSOR_MIPS_III, \l Q_PROCESSOR_MIPS_IV, \l | - |
1457 | Q_PROCESSOR_MIPS_V, \l Q_PROCESSOR_MIPS_32, and \l Q_PROCESSOR_MIPS_64. | - |
1458 | */ | - |
1459 | /*! | - |
1460 | \macro Q_PROCESSOR_MIPS_I | - |
1461 | \relates <QtGlobal> | - |
1462 | | - |
1463 | Defined if the application is compiled for MIPS-I processors. The \l | - |
1464 | Q_PROCESSOR_MIPS macro is also defined when Q_PROCESSOR_MIPS_I is defined. | - |
1465 | */ | - |
1466 | /*! | - |
1467 | \macro Q_PROCESSOR_MIPS_II | - |
1468 | \relates <QtGlobal> | - |
1469 | | - |
1470 | Defined if the application is compiled for MIPS-II processors. The \l | - |
1471 | Q_PROCESSOR_MIPS and \l Q_PROCESSOR_MIPS_I macros are also defined when | - |
1472 | Q_PROCESSOR_MIPS_II is defined. | - |
1473 | */ | - |
1474 | /*! | - |
1475 | \macro Q_PROCESSOR_MIPS_32 | - |
1476 | \relates <QtGlobal> | - |
1477 | | - |
1478 | Defined if the application is compiled for MIPS32 processors. The \l | - |
1479 | Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, and \l Q_PROCESSOR_MIPS_II macros | - |
1480 | are also defined when Q_PROCESSOR_MIPS_32 is defined. | - |
1481 | */ | - |
1482 | /*! | - |
1483 | \macro Q_PROCESSOR_MIPS_III | - |
1484 | \relates <QtGlobal> | - |
1485 | | - |
1486 | Defined if the application is compiled for MIPS-III processors. The \l | - |
1487 | Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, and \l Q_PROCESSOR_MIPS_II macros | - |
1488 | are also defined when Q_PROCESSOR_MIPS_III is defined. | - |
1489 | */ | - |
1490 | /*! | - |
1491 | \macro Q_PROCESSOR_MIPS_IV | - |
1492 | \relates <QtGlobal> | - |
1493 | | - |
1494 | Defined if the application is compiled for MIPS-IV processors. The \l | - |
1495 | Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, \l Q_PROCESSOR_MIPS_II, and \l | - |
1496 | Q_PROCESSOR_MIPS_III macros are also defined when Q_PROCESSOR_MIPS_IV is | - |
1497 | defined. | - |
1498 | */ | - |
1499 | /*! | - |
1500 | \macro Q_PROCESSOR_MIPS_V | - |
1501 | \relates <QtGlobal> | - |
1502 | | - |
1503 | Defined if the application is compiled for MIPS-V processors. The \l | - |
1504 | Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, \l Q_PROCESSOR_MIPS_II, \l | - |
1505 | Q_PROCESSOR_MIPS_III, and \l Q_PROCESSOR_MIPS_IV macros are also defined | - |
1506 | when Q_PROCESSOR_MIPS_V is defined. | - |
1507 | */ | - |
1508 | /*! | - |
1509 | \macro Q_PROCESSOR_MIPS_64 | - |
1510 | \relates <QtGlobal> | - |
1511 | | - |
1512 | Defined if the application is compiled for MIPS64 processors. The \l | - |
1513 | Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, \l Q_PROCESSOR_MIPS_II, \l | - |
1514 | Q_PROCESSOR_MIPS_III, \l Q_PROCESSOR_MIPS_IV, and \l Q_PROCESSOR_MIPS_V | - |
1515 | macros are also defined when Q_PROCESSOR_MIPS_64 is defined. | - |
1516 | */ | - |
1517 | | - |
1518 | /*! | - |
1519 | \macro Q_PROCESSOR_POWER | - |
1520 | \relates <QtGlobal> | - |
1521 | | - |
1522 | Defined if the application is compiled for POWER processors. Qt currently | - |
1523 | supports two Power variants: \l Q_PROCESSOR_POWER_32 and \l | - |
1524 | Q_PROCESSOR_POWER_64. | - |
1525 | */ | - |
1526 | /*! | - |
1527 | \macro Q_PROCESSOR_POWER_32 | - |
1528 | \relates <QtGlobal> | - |
1529 | | - |
1530 | Defined if the application is compiled for 32-bit Power processors. The \l | - |
1531 | Q_PROCESSOR_POWER macro is also defined when Q_PROCESSOR_POWER_32 is | - |
1532 | defined. | - |
1533 | */ | - |
1534 | /*! | - |
1535 | \macro Q_PROCESSOR_POWER_64 | - |
1536 | \relates <QtGlobal> | - |
1537 | | - |
1538 | Defined if the application is compiled for 64-bit Power processors. The \l | - |
1539 | Q_PROCESSOR_POWER macro is also defined when Q_PROCESSOR_POWER_64 is | - |
1540 | defined. | - |
1541 | */ | - |
1542 | | - |
1543 | /*! | - |
1544 | \macro Q_PROCESSOR_S390 | - |
1545 | \relates <QtGlobal> | - |
1546 | | - |
1547 | Defined if the application is compiled for S/390 processors. Qt supports | - |
1548 | one optional variant of S/390: Q_PROCESSOR_S390_X. | - |
1549 | */ | - |
1550 | /*! | - |
1551 | \macro Q_PROCESSOR_S390_X | - |
1552 | \relates <QtGlobal> | - |
1553 | | - |
1554 | Defined if the application is compiled for S/390x processors. The \l | - |
1555 | Q_PROCESSOR_S390 macro is also defined when Q_PROCESSOR_S390_X is defined. | - |
1556 | */ | - |
1557 | | - |
1558 | /*! | - |
1559 | \macro Q_PROCESSOR_SH | - |
1560 | \relates <QtGlobal> | - |
1561 | | - |
1562 | Defined if the application is compiled for SuperH processors. Qt currently | - |
1563 | supports one SuperH revision: \l Q_PROCESSOR_SH_4A. | - |
1564 | */ | - |
1565 | /*! | - |
1566 | \macro Q_PROCESSOR_SH_4A | - |
1567 | \relates <QtGlobal> | - |
1568 | | - |
1569 | Defined if the application is compiled for SuperH 4A processors. The \l | - |
1570 | Q_PROCESSOR_SH macro is also defined when Q_PROCESSOR_SH_4A is defined. | - |
1571 | */ | - |
1572 | | - |
1573 | /*! | - |
1574 | \macro Q_PROCESSOR_SPARC | - |
1575 | \relates <QtGlobal> | - |
1576 | | - |
1577 | Defined if the application is compiled for SPARC processors. Qt currently | - |
1578 | supports one optional SPARC revision: \l Q_PROCESSOR_SPARC_V9. | - |
1579 | */ | - |
1580 | /*! | - |
1581 | \macro Q_PROCESSOR_SPARC_V9 | - |
1582 | \relates <QtGlobal> | - |
1583 | | - |
1584 | Defined if the application is compiled for SPARC V9 processors. The \l | - |
1585 | Q_PROCESSOR_SPARC macro is also defined when Q_PROCESSOR_SPARC_V9 is | - |
1586 | defined. | - |
1587 | */ | - |
1588 | | - |
1589 | /*! | - |
1590 | \macro Q_PROCESSOR_X86 | - |
1591 | \relates <QtGlobal> | - |
1592 | | - |
1593 | Defined if the application is compiled for x86 processors. Qt currently | - |
1594 | supports two x86 variants: \l Q_PROCESSOR_X86_32 and \l Q_PROCESSOR_X86_64. | - |
1595 | */ | - |
1596 | /*! | - |
1597 | \macro Q_PROCESSOR_X86_32 | - |
1598 | \relates <QtGlobal> | - |
1599 | | - |
1600 | Defined if the application is compiled for 32-bit x86 processors. This | - |
1601 | includes all i386, i486, i586, and i686 processors. The \l Q_PROCESSOR_X86 | - |
1602 | macro is also defined when Q_PROCESSOR_X86_32 is defined. | - |
1603 | */ | - |
1604 | /*! | - |
1605 | \macro Q_PROCESSOR_X86_64 | - |
1606 | \relates <QtGlobal> | - |
1607 | | - |
1608 | Defined if the application is compiled for 64-bit x86 processors. This | - |
1609 | includes all AMD64, Intel 64, and other x86_64/x64 processors. The \l | - |
1610 | Q_PROCESSOR_X86 macro is also defined when Q_PROCESSOR_X86_64 is defined. | - |
1611 | */ | - |
1612 | | - |
1613 | /*! | - |
1614 | \macro QT_DISABLE_DEPRECATED_BEFORE | - |
1615 | \relates <QtGlobal> | - |
1616 | | - |
1617 | This macro can be defined in the project file to disable functions deprecated in | - |
1618 | a specified version of Qt or any earlier version. The default version number is 5.0, | - |
1619 | meaning that functions deprecated in or before Qt 5.0 will not be included. | - |
1620 | | - |
1621 | Examples: | - |
1622 | When using a future release of Qt 5, set QT_DISABLE_DEPRECATED_BEFORE=0x050100 to | - |
1623 | disable functions deprecated in Qt 5.1 and earlier. In any release, set | - |
1624 | QT_DISABLE_DEPRECATED_BEFORE=0x000000 to enable any functions, including the ones | - |
1625 | deprecated in Qt 5.0 | - |
1626 | */ | - |
1627 | | - |
1628 | #if defined(QT_BUILD_QMAKE) | - |
1629 | // needed to bootstrap qmake | - |
1630 | static const unsigned int qt_one = 1; | - |
1631 | const int QSysInfo::ByteOrder = ((*((unsigned char *) &qt_one) == 0) ? BigEndian : LittleEndian); | - |
1632 | #endif | - |
1633 | | - |
1634 | #if defined(Q_OS_MAC) && !defined(Q_OS_IOS) | - |
1635 | | - |
1636 | QT_BEGIN_INCLUDE_NAMESPACE | - |
1637 | #include "private/qcore_mac_p.h" | - |
1638 | #include "qnamespace.h" | - |
1639 | QT_END_INCLUDE_NAMESPACE | - |
1640 | | - |
1641 | Q_CORE_EXPORT OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref) | - |
1642 | { | - |
1643 | return FSPathMakeRef(reinterpret_cast<const UInt8 *>(file.toUtf8().constData()), fsref, 0); | - |
1644 | } | - |
1645 | | - |
1646 | Q_CORE_EXPORT void qt_mac_to_pascal_string(QString s, Str255 str, TextEncoding encoding=0, int len=-1) | - |
1647 | { | - |
1648 | Q_UNUSED(encoding); | - |
1649 | Q_UNUSED(len); | - |
1650 | CFStringGetPascalString(QCFString(s), str, 256, CFStringGetSystemEncoding()); | - |
1651 | } | - |
1652 | | - |
1653 | Q_CORE_EXPORT QString qt_mac_from_pascal_string(const Str255 pstr) { | - |
1654 | return QCFString(CFStringCreateWithPascalString(0, pstr, CFStringGetSystemEncoding())); | - |
1655 | } | - |
1656 | #endif // defined(Q_OS_MAC) && !defined(Q_OS_IOS) | - |
1657 | | - |
1658 | #if defined(Q_OS_MAC) | - |
1659 | | - |
1660 | QSysInfo::MacVersion QSysInfo::macVersion() | - |
1661 | { | - |
1662 | #ifndef Q_OS_IOS | - |
1663 | SInt32 gestalt_version; | - |
1664 | if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) { | - |
1665 | return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2); | - |
1666 | } | - |
1667 | #endif | - |
1668 | return QSysInfo::MV_Unknown; | - |
1669 | } | - |
1670 | const QSysInfo::MacVersion QSysInfo::MacintoshVersion = QSysInfo::macVersion(); | - |
1671 | | - |
1672 | #elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) | - |
1673 | | - |
1674 | QT_BEGIN_INCLUDE_NAMESPACE | - |
1675 | #include "qt_windows.h" | - |
1676 | QT_END_INCLUDE_NAMESPACE | - |
1677 | | - |
1678 | QSysInfo::WinVersion QSysInfo::windowsVersion() | - |
1679 | { | - |
1680 | #ifndef VER_PLATFORM_WIN32s | - |
1681 | #define VER_PLATFORM_WIN32s 0 | - |
1682 | #endif | - |
1683 | #ifndef VER_PLATFORM_WIN32_WINDOWS | - |
1684 | #define VER_PLATFORM_WIN32_WINDOWS 1 | - |
1685 | #endif | - |
1686 | #ifndef VER_PLATFORM_WIN32_NT | - |
1687 | #define VER_PLATFORM_WIN32_NT 2 | - |
1688 | #endif | - |
1689 | #ifndef VER_PLATFORM_WIN32_CE | - |
1690 | #define VER_PLATFORM_WIN32_CE 3 | - |
1691 | #endif | - |
1692 | | - |
1693 | static QSysInfo::WinVersion winver; | - |
1694 | if (winver) | - |
1695 | return winver; | - |
1696 | winver = QSysInfo::WV_NT; | - |
1697 | OSVERSIONINFO osver; | - |
1698 | osver.dwOSVersionInfoSize = sizeof(osver); | - |
1699 | GetVersionEx(&osver); | - |
1700 | #ifdef Q_OS_WINCE | - |
1701 | DWORD qt_cever = 0; | - |
1702 | qt_cever = osver.dwMajorVersion * 100; | - |
1703 | qt_cever += osver.dwMinorVersion * 10; | - |
1704 | #endif | - |
1705 | switch (osver.dwPlatformId) { | - |
1706 | case VER_PLATFORM_WIN32s: | - |
1707 | winver = QSysInfo::WV_32s; | - |
1708 | break; | - |
1709 | case VER_PLATFORM_WIN32_WINDOWS: | - |
1710 | // We treat Windows Me (minor 90) the same as Windows 98 | - |
1711 | if (osver.dwMinorVersion == 90) | - |
1712 | winver = QSysInfo::WV_Me; | - |
1713 | else if (osver.dwMinorVersion == 10) | - |
1714 | winver = QSysInfo::WV_98; | - |
1715 | else | - |
1716 | winver = QSysInfo::WV_95; | - |
1717 | break; | - |
1718 | #ifdef Q_OS_WINCE | - |
1719 | case VER_PLATFORM_WIN32_CE: | - |
1720 | if (qt_cever >= 600) | - |
1721 | winver = QSysInfo::WV_CE_6; | - |
1722 | if (qt_cever >= 500) | - |
1723 | winver = QSysInfo::WV_CE_5; | - |
1724 | else if (qt_cever >= 400) | - |
1725 | winver = QSysInfo::WV_CENET; | - |
1726 | else | - |
1727 | winver = QSysInfo::WV_CE; | - |
1728 | break; | - |
1729 | #endif | - |
1730 | default: // VER_PLATFORM_WIN32_NT | - |
1731 | if (osver.dwMajorVersion < 5) { | - |
1732 | winver = QSysInfo::WV_NT; | - |
1733 | } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 0) { | - |
1734 | winver = QSysInfo::WV_2000; | - |
1735 | } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 1) { | - |
1736 | winver = QSysInfo::WV_XP; | - |
1737 | } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 2) { | - |
1738 | winver = QSysInfo::WV_2003; | - |
1739 | } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 0) { | - |
1740 | winver = QSysInfo::WV_VISTA; | - |
1741 | } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 1) { | - |
1742 | winver = QSysInfo::WV_WINDOWS7; | - |
1743 | } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 2) { | - |
1744 | winver = QSysInfo::WV_WINDOWS8; | - |
1745 | } else { | - |
1746 | qWarning("Qt: Untested Windows version %d.%d detected!", | - |
1747 | int(osver.dwMajorVersion), int(osver.dwMinorVersion)); | - |
1748 | winver = QSysInfo::WV_NT_based; | - |
1749 | } | - |
1750 | } | - |
1751 | | - |
1752 | #ifdef QT_DEBUG | - |
1753 | { | - |
1754 | QByteArray override = qgetenv("QT_WINVER_OVERRIDE"); | - |
1755 | if (override.isEmpty()) | - |
1756 | return winver; | - |
1757 | | - |
1758 | if (override == "Me") | - |
1759 | winver = QSysInfo::WV_Me; | - |
1760 | if (override == "95") | - |
1761 | winver = QSysInfo::WV_95; | - |
1762 | else if (override == "98") | - |
1763 | winver = QSysInfo::WV_98; | - |
1764 | else if (override == "NT") | - |
1765 | winver = QSysInfo::WV_NT; | - |
1766 | else if (override == "2000") | - |
1767 | winver = QSysInfo::WV_2000; | - |
1768 | else if (override == "2003") | - |
1769 | winver = QSysInfo::WV_2003; | - |
1770 | else if (override == "XP") | - |
1771 | winver = QSysInfo::WV_XP; | - |
1772 | else if (override == "VISTA") | - |
1773 | winver = QSysInfo::WV_VISTA; | - |
1774 | else if (override == "WINDOWS7") | - |
1775 | winver = QSysInfo::WV_WINDOWS7; | - |
1776 | else if (override == "WINDOWS8") | - |
1777 | winver = QSysInfo::WV_WINDOWS8; | - |
1778 | } | - |
1779 | #endif | - |
1780 | | - |
1781 | return winver; | - |
1782 | } | - |
1783 | | - |
1784 | const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion(); | - |
1785 | | - |
1786 | #endif | - |
1787 | | - |
1788 | /*! | - |
1789 | \macro void Q_ASSERT(bool test) | - |
1790 | \relates <QtGlobal> | - |
1791 | | - |
1792 | Prints a warning message containing the source code file name and | - |
1793 | line number if \a test is false. | - |
1794 | | - |
1795 | Q_ASSERT() is useful for testing pre- and post-conditions | - |
1796 | during development. It does nothing if \c QT_NO_DEBUG was defined | - |
1797 | during compilation. | - |
1798 | | - |
1799 | Example: | - |
1800 | | - |
1801 | \snippet code/src_corelib_global_qglobal.cpp 17 | - |
1802 | | - |
1803 | If \c b is zero, the Q_ASSERT statement will output the following | - |
1804 | message using the qFatal() function: | - |
1805 | | - |
1806 | \snippet code/src_corelib_global_qglobal.cpp 18 | - |
1807 | | - |
1808 | \sa Q_ASSERT_X(), qFatal(), {Debugging Techniques} | - |
1809 | */ | - |
1810 | | - |
1811 | /*! | - |
1812 | \macro void Q_ASSERT_X(bool test, const char *where, const char *what) | - |
1813 | \relates <QtGlobal> | - |
1814 | | - |
1815 | Prints the message \a what together with the location \a where, | - |
1816 | the source file name and line number if \a test is false. | - |
1817 | | - |
1818 | Q_ASSERT_X is useful for testing pre- and post-conditions during | - |
1819 | development. It does nothing if \c QT_NO_DEBUG was defined during | - |
1820 | compilation. | - |
1821 | | - |
1822 | Example: | - |
1823 | | - |
1824 | \snippet code/src_corelib_global_qglobal.cpp 19 | - |
1825 | | - |
1826 | If \c b is zero, the Q_ASSERT_X statement will output the following | - |
1827 | message using the qFatal() function: | - |
1828 | | - |
1829 | \snippet code/src_corelib_global_qglobal.cpp 20 | - |
1830 | | - |
1831 | \sa Q_ASSERT(), qFatal(), {Debugging Techniques} | - |
1832 | */ | - |
1833 | | - |
1834 | /*! | - |
1835 | \macro void Q_ASSUME(bool expr) | - |
1836 | \relates <QtGlobal> | - |
1837 | \since 5.0 | - |
1838 | | - |
1839 | Causes the compiler to assume that \a expr is true. This macro is useful | - |
1840 | for improving code generation, by providing the compiler with hints about | - |
1841 | conditions that it would not otherwise know about. However, there is no | - |
1842 | guarantee that the compiler will actually use those hints. | - |
1843 | | - |
1844 | This macro could be considered a "lighter" version of \l{Q_ASSERT}. While | - |
1845 | Q_ASSERT will abort the program's execution if the condition is false, | - |
1846 | Q_ASSUME will tell the compiler not to generate code for those conditions. | - |
1847 | Therefore, it is important that the assumptions always hold, otherwise | - |
1848 | undefined behaviour may occur. | - |
1849 | | - |
1850 | If \a expr is a constantly false condition, Q_ASSUME will tell the compiler | - |
1851 | that the current code execution cannot be reached. That is, Q_ASSUME(false) | - |
1852 | is equivalent to Q_UNREACHABLE(). | - |
1853 | | - |
1854 | In debug builds the condition is enforced by an assert to facilitate debugging. | - |
1855 | | - |
1856 | \note Q_LIKELY() tells the compiler that the expression is likely, but not | - |
1857 | the only possibility. Q_ASSUME tells the compiler that it is the only | - |
1858 | possibility. | - |
1859 | | - |
1860 | \sa Q_ASSERT(), Q_UNREACHABLE(), Q_LIKELY() | - |
1861 | */ | - |
1862 | | - |
1863 | /*! | - |
1864 | \macro void Q_UNREACHABLE() | - |
1865 | \relates <QtGlobal> | - |
1866 | \since 5.0 | - |
1867 | | - |
1868 | Tells the compiler that the current point cannot be reached by any | - |
1869 | execution, so it may optimize any code paths leading here as dead code, as | - |
1870 | well as code continuing from here. | - |
1871 | | - |
1872 | This macro is useful to mark impossible conditions. For example, given the | - |
1873 | following enum: | - |
1874 | | - |
1875 | \snippet code/src_corelib_global_qglobal.cpp qunreachable-enum | - |
1876 | | - |
1877 | One can write a switch table like so: | - |
1878 | | - |
1879 | \snippet code/src_corelib_global_qglobal.cpp qunreachable-switch | - |
1880 | | - |
1881 | The advantage of inserting Q_UNREACHABLE() at that point is that the | - |
1882 | compiler is told not to generate code for a shape variable containing that | - |
1883 | value. If the macro is missing, the compiler will still generate the | - |
1884 | necessary comparisons for that value. If the case label were removed, some | - |
1885 | compilers could produce a warning that some enum values were not checked. | - |
1886 | | - |
1887 | By using this macro in impossible conditions, code coverage may be improved | - |
1888 | as dead code paths may be eliminated. | - |
1889 | | - |
1890 | In debug builds the condition is enforced by an assert to facilitate debugging. | - |
1891 | | - |
1892 | \sa Q_ASSERT(), Q_ASSUME(), qFatal() | - |
1893 | */ | - |
1894 | | - |
1895 | /*! | - |
1896 | \macro void Q_CHECK_PTR(void *pointer) | - |
1897 | \relates <QtGlobal> | - |
1898 | | - |
1899 | If \a pointer is 0, prints a warning message containing the source | - |
1900 | code's file name and line number, saying that the program ran out | - |
1901 | of memory. | - |
1902 | | - |
1903 | Q_CHECK_PTR does nothing if \c QT_NO_DEBUG was defined during | - |
1904 | compilation. | - |
1905 | | - |
1906 | Example: | - |
1907 | | - |
1908 | \snippet code/src_corelib_global_qglobal.cpp 21 | - |
1909 | | - |
1910 | \sa qWarning(), {Debugging Techniques} | - |
1911 | */ | - |
1912 | | - |
1913 | /*! | - |
1914 | \fn T *q_check_ptr(T *pointer) | - |
1915 | \relates <QtGlobal> | - |
1916 | | - |
1917 | Uses Q_CHECK_PTR on \a pointer, then returns \a pointer. | - |
1918 | | - |
1919 | This can be used as an inline version of Q_CHECK_PTR. | - |
1920 | */ | - |
1921 | | - |
1922 | /*! | - |
1923 | \macro const char* Q_FUNC_INFO() | - |
1924 | \relates <QtGlobal> | - |
1925 | | - |
1926 | Expands to a string that describe the function the macro resides in. How this string looks | - |
1927 | more specifically is compiler dependent. With GNU GCC it is typically the function signature, | - |
1928 | while with other compilers it might be the line and column number. | - |
1929 | | - |
1930 | Q_FUNC_INFO can be conveniently used with qDebug(). For example, this function: | - |
1931 | | - |
1932 | \snippet code/src_corelib_global_qglobal.cpp 22 | - |
1933 | | - |
1934 | when instantiated with the integer type, will with the GCC compiler produce: | - |
1935 | | - |
1936 | \tt{const TInputType& myMin(const TInputType&, const TInputType&) [with TInputType = int] was called with value1: 3 value2: 4} | - |
1937 | | - |
1938 | If this macro is used outside a function, the behavior is undefined. | - |
1939 | */ | - |
1940 | | - |
1941 | /* | - |
1942 | The Q_CHECK_PTR macro calls this function if an allocation check | - |
1943 | fails. | - |
1944 | */ | - |
1945 | void qt_check_pointer(const char *n, int l) | - |
1946 | { | - |
1947 | qFatal("In file %s, line %d: Out of memory", n, l); never executed (the execution status of this line is deduced): QMessageLogger("global/qglobal.cpp", 1947, __PRETTY_FUNCTION__).fatal("In file %s, line %d: Out of memory", n, l); | - |
1948 | } | 0 |
1949 | | - |
1950 | /* | - |
1951 | \internal | - |
1952 | Allows you to throw an exception without including <new> | - |
1953 | Called internally from Q_CHECK_PTR on certain OS combinations | - |
1954 | */ | - |
1955 | void qBadAlloc() | - |
1956 | { | - |
1957 | QT_THROW(std::bad_alloc()); executed: throw std::bad_alloc(); Execution Count:2 | 2 |
1958 | } | - |
1959 | | - |
1960 | #ifndef QT_NO_EXCEPTIONS | - |
1961 | /* | - |
1962 | \internal | - |
1963 | Allows you to call std::terminate() without including <exception>. | - |
1964 | Called internally from QT_TERMINATE_ON_EXCEPTION | - |
1965 | */ | - |
1966 | Q_NORETURN void qTerminate() Q_DECL_NOTHROW | - |
1967 | { | - |
1968 | std::terminate(); never executed (the execution status of this line is deduced): std::terminate(); | - |
1969 | } | 0 |
1970 | #endif | - |
1971 | | - |
1972 | /* | - |
1973 | The Q_ASSERT macro calls this function when the test fails. | - |
1974 | */ | - |
1975 | void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW | - |
1976 | { | - |
1977 | qFatal("ASSERT: \"%s\" in file %s, line %d", assertion, file, line); never executed (the execution status of this line is deduced): QMessageLogger("global/qglobal.cpp", 1977, __PRETTY_FUNCTION__).fatal("ASSERT: \"%s\" in file %s, line %d", assertion, file, line); | - |
1978 | } | 0 |
1979 | | - |
1980 | /* | - |
1981 | The Q_ASSERT_X macro calls this function when the test fails. | - |
1982 | */ | - |
1983 | void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW | - |
1984 | { | - |
1985 | qFatal("ASSERT failure in %s: \"%s\", file %s, line %d", where, what, file, line); never executed (the execution status of this line is deduced): QMessageLogger("global/qglobal.cpp", 1985, __PRETTY_FUNCTION__).fatal("ASSERT failure in %s: \"%s\", file %s, line %d", where, what, file, line); | - |
1986 | } | 0 |
1987 | | - |
1988 | | - |
1989 | /* | - |
1990 | Dijkstra's bisection algorithm to find the square root of an integer. | - |
1991 | Deliberately not exported as part of the Qt API, but used in both | - |
1992 | qsimplerichtext.cpp and qgfxraster_qws.cpp | - |
1993 | */ | - |
1994 | Q_CORE_EXPORT unsigned int qt_int_sqrt(unsigned int n) | - |
1995 | { | - |
1996 | // n must be in the range 0...UINT_MAX/2-1 | - |
1997 | if (n >= (UINT_MAX>>2)) { partially evaluated: n >= ((2147483647 * 2U + 1U)>>2) no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
1998 | unsigned int r = 2 * qt_int_sqrt(n / 4); never executed (the execution status of this line is deduced): unsigned int r = 2 * qt_int_sqrt(n / 4); | - |
1999 | unsigned int r2 = r + 1; never executed (the execution status of this line is deduced): unsigned int r2 = r + 1; | - |
2000 | return (n >= r2 * r2) ? r2 : r; never executed: return (n >= r2 * r2) ? r2 : r; | 0 |
2001 | } | - |
2002 | uint h, p= 0, q= 1, r= n; executed (the execution status of this line is deduced): uint h, p= 0, q= 1, r= n; | - |
2003 | while (q <= n) evaluated: q <= n yes Evaluation Count:122 | yes Evaluation Count:13 |
| 13-122 |
2004 | q <<= 2; executed: q <<= 2; Execution Count:122 | 122 |
2005 | while (q != 1) { evaluated: q != 1 yes Evaluation Count:122 | yes Evaluation Count:13 |
| 13-122 |
2006 | q >>= 2; executed (the execution status of this line is deduced): q >>= 2; | - |
2007 | h= p + q; executed (the execution status of this line is deduced): h= p + q; | - |
2008 | p >>= 1; executed (the execution status of this line is deduced): p >>= 1; | - |
2009 | if (r >= h) { evaluated: r >= h yes Evaluation Count:76 | yes Evaluation Count:46 |
| 46-76 |
2010 | p += q; executed (the execution status of this line is deduced): p += q; | - |
2011 | r -= h; executed (the execution status of this line is deduced): r -= h; | - |
2012 | } executed: } Execution Count:76 | 76 |
2013 | } executed: } Execution Count:122 | 122 |
2014 | return p; executed: return p; Execution Count:13 | 13 |
2015 | } | - |
2016 | | - |
2017 | void *qMemCopy(void *dest, const void *src, size_t n) { return memcpy(dest, src, n); } never executed: return memcpy(dest, src, n); | 0 |
2018 | void *qMemSet(void *dest, int c, size_t n) { return memset(dest, c, n); } never executed: return memset(dest, c, n); | 0 |
2019 | | - |
2020 | #if !defined(Q_OS_WIN) && !defined(QT_NO_THREAD) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \ | - |
2021 | defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L | - |
2022 | namespace { | - |
2023 | // There are two incompatible versions of strerror_r: | - |
2024 | // a) the XSI/POSIX.1 version, which returns an int, | - |
2025 | // indicating success or not | - |
2026 | // b) the GNU version, which returns a char*, which may or may not | - |
2027 | // be the beginning of the buffer we used | - |
2028 | // The GNU libc manpage for strerror_r says you should use the XSI | - |
2029 | // version in portable code. However, it's impossible to do that if | - |
2030 | // _GNU_SOURCE is defined so we use C++ overloading to decide what to do | - |
2031 | // depending on the return type | - |
2032 | static inline QString fromstrerror_helper(int, const QByteArray &buf) | - |
2033 | { | - |
2034 | return QString::fromLocal8Bit(buf); never executed: return QString::fromLocal8Bit(buf); | 0 |
2035 | } | - |
2036 | static inline QString fromstrerror_helper(const char *str, const QByteArray &) | - |
2037 | { | - |
2038 | return QString::fromLocal8Bit(str); executed: return QString::fromLocal8Bit(str); Execution Count:12 | 12 |
2039 | } | - |
2040 | } | - |
2041 | #endif | - |
2042 | | - |
2043 | QString qt_error_string(int errorCode) | - |
2044 | { | - |
2045 | const char *s = 0; executed (the execution status of this line is deduced): const char *s = 0; | - |
2046 | QString ret; executed (the execution status of this line is deduced): QString ret; | - |
2047 | if (errorCode == -1) { partially evaluated: errorCode == -1 no Evaluation Count:0 | yes Evaluation Count:3104 |
| 0-3104 |
2048 | #if defined(Q_OS_WIN) | - |
2049 | errorCode = GetLastError(); | - |
2050 | #else | - |
2051 | errorCode = errno; never executed (the execution status of this line is deduced): errorCode = (*__errno_location ()); | - |
2052 | #endif | - |
2053 | } | 0 |
2054 | switch (errorCode) { | - |
2055 | case 0: | - |
2056 | break; | 0 |
2057 | case EACCES: | - |
2058 | s = QT_TRANSLATE_NOOP("QIODevice", "Permission denied"); executed (the execution status of this line is deduced): s = "Permission denied"; | - |
2059 | break; executed: break; Execution Count:44 | 44 |
2060 | case EMFILE: | - |
2061 | s = QT_TRANSLATE_NOOP("QIODevice", "Too many open files"); never executed (the execution status of this line is deduced): s = "Too many open files"; | - |
2062 | break; | 0 |
2063 | case ENOENT: | - |
2064 | s = QT_TRANSLATE_NOOP("QIODevice", "No such file or directory"); executed (the execution status of this line is deduced): s = "No such file or directory"; | - |
2065 | break; executed: break; Execution Count:3042 | 3042 |
2066 | case ENOSPC: | - |
2067 | s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device"); executed (the execution status of this line is deduced): s = "No space left on device"; | - |
2068 | break; executed: break; Execution Count:6 | 6 |
2069 | default: { | - |
2070 | #ifdef Q_OS_WIN | - |
2071 | wchar_t *string = 0; | - |
2072 | FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, | - |
2073 | NULL, | - |
2074 | errorCode, | - |
2075 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | - |
2076 | (LPWSTR)&string, | - |
2077 | 0, | - |
2078 | NULL); | - |
2079 | ret = QString::fromWCharArray(string); | - |
2080 | LocalFree((HLOCAL)string); | - |
2081 | | - |
2082 | if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND) | - |
2083 | ret = QString::fromLatin1("The specified module could not be found."); | - |
2084 | #elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) | - |
2085 | QByteArray buf(1024, '\0'); executed (the execution status of this line is deduced): QByteArray buf(1024, '\0'); | - |
2086 | ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf); executed (the execution status of this line is deduced): ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf); | - |
2087 | #else | - |
2088 | ret = QString::fromLocal8Bit(strerror(errorCode)); | - |
2089 | #endif | - |
2090 | break; } executed: break; Execution Count:12 | 12 |
2091 | } | - |
2092 | if (s) evaluated: s yes Evaluation Count:3092 | yes Evaluation Count:12 |
| 12-3092 |
2093 | // ######## this breaks moc build currently | - |
2094 | // ret = QCoreApplication::translate("QIODevice", s); | - |
2095 | ret = QString::fromLatin1(s); executed: ret = QString::fromLatin1(s); Execution Count:3092 | 3092 |
2096 | return ret.trimmed(); executed: return ret.trimmed(); Execution Count:3104 | 3104 |
2097 | } | - |
2098 | | - |
2099 | // getenv is declared as deprecated in VS2005. This function | - |
2100 | // makes use of the new secure getenv function. | - |
2101 | /*! | - |
2102 | \relates <QtGlobal> | - |
2103 | | - |
2104 | Returns the value of the environment variable with name \a | - |
2105 | varName. To get the variable string, use QByteArray::constData(). | - |
2106 | | - |
2107 | \note qgetenv() was introduced because getenv() from the standard | - |
2108 | C library was deprecated in VC2005 (and later versions). qgetenv() | - |
2109 | uses the new replacement function in VC, and calls the standard C | - |
2110 | library's implementation on all other platforms. | - |
2111 | | - |
2112 | \sa qputenv() | - |
2113 | */ | - |
2114 | QByteArray qgetenv(const char *varName) | - |
2115 | { | - |
2116 | #if defined(_MSC_VER) && _MSC_VER >= 1400 | - |
2117 | size_t requiredSize = 0; | - |
2118 | QByteArray buffer; | - |
2119 | getenv_s(&requiredSize, 0, 0, varName); | - |
2120 | if (requiredSize == 0) | - |
2121 | return buffer; | - |
2122 | buffer.resize(int(requiredSize)); | - |
2123 | getenv_s(&requiredSize, buffer.data(), requiredSize, varName); | - |
2124 | // requiredSize includes the terminating null, which we don't want. | - |
2125 | Q_ASSERT(buffer.endsWith('\0')); | - |
2126 | buffer.chop(1); | - |
2127 | return buffer; | - |
2128 | #else | - |
2129 | return QByteArray(::getenv(varName)); executed: return QByteArray(::getenv(varName)); Execution Count:9260 | 9260 |
2130 | #endif | - |
2131 | } | - |
2132 | | - |
2133 | /*! | - |
2134 | \relates <QtGlobal> | - |
2135 | \internal | - |
2136 | | - |
2137 | This function checks whether the environment variable \a varName | - |
2138 | is empty. | - |
2139 | | - |
2140 | Equivalent to | - |
2141 | \code | - |
2142 | qgetenv(varName).isEmpty() | - |
2143 | \endcode | - |
2144 | except that it's potentially much faster, and can't throw exceptions. | - |
2145 | | - |
2146 | \sa qgetenv(), qEnvironmentVariableIsSet() | - |
2147 | */ | - |
2148 | bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT | - |
2149 | { | - |
2150 | #if defined(_MSC_VER) && _MSC_VER >= 1400 | - |
2151 | // we provide a buffer that can only hold the empty string, so | - |
2152 | // when the env.var isn't empty, we'll get an ERANGE error (buffer | - |
2153 | // too small): | - |
2154 | size_t dummy; | - |
2155 | char buffer = '\0'; | - |
2156 | return getenv_s(&dummy, &buffer, 1, varName) != ERANGE; | - |
2157 | #else | - |
2158 | const char * const value = ::getenv(varName); executed (the execution status of this line is deduced): const char * const value = ::getenv(varName); | - |
2159 | return !value || !*value; executed: return !value || !*value; Execution Count:5152476 | 5152476 |
2160 | #endif | - |
2161 | } | - |
2162 | | - |
2163 | /*! | - |
2164 | \relates <QtGlobal> | - |
2165 | \internal | - |
2166 | | - |
2167 | This function checks whether the environment variable \a varName | - |
2168 | is set. | - |
2169 | | - |
2170 | Equivalent to | - |
2171 | \code | - |
2172 | !qgetenv(varName).isNull() | - |
2173 | \endcode | - |
2174 | except that it's potentially much faster, and can't throw exceptions. | - |
2175 | | - |
2176 | \sa qgetenv(), qEnvironmentVariableIsEmpty() | - |
2177 | */ | - |
2178 | bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT | - |
2179 | { | - |
2180 | #if defined(_MSC_VER) && _MSC_VER >= 1400 | - |
2181 | size_t requiredSize = 0; | - |
2182 | (void)getenv_s(&requiredSize, 0, 0, varName); | - |
2183 | return requiredSize != 0; | - |
2184 | #else | - |
2185 | return ::getenv(varName) != 0; executed: return ::getenv(varName) != 0; Execution Count:244 | 244 |
2186 | #endif | - |
2187 | } | - |
2188 | | - |
2189 | /*! | - |
2190 | \relates <QtGlobal> | - |
2191 | | - |
2192 | This function sets the \a value of the environment variable named | - |
2193 | \a varName. It will create the variable if it does not exist. It | - |
2194 | returns 0 if the variable could not be set. | - |
2195 | | - |
2196 | \note qputenv() was introduced because putenv() from the standard | - |
2197 | C library was deprecated in VC2005 (and later versions). qputenv() | - |
2198 | uses the replacement function in VC, and calls the standard C | - |
2199 | library's implementation on all other platforms. | - |
2200 | | - |
2201 | \sa qgetenv() | - |
2202 | */ | - |
2203 | bool qputenv(const char *varName, const QByteArray& value) | - |
2204 | { | - |
2205 | #if defined(_MSC_VER) && _MSC_VER >= 1400 | - |
2206 | return _putenv_s(varName, value.constData()) == 0; | - |
2207 | #elif defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L | - |
2208 | // POSIX.1-2001 has setenv | - |
2209 | return setenv(varName, value.constData(), true) == 0; executed: return setenv(varName, value.constData(), true) == 0; Execution Count:192 | 192 |
2210 | #else | - |
2211 | QByteArray buffer(varName); | - |
2212 | buffer += '='; | - |
2213 | buffer += value; | - |
2214 | char* envVar = qstrdup(buffer.constData()); | - |
2215 | int result = putenv(envVar); | - |
2216 | if (result != 0) // error. we have to delete the string. | - |
2217 | delete[] envVar; | - |
2218 | return result == 0; | - |
2219 | #endif | - |
2220 | } | - |
2221 | | - |
2222 | #if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) | - |
2223 | | - |
2224 | # if defined(Q_OS_INTEGRITY) && defined(__GHS_VERSION_NUMBER) && (__GHS_VERSION_NUMBER < 500) | - |
2225 | // older versions of INTEGRITY used a long instead of a uint for the seed. | - |
2226 | typedef long SeedStorageType; | - |
2227 | # else | - |
2228 | typedef uint SeedStorageType; | - |
2229 | # endif | - |
2230 | | - |
2231 | typedef QThreadStorage<SeedStorageType *> SeedStorage; | - |
2232 | Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:6964240 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:21 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:21 | yes Evaluation Count:6964219 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:21 | no Evaluation Count:0 |
| 0-6964240 |
2233 | | - |
2234 | #endif | - |
2235 | | - |
2236 | /*! | - |
2237 | \relates <QtGlobal> | - |
2238 | \since 4.2 | - |
2239 | | - |
2240 | Thread-safe version of the standard C++ \c srand() function. | - |
2241 | | - |
2242 | Sets the argument \a seed to be used to generate a new random number sequence of | - |
2243 | pseudo random integers to be returned by qrand(). | - |
2244 | | - |
2245 | The sequence of random numbers generated is deterministic per thread. For example, | - |
2246 | if two threads call qsrand(1) and subsequently calls qrand(), the threads will get | - |
2247 | the same random number sequence. | - |
2248 | | - |
2249 | \sa qrand() | - |
2250 | */ | - |
2251 | void qsrand(uint seed) | - |
2252 | { | - |
2253 | #if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) | - |
2254 | SeedStorage *seedStorage = randTLS(); executed (the execution status of this line is deduced): SeedStorage *seedStorage = randTLS(); | - |
2255 | if (seedStorage) { partially evaluated: seedStorage yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
2256 | SeedStorageType *pseed = seedStorage->localData(); executed (the execution status of this line is deduced): SeedStorageType *pseed = seedStorage->localData(); | - |
2257 | if (!pseed) evaluated: !pseed yes Evaluation Count:23 | yes Evaluation Count:4 |
| 4-23 |
2258 | seedStorage->setLocalData(pseed = new SeedStorageType); executed: seedStorage->setLocalData(pseed = new SeedStorageType); Execution Count:23 | 23 |
2259 | *pseed = seed; executed (the execution status of this line is deduced): *pseed = seed; | - |
2260 | } else { executed: } Execution Count:27 | 27 |
2261 | //global static seed storage should always exist, | - |
2262 | //except after being deleted by QGlobalStaticDeleter. | - |
2263 | //But since it still can be called from destructor of another | - |
2264 | //global static object, fallback to srand(seed) | - |
2265 | srand(seed); never executed (the execution status of this line is deduced): srand(seed); | - |
2266 | } | 0 |
2267 | #else | - |
2268 | // On Windows srand() and rand() already use Thread-Local-Storage | - |
2269 | // to store the seed between calls | - |
2270 | // this is also valid for QT_NO_THREAD | - |
2271 | srand(seed); | - |
2272 | #endif | - |
2273 | } | - |
2274 | | - |
2275 | /*! | - |
2276 | \relates <QtGlobal> | - |
2277 | \since 4.2 | - |
2278 | | - |
2279 | Thread-safe version of the standard C++ \c rand() function. | - |
2280 | | - |
2281 | Returns a value between 0 and \c RAND_MAX (defined in \c <cstdlib> and | - |
2282 | \c <stdlib.h>), the next number in the current sequence of pseudo-random | - |
2283 | integers. | - |
2284 | | - |
2285 | Use \c qsrand() to initialize the pseudo-random number generator with | - |
2286 | a seed value. | - |
2287 | | - |
2288 | \sa qsrand() | - |
2289 | */ | - |
2290 | int qrand() | - |
2291 | { | - |
2292 | #if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) | - |
2293 | SeedStorage *seedStorage = randTLS(); executed (the execution status of this line is deduced): SeedStorage *seedStorage = randTLS(); | - |
2294 | if (seedStorage) { partially evaluated: seedStorage yes Evaluation Count:6964213 | no Evaluation Count:0 |
| 0-6964213 |
2295 | SeedStorageType *pseed = seedStorage->localData(); executed (the execution status of this line is deduced): SeedStorageType *pseed = seedStorage->localData(); | - |
2296 | if (!pseed) { evaluated: !pseed yes Evaluation Count:536 | yes Evaluation Count:6963677 |
| 536-6963677 |
2297 | seedStorage->setLocalData(pseed = new SeedStorageType); executed (the execution status of this line is deduced): seedStorage->setLocalData(pseed = new SeedStorageType); | - |
2298 | *pseed = 1; executed (the execution status of this line is deduced): *pseed = 1; | - |
2299 | } executed: } Execution Count:536 | 536 |
2300 | return rand_r(pseed); executed: return rand_r(pseed); Execution Count:6964213 | 6964213 |
2301 | } else { | - |
2302 | //global static seed storage should always exist, | - |
2303 | //except after being deleted by QGlobalStaticDeleter. | - |
2304 | //But since it still can be called from destructor of another | - |
2305 | //global static object, fallback to rand() | - |
2306 | return rand(); never executed: return rand(); | 0 |
2307 | } | - |
2308 | #else | - |
2309 | // On Windows srand() and rand() already use Thread-Local-Storage | - |
2310 | // to store the seed between calls | - |
2311 | // this is also valid for QT_NO_THREAD | - |
2312 | return rand(); | - |
2313 | #endif | - |
2314 | } | - |
2315 | | - |
2316 | /*! | - |
2317 | \macro forever | - |
2318 | \relates <QtGlobal> | - |
2319 | | - |
2320 | This macro is provided for convenience for writing infinite | - |
2321 | loops. | - |
2322 | | - |
2323 | Example: | - |
2324 | | - |
2325 | \snippet code/src_corelib_global_qglobal.cpp 31 | - |
2326 | | - |
2327 | It is equivalent to \c{for (;;)}. | - |
2328 | | - |
2329 | If you're worried about namespace pollution, you can disable this | - |
2330 | macro by adding the following line to your \c .pro file: | - |
2331 | | - |
2332 | \snippet code/src_corelib_global_qglobal.cpp 32 | - |
2333 | | - |
2334 | \sa Q_FOREVER | - |
2335 | */ | - |
2336 | | - |
2337 | /*! | - |
2338 | \macro Q_FOREVER | - |
2339 | \relates <QtGlobal> | - |
2340 | | - |
2341 | Same as \l{forever}. | - |
2342 | | - |
2343 | This macro is available even when \c no_keywords is specified | - |
2344 | using the \c .pro file's \c CONFIG variable. | - |
2345 | | - |
2346 | \sa foreach() | - |
2347 | */ | - |
2348 | | - |
2349 | /*! | - |
2350 | \macro foreach(variable, container) | - |
2351 | \relates <QtGlobal> | - |
2352 | | - |
2353 | This macro is used to implement Qt's \c foreach loop. The \a | - |
2354 | variable parameter is a variable name or variable definition; the | - |
2355 | \a container parameter is a Qt container whose value type | - |
2356 | corresponds to the type of the variable. See \l{The foreach | - |
2357 | Keyword} for details. | - |
2358 | | - |
2359 | If you're worried about namespace pollution, you can disable this | - |
2360 | macro by adding the following line to your \c .pro file: | - |
2361 | | - |
2362 | \snippet code/src_corelib_global_qglobal.cpp 33 | - |
2363 | | - |
2364 | \sa Q_FOREACH() | - |
2365 | */ | - |
2366 | | - |
2367 | /*! | - |
2368 | \macro Q_FOREACH(variable, container) | - |
2369 | \relates <QtGlobal> | - |
2370 | | - |
2371 | Same as foreach(\a variable, \a container). | - |
2372 | | - |
2373 | This macro is available even when \c no_keywords is specified | - |
2374 | using the \c .pro file's \c CONFIG variable. | - |
2375 | | - |
2376 | \sa foreach() | - |
2377 | */ | - |
2378 | | - |
2379 | /*! | - |
2380 | \macro QT_TR_NOOP(sourceText) | - |
2381 | \relates <QtGlobal> | - |
2382 | | - |
2383 | Marks the string literal \a sourceText for dynamic translation in | - |
2384 | the current context (class), i.e the stored \a sourceText will not | - |
2385 | be altered. | - |
2386 | | - |
2387 | The macro expands to \a sourceText. | - |
2388 | | - |
2389 | Example: | - |
2390 | | - |
2391 | \snippet code/src_corelib_global_qglobal.cpp 34 | - |
2392 | | - |
2393 | The macro QT_TR_NOOP_UTF8() is identical except that it tells lupdate | - |
2394 | that the source string is encoded in UTF-8. Corresponding variants | - |
2395 | exist in the QT_TRANSLATE_NOOP() family of macros, too. | - |
2396 | | - |
2397 | \sa QT_TRANSLATE_NOOP(), {Internationalization with Qt} | - |
2398 | */ | - |
2399 | | - |
2400 | /*! | - |
2401 | \macro QT_TRANSLATE_NOOP(context, sourceText) | - |
2402 | \relates <QtGlobal> | - |
2403 | | - |
2404 | Marks the string literal \a sourceText for dynamic translation in | - |
2405 | the given \a context; i.e, the stored \a sourceText will not be | - |
2406 | altered. The \a context is typically a class and also needs to | - |
2407 | be specified as string literal. | - |
2408 | | - |
2409 | The macro expands to \a sourceText. | - |
2410 | | - |
2411 | Example: | - |
2412 | | - |
2413 | \snippet code/src_corelib_global_qglobal.cpp 35 | - |
2414 | | - |
2415 | \sa QT_TR_NOOP(), QT_TRANSLATE_NOOP3(), {Internationalization with Qt} | - |
2416 | */ | - |
2417 | | - |
2418 | /*! | - |
2419 | \macro QT_TRANSLATE_NOOP3(context, sourceText, comment) | - |
2420 | \relates <QtGlobal> | - |
2421 | \since 4.4 | - |
2422 | | - |
2423 | Marks the string literal \a sourceText for dynamic translation in the | - |
2424 | given \a context and with \a comment, i.e the stored \a sourceText will | - |
2425 | not be altered. The \a context is typically a class and also needs to | - |
2426 | be specified as string literal. The string literal \a comment | - |
2427 | will be available for translators using e.g. Qt Linguist. | - |
2428 | | - |
2429 | The macro expands to anonymous struct of the two string | - |
2430 | literals passed as \a sourceText and \a comment. | - |
2431 | | - |
2432 | Example: | - |
2433 | | - |
2434 | \snippet code/src_corelib_global_qglobal.cpp 36 | - |
2435 | | - |
2436 | \sa QT_TR_NOOP(), QT_TRANSLATE_NOOP(), {Internationalization with Qt} | - |
2437 | */ | - |
2438 | | - |
2439 | /*! | - |
2440 | \fn QString qtTrId(const char *id, int n = -1) | - |
2441 | \relates <QtGlobal> | - |
2442 | \reentrant | - |
2443 | \since 4.6 | - |
2444 | | - |
2445 | \brief The qtTrId function finds and returns a translated string. | - |
2446 | | - |
2447 | Returns a translated string identified by \a id. | - |
2448 | If no matching string is found, the id itself is returned. This | - |
2449 | should not happen under normal conditions. | - |
2450 | | - |
2451 | If \a n >= 0, all occurrences of \c %n in the resulting string | - |
2452 | are replaced with a decimal representation of \a n. In addition, | - |
2453 | depending on \a n's value, the translation text may vary. | - |
2454 | | - |
2455 | Meta data and comments can be passed as documented for QObject::tr(). | - |
2456 | In addition, it is possible to supply a source string template like that: | - |
2457 | | - |
2458 | \tt{//% <C string>} | - |
2459 | | - |
2460 | or | - |
2461 | | - |
2462 | \tt{\\begincomment% <C string> \\endcomment} | - |
2463 | | - |
2464 | Example: | - |
2465 | | - |
2466 | \snippet code/src_corelib_global_qglobal.cpp qttrid | - |
2467 | | - |
2468 | Creating QM files suitable for use with this function requires passing | - |
2469 | the \c -idbased option to the \c lrelease tool. | - |
2470 | | - |
2471 | \warning This method is reentrant only if all translators are | - |
2472 | installed \e before calling this method. Installing or removing | - |
2473 | translators while performing translations is not supported. Doing | - |
2474 | so will probably result in crashes or other undesirable behavior. | - |
2475 | | - |
2476 | \sa QObject::tr(), QCoreApplication::translate(), {Internationalization with Qt} | - |
2477 | */ | - |
2478 | | - |
2479 | /*! | - |
2480 | \macro QT_TRID_NOOP(id) | - |
2481 | \relates <QtGlobal> | - |
2482 | \since 4.6 | - |
2483 | | - |
2484 | \brief The QT_TRID_NOOP macro marks an id for dynamic translation. | - |
2485 | | - |
2486 | The only purpose of this macro is to provide an anchor for attaching | - |
2487 | meta data like to qtTrId(). | - |
2488 | | - |
2489 | The macro expands to \a id. | - |
2490 | | - |
2491 | Example: | - |
2492 | | - |
2493 | \snippet code/src_corelib_global_qglobal.cpp qttrid_noop | - |
2494 | | - |
2495 | \sa qtTrId(), {Internationalization with Qt} | - |
2496 | */ | - |
2497 | | - |
2498 | /*! | - |
2499 | \macro Q_LIKELY(expr) | - |
2500 | \relates <QtGlobal> | - |
2501 | \since 4.8 | - |
2502 | | - |
2503 | \brief Hints to the compiler that the enclosed condition, \a expr, is | - |
2504 | likely to evaluate to \c true. | - |
2505 | | - |
2506 | Use of this macro can help the compiler to optimize the code. | - |
2507 | | - |
2508 | Example: | - |
2509 | | - |
2510 | \snippet code/src_corelib_global_qglobal.cpp qlikely | - |
2511 | | - |
2512 | \sa Q_UNLIKELY() | - |
2513 | */ | - |
2514 | | - |
2515 | /*! | - |
2516 | \macro Q_UNLIKELY(expr) | - |
2517 | \relates <QtGlobal> | - |
2518 | \since 4.8 | - |
2519 | | - |
2520 | \brief Hints to the compiler that the enclosed condition, \a expr, is | - |
2521 | likely to evaluate to \c false. | - |
2522 | | - |
2523 | Use of this macro can help the compiler to optimize the code. | - |
2524 | | - |
2525 | Example: | - |
2526 | | - |
2527 | \snippet code/src_corelib_global_qglobal.cpp qunlikely | - |
2528 | | - |
2529 | \sa Q_LIKELY() | - |
2530 | */ | - |
2531 | | - |
2532 | /*! | - |
2533 | \macro QT_POINTER_SIZE | - |
2534 | \relates <QtGlobal> | - |
2535 | | - |
2536 | Expands to the size of a pointer in bytes (4 or 8). This is | - |
2537 | equivalent to \c sizeof(void *) but can be used in a preprocessor | - |
2538 | directive. | - |
2539 | */ | - |
2540 | | - |
2541 | /*! | - |
2542 | \macro QABS(n) | - |
2543 | \relates <QtGlobal> | - |
2544 | \obsolete | - |
2545 | | - |
2546 | Use qAbs(\a n) instead. | - |
2547 | | - |
2548 | \sa QMIN(), QMAX() | - |
2549 | */ | - |
2550 | | - |
2551 | /*! | - |
2552 | \macro QMIN(x, y) | - |
2553 | \relates <QtGlobal> | - |
2554 | \obsolete | - |
2555 | | - |
2556 | Use qMin(\a x, \a y) instead. | - |
2557 | | - |
2558 | \sa QMAX(), QABS() | - |
2559 | */ | - |
2560 | | - |
2561 | /*! | - |
2562 | \macro QMAX(x, y) | - |
2563 | \relates <QtGlobal> | - |
2564 | \obsolete | - |
2565 | | - |
2566 | Use qMax(\a x, \a y) instead. | - |
2567 | | - |
2568 | \sa QMIN(), QABS() | - |
2569 | */ | - |
2570 | | - |
2571 | /*! | - |
2572 | \macro const char *qPrintable(const QString &str) | - |
2573 | \relates <QtGlobal> | - |
2574 | | - |
2575 | Returns \a str as a \c{const char *}. This is equivalent to | - |
2576 | \a{str}.toLocal8Bit().constData(). | - |
2577 | | - |
2578 | The char pointer will be invalid after the statement in which | - |
2579 | qPrintable() is used. This is because the array returned by | - |
2580 | toLocal8Bit() will fall out of scope. | - |
2581 | | - |
2582 | Example: | - |
2583 | | - |
2584 | \snippet code/src_corelib_global_qglobal.cpp 37 | - |
2585 | | - |
2586 | | - |
2587 | \sa qDebug(), qWarning(), qCritical(), qFatal() | - |
2588 | */ | - |
2589 | | - |
2590 | /*! | - |
2591 | \macro Q_DECLARE_TYPEINFO(Type, Flags) | - |
2592 | \relates <QtGlobal> | - |
2593 | | - |
2594 | You can use this macro to specify information about a custom type | - |
2595 | \a Type. With accurate type information, Qt's \l{Container Classes} | - |
2596 | {generic containers} can choose appropriate storage methods and | - |
2597 | algorithms. | - |
2598 | | - |
2599 | \a Flags can be one of the following: | - |
2600 | | - |
2601 | \list | - |
2602 | \li \c Q_PRIMITIVE_TYPE specifies that \a Type is a POD (plain old | - |
2603 | data) type with no constructor or destructor, or else a type where | - |
2604 | every bit pattern is a valid object and memcpy() creates a valid | - |
2605 | independent copy of the object. | - |
2606 | \li \c Q_MOVABLE_TYPE specifies that \a Type has a constructor | - |
2607 | and/or a destructor but can be moved in memory using \c | - |
2608 | memcpy(). | - |
2609 | \li \c Q_COMPLEX_TYPE (the default) specifies that \a Type has | - |
2610 | constructors and/or a destructor and that it may not be moved | - |
2611 | in memory. | - |
2612 | \endlist | - |
2613 | | - |
2614 | Example of a "primitive" type: | - |
2615 | | - |
2616 | \snippet code/src_corelib_global_qglobal.cpp 38 | - |
2617 | | - |
2618 | An example of a non-POD "primitive" type is QUuid: Even though | - |
2619 | QUuid has constructors (and therefore isn't POD), every bit | - |
2620 | pattern still represents a valid object, and memcpy() can be used | - |
2621 | to create a valid independent copy of a QUuid object. | - |
2622 | | - |
2623 | Example of a movable type: | - |
2624 | | - |
2625 | \snippet code/src_corelib_global_qglobal.cpp 39 | - |
2626 | */ | - |
2627 | | - |
2628 | /*! | - |
2629 | \macro Q_UNUSED(name) | - |
2630 | \relates <QtGlobal> | - |
2631 | | - |
2632 | Indicates to the compiler that the parameter with the specified | - |
2633 | \a name is not used in the body of a function. This can be used to | - |
2634 | suppress compiler warnings while allowing functions to be defined | - |
2635 | with meaningful parameter names in their signatures. | - |
2636 | */ | - |
2637 | | - |
2638 | struct QInternal_CallBackTable { | - |
2639 | QVector<QList<qInternalCallback> > callbacks; | - |
2640 | }; | - |
2641 | | - |
2642 | Q_GLOBAL_STATIC(QInternal_CallBackTable, global_callback_table) never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:1194729 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:6 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:6 | yes Evaluation Count:1194713 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-1194729 |
2643 | | - |
2644 | bool QInternal::registerCallback(Callback cb, qInternalCallback callback) | - |
2645 | { | - |
2646 | if (cb >= 0 && cb < QInternal::LastCallback) { never evaluated: cb >= 0 never evaluated: cb < QInternal::LastCallback | 0 |
2647 | QInternal_CallBackTable *cbt = global_callback_table(); never executed (the execution status of this line is deduced): QInternal_CallBackTable *cbt = global_callback_table(); | - |
2648 | cbt->callbacks.resize(cb + 1); never executed (the execution status of this line is deduced): cbt->callbacks.resize(cb + 1); | - |
2649 | cbt->callbacks[cb].append(callback); never executed (the execution status of this line is deduced): cbt->callbacks[cb].append(callback); | - |
2650 | return true; never executed: return true; | 0 |
2651 | } | - |
2652 | return false; never executed: return false; | 0 |
2653 | } | - |
2654 | | - |
2655 | bool QInternal::unregisterCallback(Callback cb, qInternalCallback callback) | - |
2656 | { | - |
2657 | if (cb >= 0 && cb < QInternal::LastCallback) { never evaluated: cb >= 0 never evaluated: cb < QInternal::LastCallback | 0 |
2658 | QInternal_CallBackTable *cbt = global_callback_table(); never executed (the execution status of this line is deduced): QInternal_CallBackTable *cbt = global_callback_table(); | - |
2659 | return (bool) cbt->callbacks[cb].removeAll(callback); never executed: return (bool) cbt->callbacks[cb].removeAll(callback); | 0 |
2660 | } | - |
2661 | return false; never executed: return false; | 0 |
2662 | } | - |
2663 | | - |
2664 | bool QInternal::activateCallbacks(Callback cb, void **parameters) | - |
2665 | { | - |
2666 | Q_ASSERT_X(cb >= 0, "QInternal::activateCallback()", "Callback id must be a valid id"); executed (the execution status of this line is deduced): qt_noop(); | - |
2667 | | - |
2668 | QInternal_CallBackTable *cbt = global_callback_table(); executed (the execution status of this line is deduced): QInternal_CallBackTable *cbt = global_callback_table(); | - |
2669 | if (cbt && cb < cbt->callbacks.size()) { partially evaluated: cbt yes Evaluation Count:1194735 | no Evaluation Count:0 |
partially evaluated: cb < cbt->callbacks.size() no Evaluation Count:0 | yes Evaluation Count:1194736 |
| 0-1194736 |
2670 | QList<qInternalCallback> callbacks = cbt->callbacks[cb]; never executed (the execution status of this line is deduced): QList<qInternalCallback> callbacks = cbt->callbacks[cb]; | - |
2671 | bool ret = false; never executed (the execution status of this line is deduced): bool ret = false; | - |
2672 | for (int i=0; i<callbacks.size(); ++i) never evaluated: i<callbacks.size() | 0 |
2673 | ret |= (callbacks.at(i))(parameters); never executed: ret |= (callbacks.at(i))(parameters); | 0 |
2674 | return ret; never executed: return ret; | 0 |
2675 | } | - |
2676 | return false; executed: return false; Execution Count:1194749 | 1194749 |
2677 | } | - |
2678 | | - |
2679 | /*! | - |
2680 | \macro Q_BYTE_ORDER | - |
2681 | \relates <QtGlobal> | - |
2682 | | - |
2683 | This macro can be used to determine the byte order your system | - |
2684 | uses for storing data in memory. i.e., whether your system is | - |
2685 | little-endian or big-endian. It is set by Qt to one of the macros | - |
2686 | Q_LITTLE_ENDIAN or Q_BIG_ENDIAN. You normally won't need to worry | - |
2687 | about endian-ness, but you might, for example if you need to know | - |
2688 | which byte of an integer or UTF-16 character is stored in the | - |
2689 | lowest address. Endian-ness is important in networking, where | - |
2690 | computers with different values for Q_BYTE_ORDER must pass data | - |
2691 | back and forth. | - |
2692 | | - |
2693 | Use this macro as in the following examples. | - |
2694 | | - |
2695 | \snippet code/src_corelib_global_qglobal.cpp 40 | - |
2696 | | - |
2697 | \sa Q_BIG_ENDIAN, Q_LITTLE_ENDIAN | - |
2698 | */ | - |
2699 | | - |
2700 | /*! | - |
2701 | \macro Q_LITTLE_ENDIAN | - |
2702 | \relates <QtGlobal> | - |
2703 | | - |
2704 | This macro represents a value you can compare to the macro | - |
2705 | Q_BYTE_ORDER to determine the endian-ness of your system. In a | - |
2706 | little-endian system, the least significant byte is stored at the | - |
2707 | lowest address. The other bytes follow in increasing order of | - |
2708 | significance. | - |
2709 | | - |
2710 | \snippet code/src_corelib_global_qglobal.cpp 41 | - |
2711 | | - |
2712 | \sa Q_BYTE_ORDER, Q_BIG_ENDIAN | - |
2713 | */ | - |
2714 | | - |
2715 | /*! | - |
2716 | \macro Q_BIG_ENDIAN | - |
2717 | \relates <QtGlobal> | - |
2718 | | - |
2719 | This macro represents a value you can compare to the macro | - |
2720 | Q_BYTE_ORDER to determine the endian-ness of your system. In a | - |
2721 | big-endian system, the most significant byte is stored at the | - |
2722 | lowest address. The other bytes follow in decreasing order of | - |
2723 | significance. | - |
2724 | | - |
2725 | \snippet code/src_corelib_global_qglobal.cpp 42 | - |
2726 | | - |
2727 | \sa Q_BYTE_ORDER, Q_LITTLE_ENDIAN | - |
2728 | */ | - |
2729 | | - |
2730 | /*! | - |
2731 | \macro Q_GLOBAL_STATIC(type, name) | - |
2732 | \internal | - |
2733 | | - |
2734 | Declares a global static variable with the given \a type and \a name. | - |
2735 | | - |
2736 | Use this macro to instantiate an object in a thread-safe way, creating | - |
2737 | a global pointer that can be used to refer to it. | - |
2738 | | - |
2739 | \warning This macro is subject to a race condition that can cause the object | - |
2740 | to be constructed twice. However, if this occurs, the second instance will | - |
2741 | be immediately deleted. | - |
2742 | | - |
2743 | See also | - |
2744 | \l{http://www.aristeia.com/publications.html}{"C++ and the perils of Double-Checked Locking"} | - |
2745 | by Scott Meyers and Andrei Alexandrescu. | - |
2746 | */ | - |
2747 | | - |
2748 | /*! | - |
2749 | \macro Q_GLOBAL_STATIC_WITH_ARGS(type, name, arguments) | - |
2750 | \internal | - |
2751 | | - |
2752 | Declares a global static variable with the specified \a type and \a name. | - |
2753 | | - |
2754 | Use this macro to instantiate an object using the \a arguments specified | - |
2755 | in a thread-safe way, creating a global pointer that can be used to refer | - |
2756 | to it. | - |
2757 | | - |
2758 | \warning This macro is subject to a race condition that can cause the object | - |
2759 | to be constructed twice. However, if this occurs, the second instance will | - |
2760 | be immediately deleted. | - |
2761 | | - |
2762 | See also | - |
2763 | \l{http://www.aristeia.com/publications.html}{"C++ and the perils of Double-Checked Locking"} | - |
2764 | by Scott Meyers and Andrei Alexandrescu. | - |
2765 | */ | - |
2766 | | - |
2767 | /*! | - |
2768 | \macro QT_NAMESPACE | - |
2769 | \internal | - |
2770 | | - |
2771 | If this macro is defined to \c ns all Qt classes are put in a namespace | - |
2772 | called \c ns. Also, moc will output code putting metaobjects etc. | - |
2773 | into namespace \c ns. | - |
2774 | | - |
2775 | \sa QT_BEGIN_NAMESPACE, QT_END_NAMESPACE, | - |
2776 | QT_PREPEND_NAMESPACE, QT_USE_NAMESPACE, | - |
2777 | QT_BEGIN_INCLUDE_NAMESPACE, QT_END_INCLUDE_NAMESPACE, | - |
2778 | QT_BEGIN_MOC_NAMESPACE, QT_END_MOC_NAMESPACE, | - |
2779 | */ | - |
2780 | | - |
2781 | /*! | - |
2782 | \macro QT_PREPEND_NAMESPACE(identifier) | - |
2783 | \internal | - |
2784 | | - |
2785 | This macro qualifies \a identifier with the full namespace. | - |
2786 | It expands to \c{::QT_NAMESPACE::identifier} if \c QT_NAMESPACE is defined | - |
2787 | and only \a identifier otherwise. | - |
2788 | | - |
2789 | \sa QT_NAMESPACE | - |
2790 | */ | - |
2791 | | - |
2792 | /*! | - |
2793 | \macro QT_USE_NAMESPACE | - |
2794 | \internal | - |
2795 | | - |
2796 | This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined | - |
2797 | and nothing otherwise. | - |
2798 | | - |
2799 | \sa QT_NAMESPACE | - |
2800 | */ | - |
2801 | | - |
2802 | /*! | - |
2803 | \macro QT_BEGIN_NAMESPACE | - |
2804 | \internal | - |
2805 | | - |
2806 | This macro expands to | - |
2807 | | - |
2808 | \snippet code/src_corelib_global_qglobal.cpp begin namespace macro | - |
2809 | | - |
2810 | if \c QT_NAMESPACE is defined and nothing otherwise. If should always | - |
2811 | appear in the file-level scope and be followed by \c QT_END_NAMESPACE | - |
2812 | at the same logical level with respect to preprocessor conditionals | - |
2813 | in the same file. | - |
2814 | | - |
2815 | As a rule of thumb, \c QT_BEGIN_NAMESPACE should appear in all Qt header | - |
2816 | and Qt source files after the last \c{#include} line and before the first | - |
2817 | declaration. In Qt headers using \c QT_BEGIN_HEADER, \c QT_BEGIN_NAMESPACE | - |
2818 | follows \c QT_BEGIN_HEADER immediately. | - |
2819 | | - |
2820 | If that rule can't be followed because, e.g., \c{#include} lines and | - |
2821 | declarations are wildly mixed, place \c QT_BEGIN_NAMESPACE before | - |
2822 | the first declaration and wrap the \c{#include} lines in | - |
2823 | \c QT_BEGIN_INCLUDE_NAMESPACE and \c QT_END_INCLUDE_NAMESPACE. | - |
2824 | | - |
2825 | When using the \c QT_NAMESPACE feature in user code | - |
2826 | (e.g., when building plugins statically linked to Qt) where | - |
2827 | the user code is not intended to go into the \c QT_NAMESPACE | - |
2828 | namespace, all forward declarations of Qt classes need to | - |
2829 | be wrapped in \c QT_BEGIN_NAMESPACE and \c QT_END_NAMESPACE. | - |
2830 | After that, a \c QT_USE_NAMESPACE should follow. | - |
2831 | No further changes should be needed. | - |
2832 | | - |
2833 | \sa QT_NAMESPACE | - |
2834 | */ | - |
2835 | | - |
2836 | /*! | - |
2837 | \macro QT_END_NAMESPACE | - |
2838 | \internal | - |
2839 | | - |
2840 | This macro expands to | - |
2841 | | - |
2842 | \snippet code/src_corelib_global_qglobal.cpp end namespace macro | - |
2843 | | - |
2844 | if \c QT_NAMESPACE is defined and nothing otherwise. It is used to cancel | - |
2845 | the effect of \c QT_BEGIN_NAMESPACE. | - |
2846 | | - |
2847 | If a source file ends with a \c{#include} directive that includes a moc file, | - |
2848 | \c QT_END_NAMESPACE should be placed before that \c{#include}. | - |
2849 | | - |
2850 | \sa QT_NAMESPACE | - |
2851 | */ | - |
2852 | | - |
2853 | /*! | - |
2854 | \macro QT_BEGIN_INCLUDE_NAMESPACE | - |
2855 | \internal | - |
2856 | | - |
2857 | This macro is equivalent to \c QT_END_NAMESPACE. | - |
2858 | It only serves as syntactic sugar and is intended | - |
2859 | to be used before #include lines within a | - |
2860 | \c QT_BEGIN_NAMESPACE ... \c QT_END_NAMESPACE block. | - |
2861 | | - |
2862 | \sa QT_NAMESPACE | - |
2863 | */ | - |
2864 | | - |
2865 | /*! | - |
2866 | \macro QT_END_INCLUDE_NAMESPACE | - |
2867 | \internal | - |
2868 | | - |
2869 | This macro is equivalent to \c QT_BEGIN_NAMESPACE. | - |
2870 | It only serves as syntactic sugar and is intended | - |
2871 | to be used after #include lines within a | - |
2872 | \c QT_BEGIN_NAMESPACE ... \c QT_END_NAMESPACE block. | - |
2873 | | - |
2874 | \sa QT_NAMESPACE | - |
2875 | */ | - |
2876 | | - |
2877 | /*! | - |
2878 | \macro QT_BEGIN_MOC_NAMESPACE | - |
2879 | \internal | - |
2880 | | - |
2881 | This macro is output by moc at the beginning of | - |
2882 | moc files. It is equivalent to \c QT_USE_NAMESPACE. | - |
2883 | | - |
2884 | \sa QT_NAMESPACE | - |
2885 | */ | - |
2886 | | - |
2887 | /*! | - |
2888 | \macro QT_END_MOC_NAMESPACE | - |
2889 | \internal | - |
2890 | | - |
2891 | This macro is output by moc at the beginning of | - |
2892 | moc files. It expands to nothing. | - |
2893 | | - |
2894 | \sa QT_NAMESPACE | - |
2895 | */ | - |
2896 | | - |
2897 | /*! | - |
2898 | \fn bool qFuzzyCompare(double p1, double p2) | - |
2899 | \relates <QtGlobal> | - |
2900 | \since 4.4 | - |
2901 | \threadsafe | - |
2902 | | - |
2903 | Compares the floating point value \a p1 and \a p2 and | - |
2904 | returns \c true if they are considered equal, otherwise \c false. | - |
2905 | | - |
2906 | Note that comparing values where either \a p1 or \a p2 is 0.0 will not work. | - |
2907 | The solution to this is to compare against values greater than or equal to 1.0. | - |
2908 | | - |
2909 | \snippet code/src_corelib_global_qglobal.cpp 46 | - |
2910 | | - |
2911 | The two numbers are compared in a relative way, where the | - |
2912 | exactness is stronger the smaller the numbers are. | - |
2913 | */ | - |
2914 | | - |
2915 | /*! | - |
2916 | \fn bool qFuzzyCompare(float p1, float p2) | - |
2917 | \relates <QtGlobal> | - |
2918 | \since 4.4 | - |
2919 | \threadsafe | - |
2920 | | - |
2921 | Compares the floating point value \a p1 and \a p2 and | - |
2922 | returns \c true if they are considered equal, otherwise \c false. | - |
2923 | | - |
2924 | The two numbers are compared in a relative way, where the | - |
2925 | exactness is stronger the smaller the numbers are. | - |
2926 | */ | - |
2927 | | - |
2928 | /*! | - |
2929 | \macro QT_REQUIRE_VERSION(int argc, char **argv, const char *version) | - |
2930 | \relates <QtGlobal> | - |
2931 | | - |
2932 | This macro can be used to ensure that the application is run | - |
2933 | against a recent enough version of Qt. This is especially useful | - |
2934 | if your application depends on a specific bug fix introduced in a | - |
2935 | bug-fix release (e.g., 4.0.2). | - |
2936 | | - |
2937 | The \a argc and \a argv parameters are the \c main() function's | - |
2938 | \c argc and \c argv parameters. The \a version parameter is a | - |
2939 | string literal that specifies which version of Qt the application | - |
2940 | requires (e.g., "4.0.2"). | - |
2941 | | - |
2942 | Example: | - |
2943 | | - |
2944 | \snippet code/src_gui_dialogs_qmessagebox.cpp 4 | - |
2945 | */ | - |
2946 | | - |
2947 | /*! | - |
2948 | \macro Q_DECL_EXPORT | - |
2949 | \relates <QtGlobal> | - |
2950 | | - |
2951 | This macro marks a symbol for shared library export (see | - |
2952 | \l{sharedlibrary.html}{Creating Shared Libraries}). | - |
2953 | | - |
2954 | \sa Q_DECL_IMPORT | - |
2955 | */ | - |
2956 | | - |
2957 | /*! | - |
2958 | \macro Q_DECL_IMPORT | - |
2959 | \relates <QtGlobal> | - |
2960 | | - |
2961 | This macro declares a symbol to be an import from a shared library (see | - |
2962 | \l{sharedlibrary.html}{Creating Shared Libraries}). | - |
2963 | | - |
2964 | \sa Q_DECL_EXPORT | - |
2965 | */ | - |
2966 | | - |
2967 | /*! | - |
2968 | \macro Q_DECL_CONSTEXPR | - |
2969 | \relates <QtGlobal> | - |
2970 | | - |
2971 | This macro can be used to declare variable that should be constructed at compile-time, | - |
2972 | or an inline function that can be computed at compile-time. | - |
2973 | | - |
2974 | It expands to "constexpr" if your compiler supports that C++11 keyword, or to nothing | - |
2975 | otherwise. | - |
2976 | */ | - |
2977 | | - |
2978 | /*! | - |
2979 | \macro qDebug(const char *message, ...) | - |
2980 | \relates <QtGlobal> | - |
2981 | | - |
2982 | Calls the message handler with the debug message \a message. If no | - |
2983 | message handler has been installed, the message is printed to | - |
2984 | stderr. Under Windows, the message is sent to the console, if it is a | - |
2985 | console application; otherwise, it is sent to the debugger. On Blackberry the | - |
2986 | message is sent to slogger2. This function does nothing if \c QT_NO_DEBUG_OUTPUT | - |
2987 | was defined during compilation. | - |
2988 | | - |
2989 | If you pass the function a format string and a list of arguments, | - |
2990 | it works in similar way to the C printf() function. The format | - |
2991 | should be a Latin-1 string. | - |
2992 | | - |
2993 | Example: | - |
2994 | | - |
2995 | \snippet code/src_corelib_global_qglobal.cpp 24 | - |
2996 | | - |
2997 | If you include \c <QtDebug>, a more convenient syntax is also | - |
2998 | available: | - |
2999 | | - |
3000 | \snippet code/src_corelib_global_qglobal.cpp 25 | - |
3001 | | - |
3002 | With this syntax, the function returns a QDebug object that is | - |
3003 | configured to use the QtDebugMsg message type. It automatically | - |
3004 | puts a single space between each item, and outputs a newline at | - |
3005 | the end. It supports many C++ and Qt types. | - |
3006 | | - |
3007 | To suppress the output at run-time, install your own message handler | - |
3008 | with qInstallMessageHandler(). | - |
3009 | | - |
3010 | \sa qWarning(), qCritical(), qFatal(), qInstallMessageHandler(), | - |
3011 | {Debugging Techniques} | - |
3012 | */ | - |
3013 | | - |
3014 | /*! | - |
3015 | \macro qWarning(const char *message, ...) | - |
3016 | \relates <QtGlobal> | - |
3017 | | - |
3018 | Calls the message handler with the warning message \a message. If no | - |
3019 | message handler has been installed, the message is printed to | - |
3020 | stderr. Under Windows, the message is sent to the debugger. | - |
3021 | On Blackberry the message is sent to slogger2. This | - |
3022 | function does nothing if \c QT_NO_WARNING_OUTPUT was defined | - |
3023 | during compilation; it exits if the environment variable \c | - |
3024 | QT_FATAL_WARNINGS is defined. | - |
3025 | | - |
3026 | This function takes a format string and a list of arguments, | - |
3027 | similar to the C printf() function. The format should be a Latin-1 | - |
3028 | string. | - |
3029 | | - |
3030 | Example: | - |
3031 | \snippet code/src_corelib_global_qglobal.cpp 26 | - |
3032 | | - |
3033 | If you include <QtDebug>, a more convenient syntax is | - |
3034 | also available: | - |
3035 | | - |
3036 | \snippet code/src_corelib_global_qglobal.cpp 27 | - |
3037 | | - |
3038 | This syntax inserts a space between each item, and | - |
3039 | appends a newline at the end. | - |
3040 | | - |
3041 | To suppress the output at runtime, install your own message handler | - |
3042 | with qInstallMessageHandler(). | - |
3043 | | - |
3044 | \sa qDebug(), qCritical(), qFatal(), qInstallMessageHandler(), | - |
3045 | {Debugging Techniques} | - |
3046 | */ | - |
3047 | | - |
3048 | /*! | - |
3049 | \macro qCritical(const char *message, ...) | - |
3050 | \relates <QtGlobal> | - |
3051 | | - |
3052 | Calls the message handler with the critical message \a message. If no | - |
3053 | message handler has been installed, the message is printed to | - |
3054 | stderr. Under Windows, the message is sent to the debugger. | - |
3055 | On Blackberry the message is sent to slogger2. | - |
3056 | | - |
3057 | This function takes a format string and a list of arguments, | - |
3058 | similar to the C printf() function. The format should be a Latin-1 | - |
3059 | string. | - |
3060 | | - |
3061 | Example: | - |
3062 | \snippet code/src_corelib_global_qglobal.cpp 28 | - |
3063 | | - |
3064 | If you include <QtDebug>, a more convenient syntax is | - |
3065 | also available: | - |
3066 | | - |
3067 | \snippet code/src_corelib_global_qglobal.cpp 29 | - |
3068 | | - |
3069 | A space is inserted between the items, and a newline is | - |
3070 | appended at the end. | - |
3071 | | - |
3072 | To suppress the output at runtime, install your own message handler | - |
3073 | with qInstallMessageHandler(). | - |
3074 | | - |
3075 | \sa qDebug(), qWarning(), qFatal(), qInstallMessageHandler(), | - |
3076 | {Debugging Techniques} | - |
3077 | */ | - |
3078 | | - |
3079 | /*! | - |
3080 | \macro qFatal(const char *message, ...) | - |
3081 | \relates <QtGlobal> | - |
3082 | | - |
3083 | Calls the message handler with the fatal message \a message. If no | - |
3084 | message handler has been installed, the message is printed to | - |
3085 | stderr. Under Windows, the message is sent to the debugger. | - |
3086 | On Blackberry the message is sent to slogger2. | - |
3087 | | - |
3088 | If you are using the \b{default message handler} this function will | - |
3089 | abort on Unix systems to create a core dump. On Windows, for debug builds, | - |
3090 | this function will report a _CRT_ERROR enabling you to connect a debugger | - |
3091 | to the application. | - |
3092 | | - |
3093 | This function takes a format string and a list of arguments, | - |
3094 | similar to the C printf() function. | - |
3095 | | - |
3096 | Example: | - |
3097 | \snippet code/src_corelib_global_qglobal.cpp 30 | - |
3098 | | - |
3099 | To suppress the output at runtime, install your own message handler | - |
3100 | with qInstallMessageHandler(). | - |
3101 | | - |
3102 | \sa qDebug(), qCritical(), qWarning(), qInstallMessageHandler(), | - |
3103 | {Debugging Techniques} | - |
3104 | */ | - |
3105 | | - |
3106 | /*! | - |
3107 | \macro qMove(x) | - |
3108 | \relates <QtGlobal> | - |
3109 | | - |
3110 | It expands to "std::move" if your compiler supports that C++11 function, or to nothing | - |
3111 | otherwise. | - |
3112 | */ | - |
3113 | | - |
3114 | /*! | - |
3115 | \macro Q_DECL_NOTHROW | - |
3116 | \relates <QtGlobal> | - |
3117 | \since 5.0 | - |
3118 | | - |
3119 | This macro marks a function as never throwing, under no | - |
3120 | circumstances. If the function does nevertheless throw, the | - |
3121 | behaviour is undefined. | - |
3122 | | - |
3123 | The macro expands to either "throw()", if that has some benefit on | - |
3124 | the compiler, or to C++11 noexcept, if available, or to nothing | - |
3125 | otherwise. | - |
3126 | | - |
3127 | If you need C++11 noexcept semantics, don't use this macro, use | - |
3128 | Q_DECL_NOEXCEPT/Q_DECL_NOEXCEPT_EXPR instead. | - |
3129 | | - |
3130 | \sa Q_DECL_NOEXCEPT, Q_DECL_NOEXCEPT_EXPR | - |
3131 | */ | - |
3132 | | - |
3133 | /*! | - |
3134 | \macro QT_TERMINATE_ON_EXCEPTION(expr) | - |
3135 | \relates <QtGlobal> | - |
3136 | \internal | - |
3137 | | - |
3138 | In general, use of the Q_DECL_NOEXCEPT macro is preferred over | - |
3139 | Q_DECL_NOTHROW, because it exhibits well-defined behavior and | - |
3140 | supports the more powerful Q_DECL_NOEXCEPT_EXPR variant. However, | - |
3141 | use of Q_DECL_NOTHROW has the advantage that Windows builds | - |
3142 | benefit on a wide range or compiler versions that do not yet | - |
3143 | support the C++11 noexcept feature. | - |
3144 | | - |
3145 | It may therefore be beneficial to use Q_DECL_NOTHROW and emulate | - |
3146 | the C++11 behavior manually with an embedded try/catch. | - |
3147 | | - |
3148 | Qt provides the QT_TERMINATE_ON_EXCEPTION(expr) macro for this | - |
3149 | purpose. It either expands to \c expr (if Qt is compiled without | - |
3150 | exception support or the compiler supports C++11 noexcept | - |
3151 | semantics) or to | - |
3152 | \code | - |
3153 | try { expr; } catch(...) { qTerminate(); } | - |
3154 | \endcode | - |
3155 | otherwise. | - |
3156 | | - |
3157 | Since this macro expands to just \c expr if the compiler supports | - |
3158 | C++11 noexcept, expecting the compiler to take over responsibility | - |
3159 | of calling std::terminate() in that case, it should not be used | - |
3160 | outside Q_DECL_NOTHROW functions. | - |
3161 | | - |
3162 | \sa Q_DECL_NOEXCEPT, Q_DECL_NOTHROW, qTerminate() | - |
3163 | */ | - |
3164 | | - |
3165 | /*! | - |
3166 | \macro Q_DECL_NOEXCEPT | - |
3167 | \relates <QtGlobal> | - |
3168 | \since 5.0 | - |
3169 | | - |
3170 | This macro marks a function as never throwing. If the function | - |
3171 | does nevertheless throw, the behaviour is defined: | - |
3172 | std::terminate() is called. | - |
3173 | | - |
3174 | The macro expands to C++11 noexcept, if available, or to nothing | - |
3175 | otherwise. | - |
3176 | | - |
3177 | If you need the operator version of C++11 noexcept, use | - |
3178 | Q_DECL_NOEXCEPT_EXPR(x). | - |
3179 | | - |
3180 | If you don't need C++11 noexcept semantics, e.g. because your | - |
3181 | function can't possibly throw, don't use this macro, use | - |
3182 | Q_DECL_NOTHROW instead. | - |
3183 | | - |
3184 | \sa Q_DECL_NOTHROW, Q_DECL_NOEXCEPT_EXPR | - |
3185 | */ | - |
3186 | | - |
3187 | /*! | - |
3188 | \macro Q_DECL_NOEXCEPT_EXPR(x) | - |
3189 | \relates <QtGlobal> | - |
3190 | \since 5.0 | - |
3191 | | - |
3192 | This macro marks a function as non-throwing if \a x is true. If | - |
3193 | the function does nevertheless throw, the behaviour is defined: | - |
3194 | std::terminate() is called. | - |
3195 | | - |
3196 | The macro expands to C++11 noexcept(x), if available, or to | - |
3197 | nothing otherwise. | - |
3198 | | - |
3199 | If you need the always-true version of C++11 noexcept, use | - |
3200 | Q_DECL_NOEXCEPT. | - |
3201 | | - |
3202 | If you don't need C++11 noexcept semantics, e.g. because your | - |
3203 | function can't possibly throw, don't use this macro, use | - |
3204 | Q_DECL_NOTHROW instead. | - |
3205 | | - |
3206 | \sa Q_DECL_NOTHROW, Q_DECL_NOEXCEPT_EXPR | - |
3207 | */ | - |
3208 | | - |
3209 | /*! | - |
3210 | \macro Q_DECL_OVERRIDE | - |
3211 | \since 5.0 | - |
3212 | \relates <QtGlobal> | - |
3213 | | - |
3214 | This macro can be used to declare an overriding virtual | - |
3215 | function. Use of this markup will allow the compiler to generate | - |
3216 | an error if the overriding virtual function does not in fact | - |
3217 | override anything. | - |
3218 | | - |
3219 | It expands to "override" if your compiler supports that C++11 | - |
3220 | contextual keyword, or to nothing otherwise. | - |
3221 | | - |
3222 | The macro goes at the end of the function, usually after the | - |
3223 | \c{const}, if any: | - |
3224 | \code | - |
3225 | // generate error if this doesn't actually override anything: | - |
3226 | virtual void MyWidget::paintEvent(QPaintEvent*) Q_DECL_OVERRIDE; | - |
3227 | \endcode | - |
3228 | | - |
3229 | \sa Q_DECL_FINAL | - |
3230 | */ | - |
3231 | | - |
3232 | /*! | - |
3233 | \macro Q_DECL_FINAL | - |
3234 | \since 5.0 | - |
3235 | \relates <QtGlobal> | - |
3236 | | - |
3237 | This macro can be used to declare an overriding virtual or a class | - |
3238 | as "final", with Java semantics. Further-derived classes can then | - |
3239 | no longer override this virtual function, or inherit from this | - |
3240 | class, respectively. | - |
3241 | | - |
3242 | It expands to "final" if your compiler supports that C++11 | - |
3243 | contextual keyword, or something non-standard if your compiler | - |
3244 | supports something close enough to the C++11 semantics, or to | - |
3245 | nothing otherwise. | - |
3246 | | - |
3247 | The macro goes at the end of the function, usually after the | - |
3248 | \c{const}, if any: | - |
3249 | \code | - |
3250 | // more-derived classes no longer permitted to override this: | - |
3251 | virtual void MyWidget::paintEvent(QPaintEvent*) Q_DECL_FINAL; | - |
3252 | \endcode | - |
3253 | | - |
3254 | For classes, it goes in front of the \c{:} in the class | - |
3255 | definition, if any: | - |
3256 | \code | - |
3257 | class QRect Q_DECL_FINAL { // cannot be derived from | - |
3258 | // ... | - |
3259 | }; | - |
3260 | \endcode | - |
3261 | | - |
3262 | \sa Q_DECL_OVERRIDE | - |
3263 | */ | - |
3264 | | - |
3265 | QT_END_NAMESPACE | - |
3266 | | - |
| | |