OpenCoverage

qglobal.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/global/qglobal.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2016 Intel Corporation.-
5** Contact: https://www.qt.io/licensing/-
6**-
7** This file is part of the QtCore module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see https://www.qt.io/terms-conditions. For further-
16** information use the contact form at https://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 3 as published by the Free Software-
21** Foundation and appearing in the file LICENSE.LGPL3 included in the-
22** packaging of this file. Please review the following information to-
23** ensure the GNU Lesser General Public License version 3 requirements-
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
25**-
26** GNU General Public License Usage-
27** Alternatively, this file may be used under the terms of the GNU-
28** General Public License version 2.0 or (at your option) the GNU General-
29** Public license version 3 or any later version approved by the KDE Free-
30** Qt Foundation. The licenses are as published by the Free Software-
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
32** included in the packaging of this file. Please review the following-
33** information to ensure the GNU General Public License requirements will-
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
35** https://www.gnu.org/licenses/gpl-3.0.html.-
36**-
37** $QT_END_LICENSE$-
38**-
39****************************************************************************/-
40-
41#include "qplatformdefs.h"-
42#include "qstring.h"-
43#include "qvector.h"-
44#include "qlist.h"-
45#include "qthreadstorage.h"-
46#include "qdir.h"-
47#include "qdatetime.h"-
48#include <private/qlocale_tools_p.h>-
49-
50#include <private/qsystemlibrary_p.h>-
51#include <qmutex.h>-
52-
53#ifndef QT_NO_QOBJECT-
54#include <private/qthread_p.h>-
55#endif-
56-
57#include <stdlib.h>-
58#include <limits.h>-
59#include <stdarg.h>-
60#include <string.h>-
61-
62#ifndef QT_NO_EXCEPTIONS-
63# include <string>-
64# include <exception>-
65#endif-
66-
67#if !defined(Q_OS_WINCE)-
68# include <errno.h>-
69# if defined(Q_CC_MSVC)-
70# include <crtdbg.h>-
71# endif-
72#endif-
73-
74#ifdef Q_OS_WINRT-
75#include <Ws2tcpip.h>-
76#endif // Q_OS_WINRT-
77-
78#if defined(Q_OS_VXWORKS) && defined(_WRS_KERNEL)-
79# include <envLib.h>-
80#endif-
81-
82#if defined(Q_OS_ANDROID)-
83#include <private/qjni_p.h>-
84#endif-
85-
86#if defined(Q_OS_SOLARIS)-
87# include <sys/systeminfo.h>-
88#endif-
89-
90#ifdef Q_OS_UNIX-
91#include <sys/utsname.h>-
92#include <private/qcore_unix_p.h>-
93#endif-
94-
95#ifdef Q_OS_BSD4-
96#include <sys/sysctl.h>-
97#endif-
98-
99#include "archdetect.cpp"-
100-
101QT_BEGIN_NAMESPACE-
102-
103#if !QT_DEPRECATED_SINCE(5, 0)-
104// Make sure they're defined to be exported-
105Q_CORE_EXPORT void *qMemCopy(void *dest, const void *src, size_t n);-
106Q_CORE_EXPORT void *qMemSet(void *dest, int c, size_t n);-
107#endif-
108-
109// Statically check assumptions about the environment we're running-
110// in. The idea here is to error or warn if otherwise implicit Qt-
111// assumptions are not fulfilled on new hardware or compilers-
112// (if this list becomes too long, consider factoring into a separate file)-
113Q_STATIC_ASSERT_X(sizeof(int) == 4, "Qt assumes that int is 32 bits");-
114Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits");-
115Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined incorrectly");-
116-
117/*!-
118 \class QFlag-
119 \inmodule QtCore-
120 \brief The QFlag class is a helper data type for QFlags.-
121-
122 It is equivalent to a plain \c int, except with respect to-
123 function overloading and type conversions. You should never need-
124 to use this class in your applications.-
125-
126 \sa QFlags-
127*/-
128-
129/*!-
130 \fn QFlag::QFlag(int value)-
131-
132 Constructs a QFlag object that stores the given \a value.-
133*/-
134-
135/*!-
136 \fn QFlag::QFlag(uint value)-
137 \since Qt 5.3-
138-
139 Constructs a QFlag object that stores the given \a value.-
140*/-
141-
142/*!-
143 \fn QFlag::QFlag(short value)-
144 \since 5.3-
145-
146 Constructs a QFlag object that stores the given \a value.-
147*/-
148-
149/*!-
150 \fn QFlag::QFlag(ushort value)-
151 \since Qt 5.3-
152-
153 Constructs a QFlag object that stores the given \a value.-
154*/-
155-
156/*!-
157 \fn QFlag::operator int() const-
158-
159 Returns the value stored by the QFlag object.-
160*/-
161-
162/*!-
163 \fn QFlag::operator uint() const-
164 \since Qt 5.3-
165-
166 Returns the value stored by the QFlag object.-
167*/-
168-
169/*!-
170 \class QFlags-
171 \inmodule QtCore-
172 \brief The QFlags class provides a type-safe way of storing-
173 OR-combinations of enum values.-
174-
175-
176 \ingroup tools-
177-
178 The QFlags<Enum> class is a template class, where Enum is an enum-
179 type. QFlags is used throughout Qt for storing combinations of-
180 enum values.-
181-
182 The traditional C++ approach for storing OR-combinations of enum-
183 values is to use an \c int or \c uint variable. The inconvenience-
184 with this approach is that there's no type checking at all; any-
185 enum value can be OR'd with any other enum value and passed on to-
186 a function that takes an \c int or \c uint.-
187-
188 Qt uses QFlags to provide type safety. For example, the-
189 Qt::Alignment type is simply a typedef for-
190 QFlags<Qt::AlignmentFlag>. QLabel::setAlignment() takes a-
191 Qt::Alignment parameter, which means that any combination of-
192 Qt::AlignmentFlag values, or 0, is legal:-
193-
194 \snippet code/src_corelib_global_qglobal.cpp 0-
195-
196 If you try to pass a value from another enum or just a plain-
197 integer other than 0, the compiler will report an error. If you-
198 need to cast integer values to flags in a untyped fashion, you can-
199 use the explicit QFlags constructor as cast operator.-
200-
201 If you want to use QFlags for your own enum types, use-
202 the Q_DECLARE_FLAGS() and Q_DECLARE_OPERATORS_FOR_FLAGS().-
203-
204 Example:-
205-
206 \snippet code/src_corelib_global_qglobal.cpp 1-
207-
208 You can then use the \c MyClass::Options type to store-
209 combinations of \c MyClass::Option values.-
210-
211 \section1 Flags and the Meta-Object System-
212-
213 The Q_DECLARE_FLAGS() macro does not expose the flags to the meta-object-
214 system, so they cannot be used by Qt Script or edited in Qt Designer.-
215 To make the flags available for these purposes, the Q_FLAG() macro must-
216 be used:-
217-
218 \snippet code/src_corelib_global_qglobal.cpp meta-object flags-
219-
220 \section1 Naming Convention-
221-
222 A sensible naming convention for enum types and associated QFlags-
223 types is to give a singular name to the enum type (e.g., \c-
224 Option) and a plural name to the QFlags type (e.g., \c Options).-
225 When a singular name is desired for the QFlags type (e.g., \c-
226 Alignment), you can use \c Flag as the suffix for the enum type-
227 (e.g., \c AlignmentFlag).-
228-
229 \sa QFlag-
230*/-
231-
232/*!-
233 \typedef QFlags::Int-
234 \since 5.0-
235-
236 Typedef for the integer type used for storage as well as for-
237 implicit conversion. Either \c int or \c{unsigned int}, depending-
238 on whether the enum's underlying type is signed or unsigned.-
239*/-
240-
241/*!-
242 \typedef QFlags::enum_type-
243-
244 Typedef for the Enum template type.-
245*/-
246-
247/*!-
248 \fn QFlags::QFlags(const QFlags &other)-
249-
250 Constructs a copy of \a other.-
251*/-
252-
253/*!-
254 \fn QFlags::QFlags(Enum flag)-
255-
256 Constructs a QFlags object storing the given \a flag.-
257*/-
258-
259/*!-
260 \fn QFlags::QFlags(Zero zero)-
261-
262 Constructs a QFlags object with no flags set. \a zero must be a-
263 literal 0 value.-
264*/-
265-
266/*!-
267 \fn QFlags::QFlags(QFlag value)-
268-
269 Constructs a QFlags object initialized with the given integer \a-
270 value.-
271-
272 The QFlag type is a helper type. By using it here instead of \c-
273 int, we effectively ensure that arbitrary enum values cannot be-
274 cast to a QFlags, whereas untyped enum values (i.e., \c int-
275 values) can.-
276*/-
277-
278/*!-
279 \fn QFlags::QFlags(std::initializer_list<Enum> flags)-
280 \since 5.4-
281-
282 Constructs a QFlags object initialized with all \a flags-
283 combined using the bitwise OR operator.-
284-
285 \sa operator|=(), operator|()-
286*/-
287-
288/*!-
289 \fn QFlags &QFlags::operator=(const QFlags &other)-
290-
291 Assigns \a other to this object and returns a reference to this-
292 object.-
293*/-
294-
295/*!-
296 \fn QFlags &QFlags::operator&=(int mask)-
297-
298 Performs a bitwise AND operation with \a mask and stores the-
299 result in this QFlags object. Returns a reference to this object.-
300-
301 \sa operator&(), operator|=(), operator^=()-
302*/-
303-
304/*!-
305 \fn QFlags &QFlags::operator&=(uint mask)-
306-
307 \overload-
308*/-
309-
310/*!-
311 \fn QFlags &QFlags::operator&=(Enum mask)-
312-
313 \overload-
314*/-
315-
316/*!-
317 \fn QFlags &QFlags::operator|=(QFlags other)-
318-
319 Performs a bitwise OR operation with \a other and stores the-
320 result in this QFlags object. Returns a reference to this object.-
321-
322 \sa operator|(), operator&=(), operator^=()-
323*/-
324-
325/*!-
326 \fn QFlags &QFlags::operator|=(Enum other)-
327-
328 \overload-
329*/-
330-
331/*!-
332 \fn QFlags &QFlags::operator^=(QFlags other)-
333-
334 Performs a bitwise XOR operation with \a other and stores the-
335 result in this QFlags object. Returns a reference to this object.-
336-
337 \sa operator^(), operator&=(), operator|=()-
338*/-
339-
340/*!-
341 \fn QFlags &QFlags::operator^=(Enum other)-
342-
343 \overload-
344*/-
345-
346/*!-
347 \fn QFlags::operator Int() const-
348-
349 Returns the value stored in the QFlags object as an integer.-
350-
351 \sa Int-
352*/-
353-
354/*!-
355 \fn QFlags QFlags::operator|(QFlags other) const-
356-
357 Returns a QFlags object containing the result of the bitwise OR-
358 operation on this object and \a other.-
359-
360 \sa operator|=(), operator^(), operator&(), operator~()-
361*/-
362-
363/*!-
364 \fn QFlags QFlags::operator|(Enum other) const-
365-
366 \overload-
367*/-
368-
369/*!-
370 \fn QFlags QFlags::operator^(QFlags other) const-
371-
372 Returns a QFlags object containing the result of the bitwise XOR-
373 operation on this object and \a other.-
374-
375 \sa operator^=(), operator&(), operator|(), operator~()-
376*/-
377-
378/*!-
379 \fn QFlags QFlags::operator^(Enum other) const-
380-
381 \overload-
382*/-
383-
384/*!-
385 \fn QFlags QFlags::operator&(int mask) const-
386-
387 Returns a QFlags object containing the result of the bitwise AND-
388 operation on this object and \a mask.-
389-
390 \sa operator&=(), operator|(), operator^(), operator~()-
391*/-
392-
393/*!-
394 \fn QFlags QFlags::operator&(uint mask) const-
395-
396 \overload-
397*/-
398-
399/*!-
400 \fn QFlags QFlags::operator&(Enum mask) const-
401-
402 \overload-
403*/-
404-
405/*!-
406 \fn QFlags QFlags::operator~() const-
407-
408 Returns a QFlags object that contains the bitwise negation of-
409 this object.-
410-
411 \sa operator&(), operator|(), operator^()-
412*/-
413-
414/*!-
415 \fn bool QFlags::operator!() const-
416-
417 Returns \c true if no flag is set (i.e., if the value stored by the-
418 QFlags object is 0); otherwise returns \c false.-
419*/-
420-
421/*!-
422 \fn bool QFlags::testFlag(Enum flag) const-
423 \since 4.2-
424-
425 Returns \c true if the \a flag is set, otherwise \c false.-
426*/-
427-
428/*!-
429 \fn QFlags QFlags::setFlag(Enum flag, bool on)-
430 \since 5.7-
431-
432 Sets the indicated \a flag if \a on is \c true or unsets it if-
433 \a on is \c false. Returns a reference to this object.-
434*/-
435-
436/*!-
437 \macro Q_DISABLE_COPY(Class)-
438 \relates QObject-
439-
440 Disables the use of copy constructors and assignment operators-
441 for the given \a Class.-
442-
443 Instances of subclasses of QObject should not be thought of as-
444 values that can be copied or assigned, but as unique identities.-
445 This means that when you create your own subclass of QObject-
446 (director or indirect), you should \e not give it a copy constructor-
447 or an assignment operator. However, it may not enough to simply-
448 omit them from your class, because, if you mistakenly write some code-
449 that requires a copy constructor or an assignment operator (it's easy-
450 to do), your compiler will thoughtfully create it for you. You must-
451 do more.-
452-
453 The curious user will have seen that the Qt classes derived-
454 from QObject typically include this macro in a private section:-
455-
456 \snippet code/src_corelib_global_qglobal.cpp 43-
457-
458 It declares a copy constructor and an assignment operator in the-
459 private section, so that if you use them by mistake, the compiler-
460 will report an error.-
461-
462 \snippet code/src_corelib_global_qglobal.cpp 44-
463-
464 But even this might not catch absolutely every case. You might be-
465 tempted to do something like this:-
466-
467 \snippet code/src_corelib_global_qglobal.cpp 45-
468-
469 First of all, don't do that. Most compilers will generate code that-
470 uses the copy constructor, so the privacy violation error will be-
471 reported, but your C++ compiler is not required to generate code for-
472 this statement in a specific way. It could generate code using-
473 \e{neither} the copy constructor \e{nor} the assignment operator we-
474 made private. In that case, no error would be reported, but your-
475 application would probably crash when you called a member function-
476 of \c{w}.-
477*/-
478-
479/*!-
480 \macro Q_DECLARE_FLAGS(Flags, Enum)-
481 \relates QFlags-
482-
483 The Q_DECLARE_FLAGS() macro expands to-
484-
485 \snippet code/src_corelib_global_qglobal.cpp 2-
486-
487 \a Enum is the name of an existing enum type, whereas \a Flags is-
488 the name of the QFlags<\e{Enum}> typedef.-
489-
490 See the QFlags documentation for details.-
491-
492 \sa Q_DECLARE_OPERATORS_FOR_FLAGS()-
493*/-
494-
495/*!-
496 \macro Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)-
497 \relates QFlags-
498-
499 The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global \c-
500 operator|() functions for \a Flags, which is of type QFlags<T>.-
501-
502 See the QFlags documentation for details.-
503-
504 \sa Q_DECLARE_FLAGS()-
505*/-
506-
507/*!-
508 \headerfile <QtGlobal>-
509 \title Global Qt Declarations-
510 \ingroup funclists-
511-
512 \brief The <QtGlobal> header file includes the fundamental global-
513 declarations. It is included by most other Qt header files.-
514-
515 The global declarations include \l{types}, \l{functions} and-
516 \l{macros}.-
517-
518 The type definitions are partly convenience definitions for basic-
519 types (some of which guarantee certain bit-sizes on all platforms-
520 supported by Qt), partly types related to Qt message handling. The-
521 functions are related to generating messages, Qt version handling-
522 and comparing and adjusting object values. And finally, some of-
523 the declared macros enable programmers to add compiler or platform-
524 specific code to their applications, while others are convenience-
525 macros for larger operations.-
526-
527 \section1 Types-
528-
529 The header file declares several type definitions that guarantee a-
530 specified bit-size on all platforms supported by Qt for various-
531 basic types, for example \l qint8 which is a signed char-
532 guaranteed to be 8-bit on all platforms supported by Qt. The-
533 header file also declares the \l qlonglong type definition for \c-
534 {long long int } (\c __int64 on Windows).-
535-
536 Several convenience type definitions are declared: \l qreal for \c-
537 double, \l uchar for \c unsigned char, \l uint for \c unsigned-
538 int, \l ulong for \c unsigned long and \l ushort for \c unsigned-
539 short.-
540-
541 Finally, the QtMsgType definition identifies the various messages-
542 that can be generated and sent to a Qt message handler;-
543 QtMessageHandler is a type definition for a pointer to a function with-
544 the signature-
545 \c {void myMessageHandler(QtMsgType, const QMessageLogContext &, const char *)}.-
546 QMessageLogContext class contains the line, file, and function the-
547 message was logged at. This information is created by the QMessageLogger-
548 class.-
549-
550 \section1 Functions-
551-
552 The <QtGlobal> header file contains several functions comparing-
553 and adjusting an object's value. These functions take a template-
554 type as argument: You can retrieve the absolute value of an object-
555 using the qAbs() function, and you can bound a given object's-
556 value by given minimum and maximum values using the qBound()-
557 function. You can retrieve the minimum and maximum of two given-
558 objects using qMin() and qMax() respectively. All these functions-
559 return a corresponding template type; the template types can be-
560 replaced by any other type.-
561-
562 Example:-
563-
564 \snippet code/src_corelib_global_qglobal.cpp 3-
565-
566 <QtGlobal> also contains functions that generate messages from the-
567 given string argument: qDebug(), qInfo(), qWarning(), qCritical(),-
568 and qFatal(). These functions call the message handler-
569 with the given message.-
570-
571 Example:-
572-
573 \snippet code/src_corelib_global_qglobal.cpp 4-
574-
575 The remaining functions are qRound() and qRound64(), which both-
576 accept a \l qreal value as their argument returning the value-
577 rounded up to the nearest integer and 64-bit integer respectively,-
578 the qInstallMessageHandler() function which installs the given-
579 QtMessageHandler, and the qVersion() function which returns the-
580 version number of Qt at run-time as a string.-
581-
582 \section1 Macros-
583-
584 The <QtGlobal> header file provides a range of macros (Q_CC_*)-
585 that are defined if the application is compiled using the-
586 specified platforms. For example, the Q_CC_SUN macro is defined if-
587 the application is compiled using Forte Developer, or Sun Studio-
588 C++. The header file also declares a range of macros (Q_OS_*)-
589 that are defined for the specified platforms. For example,-
590 Q_OS_UNIX which is defined for the Unix-based systems.-
591-
592 The purpose of these macros is to enable programmers to add-
593 compiler or platform specific code to their application.-
594-
595 The remaining macros are convenience macros for larger operations:-
596 The QT_TRANSLATE_NOOP() and QT_TR_NOOP() macros provide the-
597 possibility of marking text for dynamic translation,-
598 i.e. translation without changing the stored source text. The-
599 Q_ASSERT() and Q_ASSERT_X() enables warning messages of various-
600 level of refinement. The Q_FOREACH() and foreach() macros-
601 implement Qt's foreach loop.-
602-
603 The Q_INT64_C() and Q_UINT64_C() macros wrap signed and unsigned-
604 64-bit integer literals in a platform-independent way. The-
605 Q_CHECK_PTR() macro prints a warning containing the source code's-
606 file name and line number, saying that the program ran out of-
607 memory, if the pointer is 0. The qPrintable() and qUtf8Printable()-
608 macros represent an easy way of printing text.-
609-
610 Finally, the QT_POINTER_SIZE macro expands to the size of a-
611 pointer in bytes, and the QT_VERSION and QT_VERSION_STR macros-
612 expand to a numeric value or a string, respectively, specifying-
613 Qt's version number, i.e the version the application is compiled-
614 against.-
615-
616 \sa <QtAlgorithms>, QSysInfo-
617*/-
618-
619/*!-
620 \typedef qreal-
621 \relates <QtGlobal>-
622-
623 Typedef for \c double unless Qt is configured with the-
624 \c{-qreal float} option.-
625*/-
626-
627/*! \typedef uchar-
628 \relates <QtGlobal>-
629-
630 Convenience typedef for \c{unsigned char}.-
631*/-
632-
633/*! \typedef ushort-
634 \relates <QtGlobal>-
635-
636 Convenience typedef for \c{unsigned short}.-
637*/-
638-
639/*! \typedef uint-
640 \relates <QtGlobal>-
641-
642 Convenience typedef for \c{unsigned int}.-
643*/-
644-
645/*! \typedef ulong-
646 \relates <QtGlobal>-
647-
648 Convenience typedef for \c{unsigned long}.-
649*/-
650-
651/*! \typedef qint8-
652 \relates <QtGlobal>-
653-
654 Typedef for \c{signed char}. This type is guaranteed to be 8-bit-
655 on all platforms supported by Qt.-
656*/-
657-
658/*!-
659 \typedef quint8-
660 \relates <QtGlobal>-
661-
662 Typedef for \c{unsigned char}. This type is guaranteed to-
663 be 8-bit on all platforms supported by Qt.-
664*/-
665-
666/*! \typedef qint16-
667 \relates <QtGlobal>-
668-
669 Typedef for \c{signed short}. This type is guaranteed to be-
670 16-bit on all platforms supported by Qt.-
671*/-
672-
673/*!-
674 \typedef quint16-
675 \relates <QtGlobal>-
676-
677 Typedef for \c{unsigned short}. This type is guaranteed to-
678 be 16-bit on all platforms supported by Qt.-
679*/-
680-
681/*! \typedef qint32-
682 \relates <QtGlobal>-
683-
684 Typedef for \c{signed int}. This type is guaranteed to be 32-bit-
685 on all platforms supported by Qt.-
686*/-
687-
688/*!-
689 \typedef quint32-
690 \relates <QtGlobal>-
691-
692 Typedef for \c{unsigned int}. This type is guaranteed to-
693 be 32-bit on all platforms supported by Qt.-
694*/-
695-
696/*! \typedef qint64-
697 \relates <QtGlobal>-
698-
699 Typedef for \c{long long int} (\c __int64 on Windows). This type-
700 is guaranteed to be 64-bit on all platforms supported by Qt.-
701-
702 Literals of this type can be created using the Q_INT64_C() macro:-
703-
704 \snippet code/src_corelib_global_qglobal.cpp 5-
705-
706 \sa Q_INT64_C(), quint64, qlonglong-
707*/-
708-
709/*!-
710 \typedef quint64-
711 \relates <QtGlobal>-
712-
713 Typedef for \c{unsigned long long int} (\c{unsigned __int64} on-
714 Windows). This type is guaranteed to be 64-bit on all platforms-
715 supported by Qt.-
716-
717 Literals of this type can be created using the Q_UINT64_C()-
718 macro:-
719-
720 \snippet code/src_corelib_global_qglobal.cpp 6-
721-
722 \sa Q_UINT64_C(), qint64, qulonglong-
723*/-
724-
725/*!-
726 \typedef qintptr-
727 \relates <QtGlobal>-
728-
729 Integral type for representing pointers in a signed integer (useful for-
730 hashing, etc.).-
731-
732 Typedef for either qint32 or qint64. This type is guaranteed to-
733 be the same size as a pointer on all platforms supported by Qt. On-
734 a system with 32-bit pointers, qintptr is a typedef for qint32;-
735 on a system with 64-bit pointers, qintptr is a typedef for-
736 qint64.-
737-
738 Note that qintptr is signed. Use quintptr for unsigned values.-
739-
740 \sa qptrdiff, qint32, qint64-
741*/-
742-
743/*!-
744 \typedef quintptr-
745 \relates <QtGlobal>-
746-
747 Integral type for representing pointers in an unsigned integer (useful for-
748 hashing, etc.).-
749-
750 Typedef for either quint32 or quint64. This type is guaranteed to-
751 be the same size as a pointer on all platforms supported by Qt. On-
752 a system with 32-bit pointers, quintptr is a typedef for quint32;-
753 on a system with 64-bit pointers, quintptr is a typedef for-
754 quint64.-
755-
756 Note that quintptr is unsigned. Use qptrdiff for signed values.-
757-
758 \sa qptrdiff, quint32, quint64-
759*/-
760-
761/*!-
762 \typedef qptrdiff-
763 \relates <QtGlobal>-
764-
765 Integral type for representing pointer differences.-
766-
767 Typedef for either qint32 or qint64. This type is guaranteed to be-
768 the same size as a pointer on all platforms supported by Qt. On a-
769 system with 32-bit pointers, quintptr is a typedef for quint32; on-
770 a system with 64-bit pointers, quintptr is a typedef for quint64.-
771-
772 Note that qptrdiff is signed. Use quintptr for unsigned values.-
773-
774 \sa quintptr, qint32, qint64-
775*/-
776-
777/*!-
778 \enum QtMsgType-
779 \relates <QtGlobal>-
780-
781 This enum describes the messages that can be sent to a message-
782 handler (QtMessageHandler). You can use the enum to identify and-
783 associate the various message types with the appropriate-
784 actions.-
785-
786 \value QtDebugMsg-
787 A message generated by the qDebug() function.-
788 \value QtInfoMsg-
789 A message generated by the qInfo() function.-
790 \value QtWarningMsg-
791 A message generated by the qWarning() function.-
792 \value QtCriticalMsg-
793 A message generated by the qCritical() function.-
794 \value QtFatalMsg-
795 A message generated by the qFatal() function.-
796 \value QtSystemMsg-
797-
798 \c QtInfoMsg was added in Qt 5.5.-
799-
800 \sa QtMessageHandler, qInstallMessageHandler()-
801*/-
802-
803/*! \typedef QFunctionPointer-
804 \relates <QtGlobal>-
805-
806 This is a typedef for \c{void (*)()}, a pointer to a function that takes-
807 no arguments and returns void.-
808*/-
809-
810/*! \macro qint64 Q_INT64_C(literal)-
811 \relates <QtGlobal>-
812-
813 Wraps the signed 64-bit integer \a literal in a-
814 platform-independent way.-
815-
816 Example:-
817-
818 \snippet code/src_corelib_global_qglobal.cpp 8-
819-
820 \sa qint64, Q_UINT64_C()-
821*/-
822-
823/*! \macro quint64 Q_UINT64_C(literal)-
824 \relates <QtGlobal>-
825-
826 Wraps the unsigned 64-bit integer \a literal in a-
827 platform-independent way.-
828-
829 Example:-
830-
831 \snippet code/src_corelib_global_qglobal.cpp 9-
832-
833 \sa quint64, Q_INT64_C()-
834*/-
835-
836/*! \typedef qlonglong-
837 \relates <QtGlobal>-
838-
839 Typedef for \c{long long int} (\c __int64 on Windows). This is-
840 the same as \l qint64.-
841-
842 \sa qulonglong, qint64-
843*/-
844-
845/*!-
846 \typedef qulonglong-
847 \relates <QtGlobal>-
848-
849 Typedef for \c{unsigned long long int} (\c{unsigned __int64} on-
850 Windows). This is the same as \l quint64.-
851-
852 \sa quint64, qlonglong-
853*/-
854-
855/*! \fn T qAbs(const T &value)-
856 \relates <QtGlobal>-
857-
858 Compares \a value to the 0 of type T and returns the absolute-
859 value. Thus if T is \e {double}, then \a value is compared to-
860 \e{(double) 0}.-
861-
862 Example:-
863-
864 \snippet code/src_corelib_global_qglobal.cpp 10-
865*/-
866-
867/*! \fn int qRound(qreal value)-
868 \relates <QtGlobal>-
869-
870 Rounds \a value to the nearest integer.-
871-
872 Example:-
873-
874 \snippet code/src_corelib_global_qglobal.cpp 11-
875*/-
876-
877/*! \fn qint64 qRound64(qreal value)-
878 \relates <QtGlobal>-
879-
880 Rounds \a value to the nearest 64-bit integer.-
881-
882 Example:-
883-
884 \snippet code/src_corelib_global_qglobal.cpp 12-
885*/-
886-
887/*! \fn const T &qMin(const T &value1, const T &value2)-
888 \relates <QtGlobal>-
889-
890 Returns the minimum of \a value1 and \a value2.-
891-
892 Example:-
893-
894 \snippet code/src_corelib_global_qglobal.cpp 13-
895-
896 \sa qMax(), qBound()-
897*/-
898-
899/*! \fn const T &qMax(const T &value1, const T &value2)-
900 \relates <QtGlobal>-
901-
902 Returns the maximum of \a value1 and \a value2.-
903-
904 Example:-
905-
906 \snippet code/src_corelib_global_qglobal.cpp 14-
907-
908 \sa qMin(), qBound()-
909*/-
910-
911/*! \fn const T &qBound(const T &min, const T &value, const T &max)-
912 \relates <QtGlobal>-
913-
914 Returns \a value bounded by \a min and \a max. This is equivalent-
915 to qMax(\a min, qMin(\a value, \a max)).-
916-
917 Example:-
918-
919 \snippet code/src_corelib_global_qglobal.cpp 15-
920-
921 \sa qMin(), qMax()-
922*/-
923-
924/*! \fn auto qOverload(T functionPointer)-
925 \relates <QtGlobal>-
926 \since 5.7-
927-
928 Returns a pointer to an overloaded function. The template-
929 parameter is the list of the argument types of the function.-
930 \a functionPointer is the pointer to the (member) function:-
931-
932 \snippet code/src_corelib_global_qglobal.cpp 52-
933-
934 If a member function is also const-overloaded \l qConstOverload and-
935 \l qNonConstOverload need to be used.-
936-
937 qOverload() requires C++14 enabled. In C++11-only code, the helper-
938 classes QOverload, QConstOverload, and QNonConstOverload can be used directly:-
939-
940 \snippet code/src_corelib_global_qglobal.cpp 53-
941-
942 \sa qConstOverload(), qNonConstOverload()-
943*/-
944-
945/*! \fn auto qConstOverload(T memberFunctionPointer)-
946 \relates <QtGlobal>-
947 \since 5.7-
948-
949 Returns the \a memberFunctionPointer pointer to a constant member function:-
950-
951 \snippet code/src_corelib_global_qglobal.cpp 54-
952-
953 \sa qOverload, qNonConstOverload-
954*/-
955-
956/*! \fn auto qNonConstOverload(T memberFunctionPointer)-
957 \relates <QtGlobal>-
958 \since 5.7-
959-
960 Returns the \a memberFunctionPointer pointer to a non-constant member function:-
961-
962 \snippet code/src_corelib_global_qglobal.cpp 54-
963-
964 \sa qOverload, qNonConstOverload-
965*/-
966-
967/*!-
968 \macro QT_VERSION_CHECK-
969 \relates <QtGlobal>-
970-
971 Turns the major, minor and patch numbers of a version into an-
972 integer, 0xMMNNPP (MM = major, NN = minor, PP = patch). This can-
973 be compared with another similarly processed version id.-
974-
975 Example:-
976-
977 \snippet code/src_corelib_global_qglobal.cpp qt-version-check-
978-
979 \sa QT_VERSION-
980*/-
981-
982/*!-
983 \macro QT_VERSION-
984 \relates <QtGlobal>-
985-
986 This macro expands a numeric value of the form 0xMMNNPP (MM =-
987 major, NN = minor, PP = patch) that specifies Qt's version-
988 number. For example, if you compile your application against Qt-
989 4.1.2, the QT_VERSION macro will expand to 0x040102.-
990-
991 You can use QT_VERSION to use the latest Qt features where-
992 available.-
993-
994 Example:-
995-
996 \snippet code/src_corelib_global_qglobal.cpp 16-
997-
998 \sa QT_VERSION_STR, qVersion()-
999*/-
1000-
1001/*!-
1002 \macro QT_VERSION_STR-
1003 \relates <QtGlobal>-
1004-
1005 This macro expands to a string that specifies Qt's version number-
1006 (for example, "4.1.2"). This is the version against which the-
1007 application is compiled.-
1008-
1009 \sa qVersion(), QT_VERSION-
1010*/-
1011-
1012/*!-
1013 \relates <QtGlobal>-
1014-
1015 Returns the version number of Qt at run-time as a string (for-
1016 example, "4.1.2"). This may be a different version than the-
1017 version the application was compiled against.-
1018-
1019 \sa QT_VERSION_STR-
1020*/-
1021-
1022const char *qVersion() Q_DECL_NOTHROW-
1023{-
1024 return QT_VERSION_STR;
executed 585 times by 2 tests: return "5.7.1";
Executed by:
  • tst_Lancelot
  • tst_selftests - unknown status
585
1025}-
1026-
1027bool qSharedBuild() Q_DECL_NOTHROW-
1028{-
1029#ifdef QT_SHARED-
1030 return true;
never executed: return true;
0
1031#else-
1032 return false;-
1033#endif-
1034}-
1035-
1036/*****************************************************************************-
1037 System detection routines-
1038 *****************************************************************************/-
1039-
1040/*!-
1041 \class QSysInfo-
1042 \inmodule QtCore-
1043 \brief The QSysInfo class provides information about the system.-
1044-
1045 \list-
1046 \li \l WordSize specifies the size of a pointer for the platform-
1047 on which the application is compiled.-
1048 \li \l ByteOrder specifies whether the platform is big-endian or-
1049 little-endian.-
1050 \li \l WindowsVersion specifies the version of the Windows operating-
1051 system on which the application is run.-
1052 \li \l MacintoshVersion specifies the version of the Macintosh-
1053 operating system on which the application is run.-
1054 \endlist-
1055-
1056 Some constants are defined only on certain platforms. You can use-
1057 the preprocessor symbols Q_OS_WIN and Q_OS_MACOS to test that-
1058 the application is compiled under Windows or \macos.-
1059-
1060 \sa QLibraryInfo-
1061*/-
1062-
1063/*!-
1064 \enum QSysInfo::Sizes-
1065-
1066 This enum provides platform-specific information about the sizes of data-
1067 structures used by the underlying architecture.-
1068-
1069 \value WordSize The size in bits of a pointer for the platform on which-
1070 the application is compiled (32 or 64).-
1071*/-
1072-
1073/*!-
1074 \variable QSysInfo::WindowsVersion-
1075 \brief the version of the Windows operating system on which the-
1076 application is run.-
1077*/-
1078-
1079/*!-
1080 \fn QSysInfo::WindowsVersion QSysInfo::windowsVersion()-
1081 \since 4.4-
1082-
1083 Returns the version of the Windows operating system on which the-
1084 application is run, or WV_None if the operating system is not-
1085 Windows.-
1086*/-
1087-
1088/*!-
1089 \variable QSysInfo::MacintoshVersion-
1090 \brief the version of the Macintosh operating system on which-
1091 the application is run.-
1092*/-
1093-
1094/*!-
1095 \fn QSysInfo::MacVersion QSysInfo::macVersion()-
1096-
1097 Returns the version of Darwin (\macos or iOS) on which the-
1098 application is run, or MV_None if the operating system-
1099 is not a version of Darwin.-
1100*/-
1101-
1102/*!-
1103 \enum QSysInfo::Endian-
1104-
1105 \value BigEndian Big-endian byte order (also called Network byte order)-
1106 \value LittleEndian Little-endian byte order-
1107 \value ByteOrder Equals BigEndian or LittleEndian, depending on-
1108 the platform's byte order.-
1109*/-
1110-
1111/*!-
1112 \enum QSysInfo::WinVersion-
1113-
1114 This enum provides symbolic names for the various versions of the-
1115 Windows operating system. On Windows, the-
1116 QSysInfo::WindowsVersion variable gives the version of the system-
1117 on which the application is run.-
1118-
1119 MS-DOS-based versions:-
1120-
1121 \value WV_32s Windows 3.1 with Win 32s-
1122 \value WV_95 Windows 95-
1123 \value WV_98 Windows 98-
1124 \value WV_Me Windows Me-
1125-
1126 NT-based versions (note that each operating system version is only represented once rather than each Windows edition):-
1127-
1128 \value WV_NT Windows NT (operating system version 4.0)-
1129 \value WV_2000 Windows 2000 (operating system version 5.0)-
1130 \value WV_XP Windows XP (operating system version 5.1)-
1131 \value WV_2003 Windows Server 2003, Windows Server 2003 R2, Windows Home Server, Windows XP Professional x64 Edition (operating system version 5.2)-
1132 \value WV_VISTA Windows Vista, Windows Server 2008 (operating system version 6.0)-
1133 \value WV_WINDOWS7 Windows 7, Windows Server 2008 R2 (operating system version 6.1)-
1134 \value WV_WINDOWS8 Windows 8 (operating system version 6.2)-
1135 \value WV_WINDOWS8_1 Windows 8.1 (operating system version 6.3), introduced in Qt 5.2-
1136 \value WV_WINDOWS10 Windows 10 (operating system version 10.0), introduced in Qt 5.5-
1137-
1138 Alternatively, you may use the following macros which correspond directly to the Windows operating system version number:-
1139-
1140 \value WV_4_0 Operating system version 4.0, corresponds to Windows NT-
1141 \value WV_5_0 Operating system version 5.0, corresponds to Windows 2000-
1142 \value WV_5_1 Operating system version 5.1, corresponds to Windows XP-
1143 \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-
1144 \value WV_6_0 Operating system version 6.0, corresponds to Windows Vista and Windows Server 2008-
1145 \value WV_6_1 Operating system version 6.1, corresponds to Windows 7 and Windows Server 2008 R2-
1146 \value WV_6_2 Operating system version 6.2, corresponds to Windows 8-
1147 \value WV_6_3 Operating system version 6.3, corresponds to Windows 8.1, introduced in Qt 5.2-
1148 \value WV_10_0 Operating system version 10.0, corresponds to Windows 10, introduced in Qt 5.5-
1149-
1150 \omitvalue WV_CE-
1151 \omitvalue WV_CENET-
1152 \omitvalue WV_CE_5-
1153 \omitvalue WV_CE_6-
1154-
1155 The following masks can be used for testing whether a Windows-
1156 version is MS-DOS-based or NT-based:-
1157-
1158 \value WV_DOS_based MS-DOS-based version of Windows-
1159 \value WV_NT_based NT-based version of Windows-
1160 \omitvalue WV_CE_based-
1161-
1162 \value WV_None Operating system other than Windows.-
1163-
1164 \sa MacVersion-
1165*/-
1166-
1167/*!-
1168 \enum QSysInfo::MacVersion-
1169-
1170 This enum provides symbolic names for the various versions of the-
1171 Darwin operating system, covering both \macos and iOS. The-
1172 QSysInfo::MacintoshVersion variable gives the version of the-
1173 system on which the application is run.-
1174-
1175 \value MV_9 \macos 9-
1176 \value MV_10_0 \macos 10.0-
1177 \value MV_10_1 \macos 10.1-
1178 \value MV_10_2 \macos 10.2-
1179 \value MV_10_3 \macos 10.3-
1180 \value MV_10_4 \macos 10.4-
1181 \value MV_10_5 \macos 10.5-
1182 \value MV_10_6 \macos 10.6-
1183 \value MV_10_7 \macos 10.7-
1184 \value MV_10_8 \macos 10.8-
1185 \value MV_10_9 \macos 10.9-
1186 \value MV_10_10 \macos 10.10-
1187 \value MV_10_11 \macos 10.11-
1188 \value MV_10_12 \macos 10.12-
1189 \value MV_Unknown An unknown and currently unsupported platform-
1190-
1191 \value MV_CHEETAH Apple codename for MV_10_0-
1192 \value MV_PUMA Apple codename for MV_10_1-
1193 \value MV_JAGUAR Apple codename for MV_10_2-
1194 \value MV_PANTHER Apple codename for MV_10_3-
1195 \value MV_TIGER Apple codename for MV_10_4-
1196 \value MV_LEOPARD Apple codename for MV_10_5-
1197 \value MV_SNOWLEOPARD Apple codename for MV_10_6-
1198 \value MV_LION Apple codename for MV_10_7-
1199 \value MV_MOUNTAINLION Apple codename for MV_10_8-
1200 \value MV_MAVERICKS Apple codename for MV_10_9-
1201 \value MV_YOSEMITE Apple codename for MV_10_10-
1202 \value MV_ELCAPITAN Apple codename for MV_10_11-
1203 \value MV_SIERRA Apple codename for MV_10_12-
1204-
1205 \value MV_IOS iOS (any)-
1206 \value MV_IOS_4_3 iOS 4.3-
1207 \value MV_IOS_5_0 iOS 5.0-
1208 \value MV_IOS_5_1 iOS 5.1-
1209 \value MV_IOS_6_0 iOS 6.0-
1210 \value MV_IOS_6_1 iOS 6.1-
1211 \value MV_IOS_7_0 iOS 7.0-
1212 \value MV_IOS_7_1 iOS 7.1-
1213 \value MV_IOS_8_0 iOS 8.0-
1214 \value MV_IOS_8_1 iOS 8.1-
1215 \value MV_IOS_8_2 iOS 8.2-
1216 \value MV_IOS_8_3 iOS 8.3-
1217 \value MV_IOS_8_4 iOS 8.4-
1218 \value MV_IOS_9_0 iOS 9.0-
1219 \value MV_IOS_9_1 iOS 9.1-
1220 \value MV_IOS_9_2 iOS 9.2-
1221 \value MV_IOS_9_3 iOS 9.3-
1222 \value MV_IOS_10_0 iOS 10.0-
1223-
1224 \value MV_None Not a Darwin operating system-
1225-
1226 \sa WinVersion-
1227*/-
1228-
1229/*!-
1230 \macro Q_OS_DARWIN-
1231 \relates <QtGlobal>-
1232-
1233 Defined on Darwin-based operating systems such as \macos, iOS, watchOS, and tvOS.-
1234*/-
1235-
1236/*!-
1237 \macro Q_OS_MAC-
1238 \relates <QtGlobal>-
1239-
1240 Deprecated synonym for \c Q_OS_DARWIN. Do not use.-
1241 */-
1242-
1243/*!-
1244 \macro Q_OS_OSX-
1245 \relates <QtGlobal>-
1246-
1247 Deprecated synonym for \c Q_OS_MACOS. Do not use.-
1248 */-
1249-
1250/*!-
1251 \macro Q_OS_MACOS-
1252 \relates <QtGlobal>-
1253-
1254 Defined on \macos.-
1255 */-
1256-
1257/*!-
1258 \macro Q_OS_IOS-
1259 \relates <QtGlobal>-
1260-
1261 Defined on iOS.-
1262 */-
1263-
1264/*!-
1265 \macro Q_OS_WATCHOS-
1266 \relates <QtGlobal>-
1267-
1268 Defined on watchOS.-
1269 */-
1270-
1271/*!-
1272 \macro Q_OS_TVOS-
1273 \relates <QtGlobal>-
1274-
1275 Defined on tvOS.-
1276 */-
1277-
1278/*!-
1279 \macro Q_OS_WIN-
1280 \relates <QtGlobal>-
1281-
1282 Defined on all supported versions of Windows. That is, if-
1283 \l Q_OS_WIN32, \l Q_OS_WIN64, or \l Q_OS_WINRT is defined.-
1284*/-
1285-
1286/*!-
1287 \macro Q_OS_WIN32-
1288 \relates <QtGlobal>-
1289-
1290 Defined on 32-bit and 64-bit versions of Windows.-
1291*/-
1292-
1293/*!-
1294 \macro Q_OS_WIN64-
1295 \relates <QtGlobal>-
1296-
1297 Defined on 64-bit versions of Windows.-
1298*/-
1299-
1300/*!-
1301 \macro Q_OS_WINRT-
1302 \relates <QtGlobal>-
1303-
1304 Defined for Windows Runtime (Windows Store apps) on Windows 8, Windows RT,-
1305 and Windows Phone 8.-
1306*/-
1307-
1308/*!-
1309 \macro Q_OS_WINPHONE-
1310 \relates <QtGlobal>-
1311-
1312 Defined on Windows Phone 8.-
1313*/-
1314-
1315/*!-
1316 \macro Q_OS_CYGWIN-
1317 \relates <QtGlobal>-
1318-
1319 Defined on Cygwin.-
1320*/-
1321-
1322/*!-
1323 \macro Q_OS_SOLARIS-
1324 \relates <QtGlobal>-
1325-
1326 Defined on Sun Solaris.-
1327*/-
1328-
1329/*!-
1330 \macro Q_OS_HPUX-
1331 \relates <QtGlobal>-
1332-
1333 Defined on HP-UX.-
1334*/-
1335-
1336/*!-
1337 \macro Q_OS_ULTRIX-
1338 \relates <QtGlobal>-
1339-
1340 Defined on DEC Ultrix.-
1341*/-
1342-
1343/*!-
1344 \macro Q_OS_LINUX-
1345 \relates <QtGlobal>-
1346-
1347 Defined on Linux.-
1348*/-
1349-
1350/*!-
1351 \macro Q_OS_ANDROID-
1352 \relates <QtGlobal>-
1353-
1354 Defined on Android.-
1355*/-
1356-
1357/*!-
1358 \macro Q_OS_FREEBSD-
1359 \relates <QtGlobal>-
1360-
1361 Defined on FreeBSD.-
1362*/-
1363-
1364/*!-
1365 \macro Q_OS_NETBSD-
1366 \relates <QtGlobal>-
1367-
1368 Defined on NetBSD.-
1369*/-
1370-
1371/*!-
1372 \macro Q_OS_OPENBSD-
1373 \relates <QtGlobal>-
1374-
1375 Defined on OpenBSD.-
1376*/-
1377-
1378/*!-
1379 \macro Q_OS_BSDI-
1380 \relates <QtGlobal>-
1381-
1382 Defined on BSD/OS.-
1383*/-
1384-
1385/*!-
1386 \macro Q_OS_IRIX-
1387 \relates <QtGlobal>-
1388-
1389 Defined on SGI Irix.-
1390*/-
1391-
1392/*!-
1393 \macro Q_OS_OSF-
1394 \relates <QtGlobal>-
1395-
1396 Defined on HP Tru64 UNIX.-
1397*/-
1398-
1399/*!-
1400 \macro Q_OS_SCO-
1401 \relates <QtGlobal>-
1402-
1403 Defined on SCO OpenServer 5.-
1404*/-
1405-
1406/*!-
1407 \macro Q_OS_UNIXWARE-
1408 \relates <QtGlobal>-
1409-
1410 Defined on UnixWare 7, Open UNIX 8.-
1411*/-
1412-
1413/*!-
1414 \macro Q_OS_AIX-
1415 \relates <QtGlobal>-
1416-
1417 Defined on AIX.-
1418*/-
1419-
1420/*!-
1421 \macro Q_OS_HURD-
1422 \relates <QtGlobal>-
1423-
1424 Defined on GNU Hurd.-
1425*/-
1426-
1427/*!-
1428 \macro Q_OS_DGUX-
1429 \relates <QtGlobal>-
1430-
1431 Defined on DG/UX.-
1432*/-
1433-
1434/*!-
1435 \macro Q_OS_RELIANT-
1436 \relates <QtGlobal>-
1437-
1438 Defined on Reliant UNIX.-
1439*/-
1440-
1441/*!-
1442 \macro Q_OS_DYNIX-
1443 \relates <QtGlobal>-
1444-
1445 Defined on DYNIX/ptx.-
1446*/-
1447-
1448/*!-
1449 \macro Q_OS_QNX-
1450 \relates <QtGlobal>-
1451-
1452 Defined on QNX Neutrino.-
1453*/-
1454-
1455/*!-
1456 \macro Q_OS_LYNX-
1457 \relates <QtGlobal>-
1458-
1459 Defined on LynxOS.-
1460*/-
1461-
1462/*!-
1463 \macro Q_OS_BSD4-
1464 \relates <QtGlobal>-
1465-
1466 Defined on Any BSD 4.4 system.-
1467*/-
1468-
1469/*!-
1470 \macro Q_OS_UNIX-
1471 \relates <QtGlobal>-
1472-
1473 Defined on Any UNIX BSD/SYSV system.-
1474*/-
1475-
1476/*!-
1477 \macro Q_CC_SYM-
1478 \relates <QtGlobal>-
1479-
1480 Defined if the application is compiled using Digital Mars C/C++-
1481 (used to be Symantec C++).-
1482*/-
1483-
1484/*!-
1485 \macro Q_CC_MSVC-
1486 \relates <QtGlobal>-
1487-
1488 Defined if the application is compiled using Microsoft Visual-
1489 C/C++, Intel C++ for Windows.-
1490*/-
1491-
1492/*!-
1493 \macro Q_CC_BOR-
1494 \relates <QtGlobal>-
1495-
1496 Defined if the application is compiled using Borland/Turbo C++.-
1497*/-
1498-
1499/*!-
1500 \macro Q_CC_WAT-
1501 \relates <QtGlobal>-
1502-
1503 Defined if the application is compiled using Watcom C++.-
1504*/-
1505-
1506/*!-
1507 \macro Q_CC_GNU-
1508 \relates <QtGlobal>-
1509-
1510 Defined if the application is compiled using GNU C++.-
1511*/-
1512-
1513/*!-
1514 \macro Q_CC_COMEAU-
1515 \relates <QtGlobal>-
1516-
1517 Defined if the application is compiled using Comeau C++.-
1518*/-
1519-
1520/*!-
1521 \macro Q_CC_EDG-
1522 \relates <QtGlobal>-
1523-
1524 Defined if the application is compiled using Edison Design Group-
1525 C++.-
1526*/-
1527-
1528/*!-
1529 \macro Q_CC_OC-
1530 \relates <QtGlobal>-
1531-
1532 Defined if the application is compiled using CenterLine C++.-
1533*/-
1534-
1535/*!-
1536 \macro Q_CC_SUN-
1537 \relates <QtGlobal>-
1538-
1539 Defined if the application is compiled using Forte Developer, or-
1540 Sun Studio C++.-
1541*/-
1542-
1543/*!-
1544 \macro Q_CC_MIPS-
1545 \relates <QtGlobal>-
1546-
1547 Defined if the application is compiled using MIPSpro C++.-
1548*/-
1549-
1550/*!-
1551 \macro Q_CC_DEC-
1552 \relates <QtGlobal>-
1553-
1554 Defined if the application is compiled using DEC C++.-
1555*/-
1556-
1557/*!-
1558 \macro Q_CC_HPACC-
1559 \relates <QtGlobal>-
1560-
1561 Defined if the application is compiled using HP aC++.-
1562*/-
1563-
1564/*!-
1565 \macro Q_CC_USLC-
1566 \relates <QtGlobal>-
1567-
1568 Defined if the application is compiled using SCO OUDK and UDK.-
1569*/-
1570-
1571/*!-
1572 \macro Q_CC_CDS-
1573 \relates <QtGlobal>-
1574-
1575 Defined if the application is compiled using Reliant C++.-
1576*/-
1577-
1578/*!-
1579 \macro Q_CC_KAI-
1580 \relates <QtGlobal>-
1581-
1582 Defined if the application is compiled using KAI C++.-
1583*/-
1584-
1585/*!-
1586 \macro Q_CC_INTEL-
1587 \relates <QtGlobal>-
1588-
1589 Defined if the application is compiled using Intel C++ for Linux,-
1590 Intel C++ for Windows.-
1591*/-
1592-
1593/*!-
1594 \macro Q_CC_HIGHC-
1595 \relates <QtGlobal>-
1596-
1597 Defined if the application is compiled using MetaWare High C/C++.-
1598*/-
1599-
1600/*!-
1601 \macro Q_CC_PGI-
1602 \relates <QtGlobal>-
1603-
1604 Defined if the application is compiled using Portland Group C++.-
1605*/-
1606-
1607/*!-
1608 \macro Q_CC_GHS-
1609 \relates <QtGlobal>-
1610-
1611 Defined if the application is compiled using Green Hills-
1612 Optimizing C++ Compilers.-
1613*/-
1614-
1615/*!-
1616 \macro Q_PROCESSOR_ALPHA-
1617 \relates <QtGlobal>-
1618-
1619 Defined if the application is compiled for Alpha processors.-
1620-
1621 \sa QSysInfo::buildCpuArchitecture()-
1622*/-
1623-
1624/*!-
1625 \macro Q_PROCESSOR_ARM-
1626 \relates <QtGlobal>-
1627-
1628 Defined if the application is compiled for ARM processors. Qt currently-
1629 supports three optional ARM revisions: \l Q_PROCESSOR_ARM_V5, \l-
1630 Q_PROCESSOR_ARM_V6, and \l Q_PROCESSOR_ARM_V7.-
1631-
1632 \sa QSysInfo::buildCpuArchitecture()-
1633*/-
1634/*!-
1635 \macro Q_PROCESSOR_ARM_V5-
1636 \relates <QtGlobal>-
1637-
1638 Defined if the application is compiled for ARMv5 processors. The \l-
1639 Q_PROCESSOR_ARM macro is also defined when Q_PROCESSOR_ARM_V5 is defined.-
1640-
1641 \sa QSysInfo::buildCpuArchitecture()-
1642*/-
1643/*!-
1644 \macro Q_PROCESSOR_ARM_V6-
1645 \relates <QtGlobal>-
1646-
1647 Defined if the application is compiled for ARMv6 processors. The \l-
1648 Q_PROCESSOR_ARM and \l Q_PROCESSOR_ARM_V5 macros are also defined when-
1649 Q_PROCESSOR_ARM_V6 is defined.-
1650-
1651 \sa QSysInfo::buildCpuArchitecture()-
1652*/-
1653/*!-
1654 \macro Q_PROCESSOR_ARM_V7-
1655 \relates <QtGlobal>-
1656-
1657 Defined if the application is compiled for ARMv7 processors. The \l-
1658 Q_PROCESSOR_ARM, \l Q_PROCESSOR_ARM_V5, and \l Q_PROCESSOR_ARM_V6 macros-
1659 are also defined when Q_PROCESSOR_ARM_V7 is defined.-
1660-
1661 \sa QSysInfo::buildCpuArchitecture()-
1662*/-
1663-
1664/*!-
1665 \macro Q_PROCESSOR_AVR32-
1666 \relates <QtGlobal>-
1667-
1668 Defined if the application is compiled for AVR32 processors.-
1669-
1670 \sa QSysInfo::buildCpuArchitecture()-
1671*/-
1672-
1673/*!-
1674 \macro Q_PROCESSOR_BLACKFIN-
1675 \relates <QtGlobal>-
1676-
1677 Defined if the application is compiled for Blackfin processors.-
1678-
1679 \sa QSysInfo::buildCpuArchitecture()-
1680*/-
1681-
1682/*!-
1683 \macro Q_PROCESSOR_IA64-
1684 \relates <QtGlobal>-
1685-
1686 Defined if the application is compiled for IA-64 processors. This includes-
1687 all Itanium and Itanium 2 processors.-
1688-
1689 \sa QSysInfo::buildCpuArchitecture()-
1690*/-
1691-
1692/*!-
1693 \macro Q_PROCESSOR_MIPS-
1694 \relates <QtGlobal>-
1695-
1696 Defined if the application is compiled for MIPS processors. Qt currently-
1697 supports seven MIPS revisions: \l Q_PROCESSOR_MIPS_I, \l-
1698 Q_PROCESSOR_MIPS_II, \l Q_PROCESSOR_MIPS_III, \l Q_PROCESSOR_MIPS_IV, \l-
1699 Q_PROCESSOR_MIPS_V, \l Q_PROCESSOR_MIPS_32, and \l Q_PROCESSOR_MIPS_64.-
1700-
1701 \sa QSysInfo::buildCpuArchitecture()-
1702*/-
1703/*!-
1704 \macro Q_PROCESSOR_MIPS_I-
1705 \relates <QtGlobal>-
1706-
1707 Defined if the application is compiled for MIPS-I processors. The \l-
1708 Q_PROCESSOR_MIPS macro is also defined when Q_PROCESSOR_MIPS_I is defined.-
1709-
1710 \sa QSysInfo::buildCpuArchitecture()-
1711*/-
1712/*!-
1713 \macro Q_PROCESSOR_MIPS_II-
1714 \relates <QtGlobal>-
1715-
1716 Defined if the application is compiled for MIPS-II processors. The \l-
1717 Q_PROCESSOR_MIPS and \l Q_PROCESSOR_MIPS_I macros are also defined when-
1718 Q_PROCESSOR_MIPS_II is defined.-
1719-
1720 \sa QSysInfo::buildCpuArchitecture()-
1721*/-
1722/*!-
1723 \macro Q_PROCESSOR_MIPS_32-
1724 \relates <QtGlobal>-
1725-
1726 Defined if the application is compiled for MIPS32 processors. The \l-
1727 Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, and \l Q_PROCESSOR_MIPS_II macros-
1728 are also defined when Q_PROCESSOR_MIPS_32 is defined.-
1729-
1730 \sa QSysInfo::buildCpuArchitecture()-
1731*/-
1732/*!-
1733 \macro Q_PROCESSOR_MIPS_III-
1734 \relates <QtGlobal>-
1735-
1736 Defined if the application is compiled for MIPS-III processors. The \l-
1737 Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, and \l Q_PROCESSOR_MIPS_II macros-
1738 are also defined when Q_PROCESSOR_MIPS_III is defined.-
1739-
1740 \sa QSysInfo::buildCpuArchitecture()-
1741*/-
1742/*!-
1743 \macro Q_PROCESSOR_MIPS_IV-
1744 \relates <QtGlobal>-
1745-
1746 Defined if the application is compiled for MIPS-IV processors. The \l-
1747 Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, \l Q_PROCESSOR_MIPS_II, and \l-
1748 Q_PROCESSOR_MIPS_III macros are also defined when Q_PROCESSOR_MIPS_IV is-
1749 defined.-
1750-
1751 \sa QSysInfo::buildCpuArchitecture()-
1752*/-
1753/*!-
1754 \macro Q_PROCESSOR_MIPS_V-
1755 \relates <QtGlobal>-
1756-
1757 Defined if the application is compiled for MIPS-V processors. The \l-
1758 Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, \l Q_PROCESSOR_MIPS_II, \l-
1759 Q_PROCESSOR_MIPS_III, and \l Q_PROCESSOR_MIPS_IV macros are also defined-
1760 when Q_PROCESSOR_MIPS_V is defined.-
1761-
1762 \sa QSysInfo::buildCpuArchitecture()-
1763*/-
1764/*!-
1765 \macro Q_PROCESSOR_MIPS_64-
1766 \relates <QtGlobal>-
1767-
1768 Defined if the application is compiled for MIPS64 processors. The \l-
1769 Q_PROCESSOR_MIPS, \l Q_PROCESSOR_MIPS_I, \l Q_PROCESSOR_MIPS_II, \l-
1770 Q_PROCESSOR_MIPS_III, \l Q_PROCESSOR_MIPS_IV, and \l Q_PROCESSOR_MIPS_V-
1771 macros are also defined when Q_PROCESSOR_MIPS_64 is defined.-
1772-
1773 \sa QSysInfo::buildCpuArchitecture()-
1774*/-
1775-
1776/*!-
1777 \macro Q_PROCESSOR_POWER-
1778 \relates <QtGlobal>-
1779-
1780 Defined if the application is compiled for POWER processors. Qt currently-
1781 supports two Power variants: \l Q_PROCESSOR_POWER_32 and \l-
1782 Q_PROCESSOR_POWER_64.-
1783-
1784 \sa QSysInfo::buildCpuArchitecture()-
1785*/-
1786/*!-
1787 \macro Q_PROCESSOR_POWER_32-
1788 \relates <QtGlobal>-
1789-
1790 Defined if the application is compiled for 32-bit Power processors. The \l-
1791 Q_PROCESSOR_POWER macro is also defined when Q_PROCESSOR_POWER_32 is-
1792 defined.-
1793-
1794 \sa QSysInfo::buildCpuArchitecture()-
1795*/-
1796/*!-
1797 \macro Q_PROCESSOR_POWER_64-
1798 \relates <QtGlobal>-
1799-
1800 Defined if the application is compiled for 64-bit Power processors. The \l-
1801 Q_PROCESSOR_POWER macro is also defined when Q_PROCESSOR_POWER_64 is-
1802 defined.-
1803-
1804 \sa QSysInfo::buildCpuArchitecture()-
1805*/-
1806-
1807/*!-
1808 \macro Q_PROCESSOR_S390-
1809 \relates <QtGlobal>-
1810-
1811 Defined if the application is compiled for S/390 processors. Qt supports-
1812 one optional variant of S/390: Q_PROCESSOR_S390_X.-
1813-
1814 \sa QSysInfo::buildCpuArchitecture()-
1815*/-
1816/*!-
1817 \macro Q_PROCESSOR_S390_X-
1818 \relates <QtGlobal>-
1819-
1820 Defined if the application is compiled for S/390x processors. The \l-
1821 Q_PROCESSOR_S390 macro is also defined when Q_PROCESSOR_S390_X is defined.-
1822-
1823 \sa QSysInfo::buildCpuArchitecture()-
1824*/-
1825-
1826/*!-
1827 \macro Q_PROCESSOR_SH-
1828 \relates <QtGlobal>-
1829-
1830 Defined if the application is compiled for SuperH processors. Qt currently-
1831 supports one SuperH revision: \l Q_PROCESSOR_SH_4A.-
1832-
1833 \sa QSysInfo::buildCpuArchitecture()-
1834*/-
1835/*!-
1836 \macro Q_PROCESSOR_SH_4A-
1837 \relates <QtGlobal>-
1838-
1839 Defined if the application is compiled for SuperH 4A processors. The \l-
1840 Q_PROCESSOR_SH macro is also defined when Q_PROCESSOR_SH_4A is defined.-
1841-
1842 \sa QSysInfo::buildCpuArchitecture()-
1843*/-
1844-
1845/*!-
1846 \macro Q_PROCESSOR_SPARC-
1847 \relates <QtGlobal>-
1848-
1849 Defined if the application is compiled for SPARC processors. Qt currently-
1850 supports one optional SPARC revision: \l Q_PROCESSOR_SPARC_V9.-
1851-
1852 \sa QSysInfo::buildCpuArchitecture()-
1853*/-
1854/*!-
1855 \macro Q_PROCESSOR_SPARC_V9-
1856 \relates <QtGlobal>-
1857-
1858 Defined if the application is compiled for SPARC V9 processors. The \l-
1859 Q_PROCESSOR_SPARC macro is also defined when Q_PROCESSOR_SPARC_V9 is-
1860 defined.-
1861-
1862 \sa QSysInfo::buildCpuArchitecture()-
1863*/-
1864-
1865/*!-
1866 \macro Q_PROCESSOR_X86-
1867 \relates <QtGlobal>-
1868-
1869 Defined if the application is compiled for x86 processors. Qt currently-
1870 supports two x86 variants: \l Q_PROCESSOR_X86_32 and \l Q_PROCESSOR_X86_64.-
1871-
1872 \sa QSysInfo::buildCpuArchitecture()-
1873*/-
1874/*!-
1875 \macro Q_PROCESSOR_X86_32-
1876 \relates <QtGlobal>-
1877-
1878 Defined if the application is compiled for 32-bit x86 processors. This-
1879 includes all i386, i486, i586, and i686 processors. The \l Q_PROCESSOR_X86-
1880 macro is also defined when Q_PROCESSOR_X86_32 is defined.-
1881-
1882 \sa QSysInfo::buildCpuArchitecture()-
1883*/-
1884/*!-
1885 \macro Q_PROCESSOR_X86_64-
1886 \relates <QtGlobal>-
1887-
1888 Defined if the application is compiled for 64-bit x86 processors. This-
1889 includes all AMD64, Intel 64, and other x86_64/x64 processors. The \l-
1890 Q_PROCESSOR_X86 macro is also defined when Q_PROCESSOR_X86_64 is defined.-
1891-
1892 \sa QSysInfo::buildCpuArchitecture()-
1893*/-
1894-
1895/*!-
1896 \macro QT_DISABLE_DEPRECATED_BEFORE-
1897 \relates <QtGlobal>-
1898-
1899 This macro can be defined in the project file to disable functions deprecated in-
1900 a specified version of Qt or any earlier version. The default version number is 5.0,-
1901 meaning that functions deprecated in or before Qt 5.0 will not be included.-
1902-
1903 Examples:-
1904 When using a future release of Qt 5, set QT_DISABLE_DEPRECATED_BEFORE=0x050100 to-
1905 disable functions deprecated in Qt 5.1 and earlier. In any release, set-
1906 QT_DISABLE_DEPRECATED_BEFORE=0x000000 to enable any functions, including the ones-
1907 deprecated in Qt 5.0-
1908 */-
1909-
1910#if defined(QT_BUILD_QMAKE)-
1911// needed to bootstrap qmake-
1912static const unsigned int qt_one = 1;-
1913const int QSysInfo::ByteOrder = ((*((unsigned char *) &qt_one) == 0) ? BigEndian : LittleEndian);-
1914#endif-
1915-
1916#if defined(Q_OS_MAC)-
1917-
1918QT_BEGIN_INCLUDE_NAMESPACE-
1919#include "private/qcore_mac_p.h"-
1920#include "qnamespace.h"-
1921QT_END_INCLUDE_NAMESPACE-
1922-
1923QSysInfo::MacVersion QSysInfo::macVersion()-
1924{-
1925 const QAppleOperatingSystemVersion version = qt_apple_os_version(); // qtcore_mac_objc.mm-
1926#if defined(Q_OS_OSX)-
1927 return QSysInfo::MacVersion(Q_MV_OSX(version.major, version.minor));-
1928#elif defined(Q_OS_IOS)-
1929 return QSysInfo::MacVersion(Q_MV_IOS(version.major, version.minor));-
1930#else-
1931 return QSysInfo::MV_Unknown;-
1932#endif-
1933}-
1934const QSysInfo::MacVersion QSysInfo::MacintoshVersion = QSysInfo::macVersion();-
1935-
1936#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)-
1937-
1938QT_BEGIN_INCLUDE_NAMESPACE-
1939#include "qt_windows.h"-
1940QT_END_INCLUDE_NAMESPACE-
1941-
1942# ifndef QT_BOOTSTRAPPED-
1943class QWindowsSockInit-
1944{-
1945public:-
1946 QWindowsSockInit();-
1947 ~QWindowsSockInit();-
1948 int version;-
1949};-
1950-
1951QWindowsSockInit::QWindowsSockInit()-
1952: version(0)-
1953{-
1954 //### should we try for 2.2 on all platforms ??-
1955 WSAData wsadata;-
1956-
1957 // IPv6 requires Winsock v2.0 or better.-
1958 if (WSAStartup(MAKEWORD(2,0), &wsadata) != 0) {-
1959 qWarning("QTcpSocketAPI: WinSock v2.0 initialization failed.");-
1960 } else {-
1961 version = 0x20;-
1962 }-
1963}-
1964-
1965QWindowsSockInit::~QWindowsSockInit()-
1966{-
1967 WSACleanup();-
1968}-
1969Q_GLOBAL_STATIC(QWindowsSockInit, winsockInit)-
1970# endif // QT_BOOTSTRAPPED-
1971-
1972#ifdef Q_OS_WINRT-
1973static inline HMODULE moduleHandleForFunction(LPCVOID address)-
1974{-
1975 // This is a widely used, decades-old technique for retrieving the handle-
1976 // of a module and is effectively equivalent to GetModuleHandleEx-
1977 // (which is unavailable on WinRT)-
1978 MEMORY_BASIC_INFORMATION mbi = { 0, 0, 0, 0, 0, 0, 0 };-
1979 if (VirtualQuery(address, &mbi, sizeof(mbi)) == 0)-
1980 return 0;-
1981 return reinterpret_cast<HMODULE>(mbi.AllocationBase);-
1982}-
1983#endif-
1984-
1985static inline OSVERSIONINFOEX determineWinOsVersion()-
1986{-
1987 OSVERSIONINFOEX result = { sizeof(OSVERSIONINFOEX), 0, 0, 0, 0, {'\0'}, 0, 0, 0, 0, 0};-
1988-
1989#ifndef Q_OS_WINCE-
1990#define GetProcAddressA GetProcAddress-
1991#endif-
1992-
1993 // GetModuleHandle is not supported in WinRT and linking to it at load time-
1994 // will not pass the Windows App Certification Kit... but it exists and is functional,-
1995 // so use some unusual but widely used techniques to get a pointer to it-
1996#ifdef Q_OS_WINRT-
1997 // 1. Get HMODULE of kernel32.dll, using the address of some function exported by that DLL-
1998 HMODULE kernelModule = moduleHandleForFunction(reinterpret_cast<LPCVOID>(VirtualQuery));-
1999 if (Q_UNLIKELY(!kernelModule))-
2000 return result;-
2001-
2002 // 2. Get pointer to GetModuleHandle so we can then load other arbitrary modules (DLLs)-
2003 typedef HMODULE(WINAPI *GetModuleHandleFunction)(LPCWSTR);-
2004 GetModuleHandleFunction pGetModuleHandle = reinterpret_cast<GetModuleHandleFunction>(-
2005 GetProcAddressA(kernelModule, "GetModuleHandleW"));-
2006 if (Q_UNLIKELY(!pGetModuleHandle))-
2007 return result;-
2008#else-
2009#define pGetModuleHandle GetModuleHandleW-
2010#endif-
2011-
2012#ifndef Q_OS_WINCE-
2013 HMODULE ntdll = pGetModuleHandle(L"ntdll.dll");-
2014 if (Q_UNLIKELY(!ntdll))-
2015 return result;-
2016-
2017 // NTSTATUS is not defined on WinRT-
2018 typedef LONG NTSTATUS;-
2019 typedef NTSTATUS (NTAPI *RtlGetVersionFunction)(LPOSVERSIONINFO);-
2020-
2021 // RtlGetVersion is documented public API but we must load it dynamically-
2022 // because linking to it at load time will not pass the Windows App Certification Kit-
2023 // https://msdn.microsoft.com/en-us/library/windows/hardware/ff561910.aspx-
2024 RtlGetVersionFunction pRtlGetVersion = reinterpret_cast<RtlGetVersionFunction>(-
2025 GetProcAddressA(ntdll, "RtlGetVersion"));-
2026 if (Q_UNLIKELY(!pRtlGetVersion))-
2027 return result;-
2028-
2029 // GetVersionEx() has been deprecated in Windows 8.1 and will return-
2030 // only Windows 8 from that version on, so use the kernel API function.-
2031 pRtlGetVersion((LPOSVERSIONINFO) &result); // always returns STATUS_SUCCESS-
2032#else // !Q_OS_WINCE-
2033 GetVersionEx(&result);-
2034#endif-
2035 return result;-
2036}-
2037-
2038static OSVERSIONINFOEX winOsVersion()-
2039{-
2040 static OSVERSIONINFOEX result = determineWinOsVersion();-
2041 return result;-
2042}-
2043-
2044QSysInfo::WinVersion QSysInfo::windowsVersion()-
2045{-
2046#ifndef VER_PLATFORM_WIN32s-
2047#define VER_PLATFORM_WIN32s 0-
2048#endif-
2049#ifndef VER_PLATFORM_WIN32_WINDOWS-
2050#define VER_PLATFORM_WIN32_WINDOWS 1-
2051#endif-
2052#ifndef VER_PLATFORM_WIN32_NT-
2053#define VER_PLATFORM_WIN32_NT 2-
2054#endif-
2055#ifndef VER_PLATFORM_WIN32_CE-
2056#define VER_PLATFORM_WIN32_CE 3-
2057#endif-
2058-
2059 static QSysInfo::WinVersion winver;-
2060 if (winver)-
2061 return winver;-
2062 winver = QSysInfo::WV_NT;-
2063 const OSVERSIONINFOEX osver = winOsVersion();-
2064 if (osver.dwMajorVersion == 0)-
2065 return QSysInfo::WV_None;-
2066#ifdef Q_OS_WINCE-
2067 DWORD qt_cever = 0;-
2068 qt_cever = osver.dwMajorVersion * 100;-
2069 qt_cever += osver.dwMinorVersion * 10;-
2070#endif-
2071 switch (osver.dwPlatformId) {-
2072 case VER_PLATFORM_WIN32s:-
2073 winver = QSysInfo::WV_32s;-
2074 break;-
2075 case VER_PLATFORM_WIN32_WINDOWS:-
2076 // We treat Windows Me (minor 90) the same as Windows 98-
2077 if (osver.dwMinorVersion == 90)-
2078 winver = QSysInfo::WV_Me;-
2079 else if (osver.dwMinorVersion == 10)-
2080 winver = QSysInfo::WV_98;-
2081 else-
2082 winver = QSysInfo::WV_95;-
2083 break;-
2084#ifdef Q_OS_WINCE-
2085 case VER_PLATFORM_WIN32_CE:-
2086 if (qt_cever >= 600)-
2087 winver = QSysInfo::WV_CE_6;-
2088 if (qt_cever >= 500)-
2089 winver = QSysInfo::WV_CE_5;-
2090 else if (qt_cever >= 400)-
2091 winver = QSysInfo::WV_CENET;-
2092 else-
2093 winver = QSysInfo::WV_CE;-
2094 break;-
2095#endif-
2096 default: // VER_PLATFORM_WIN32_NT-
2097 if (osver.dwMajorVersion < 5) {-
2098 winver = QSysInfo::WV_NT;-
2099 } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 0) {-
2100 winver = QSysInfo::WV_2000;-
2101 } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 1) {-
2102 winver = QSysInfo::WV_XP;-
2103 } else if (osver.dwMajorVersion == 5 && osver.dwMinorVersion == 2) {-
2104 winver = QSysInfo::WV_2003;-
2105 } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 0) {-
2106 winver = QSysInfo::WV_VISTA;-
2107 } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 1) {-
2108 winver = QSysInfo::WV_WINDOWS7;-
2109 } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 2) {-
2110 winver = QSysInfo::WV_WINDOWS8;-
2111 } else if (osver.dwMajorVersion == 6 && osver.dwMinorVersion == 3) {-
2112 winver = QSysInfo::WV_WINDOWS8_1;-
2113 } else if (osver.dwMajorVersion == 10 && osver.dwMinorVersion == 0) {-
2114 winver = QSysInfo::WV_WINDOWS10;-
2115 } else {-
2116 winver = QSysInfo::WV_NT_based;-
2117 }-
2118 }-
2119-
2120#ifdef QT_DEBUG-
2121 {-
2122 if (Q_UNLIKELY(qEnvironmentVariableIsSet("QT_WINVER_OVERRIDE"))) {-
2123 const QByteArray winVerOverride = qgetenv("QT_WINVER_OVERRIDE");-
2124 if (winVerOverride == "NT")-
2125 winver = QSysInfo::WV_NT;-
2126 else if (winVerOverride == "2000")-
2127 winver = QSysInfo::WV_2000;-
2128 else if (winVerOverride == "2003")-
2129 winver = QSysInfo::WV_2003;-
2130 else if (winVerOverride == "XP")-
2131 winver = QSysInfo::WV_XP;-
2132 else if (winVerOverride == "VISTA")-
2133 winver = QSysInfo::WV_VISTA;-
2134 else if (winVerOverride == "WINDOWS7")-
2135 winver = QSysInfo::WV_WINDOWS7;-
2136 else if (winVerOverride == "WINDOWS8")-
2137 winver = QSysInfo::WV_WINDOWS8;-
2138 else if (winVerOverride == "WINDOWS8_1")-
2139 winver = QSysInfo::WV_WINDOWS8_1;-
2140 else if (winVerOverride == "WINDOWS10")-
2141 winver = QSysInfo::WV_WINDOWS10;-
2142 }-
2143 }-
2144#endif-
2145-
2146 return winver;-
2147}-
2148-
2149static QString winSp_helper()-
2150{-
2151 const qint16 major = winOsVersion().wServicePackMajor;-
2152 if (major) {-
2153 QString sp = QStringLiteral(" SP ") + QString::number(major);-
2154 const qint16 minor = winOsVersion().wServicePackMinor;-
2155 if (minor)-
2156 sp += QLatin1Char('.') + QString::number(minor);-
2157-
2158 return sp;-
2159 }-
2160 return QString();-
2161}-
2162-
2163static const char *winVer_helper()-
2164{-
2165 const bool workstation = winOsVersion().wProductType == VER_NT_WORKSTATION;-
2166-
2167 switch (int(QSysInfo::WindowsVersion)) {-
2168 case QSysInfo::WV_NT:-
2169 return "NT";-
2170 case QSysInfo::WV_2000:-
2171 return "2000";-
2172 case QSysInfo::WV_XP:-
2173 return "XP";-
2174 case QSysInfo::WV_2003:-
2175 return "2003";-
2176 case QSysInfo::WV_VISTA:-
2177 return workstation ? "Vista" : "Server 2008";-
2178 case QSysInfo::WV_WINDOWS7:-
2179 return workstation ? "7" : "Server 2008 R2";-
2180 case QSysInfo::WV_WINDOWS8:-
2181 return workstation ? "8" : "Server 2012";-
2182 case QSysInfo::WV_WINDOWS8_1:-
2183 return workstation ? "8.1" : "Server 2012 R2";-
2184 case QSysInfo::WV_WINDOWS10:-
2185 return workstation ? "10" : "Server 2016";-
2186-
2187 case QSysInfo::WV_CE:-
2188 return "CE";-
2189 case QSysInfo::WV_CENET:-
2190 return "CENET";-
2191 case QSysInfo::WV_CE_5:-
2192 return "CE5";-
2193 case QSysInfo::WV_CE_6:-
2194 return "CE6";-
2195 }-
2196 // unknown, future version-
2197 return 0;-
2198}-
2199-
2200const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion();-
2201-
2202#endif-
2203#if defined(Q_OS_UNIX)-
2204# if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || defined(Q_OS_FREEBSD)-
2205# define USE_ETC_OS_RELEASE-
2206struct QUnixOSVersion-
2207{-
2208 // from /etc/os-release older /etc/lsb-release // redhat /etc/redhat-release // debian /etc/debian_version-
2209 QString productType; // $ID $DISTRIB_ID // single line file containing: // Debian-
2210 QString productVersion; // $VERSION_ID $DISTRIB_RELEASE // <Vendor_ID release Version_ID> // single line file <Release_ID/sid>-
2211 QString prettyName; // $PRETTY_NAME $DISTRIB_DESCRIPTION-
2212};-
2213-
2214static QString unquote(const char *begin, const char *end)-
2215{-
2216 if (*begin == '"') {
*begin == '"'Description
TRUEevaluated 18 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
FALSEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9-18
2217 Q_ASSERT(end[-1] == '"');-
2218 return QString::fromLatin1(begin + 1, end - begin - 2);
executed 18 times by 3 tests: return QString::fromLatin1(begin + 1, end - begin - 2);
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
18
2219 }-
2220 return QString::fromLatin1(begin, end - begin);
executed 9 times by 3 tests: return QString::fromLatin1(begin, end - begin);
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9
2221}-
2222static QByteArray getEtcFileContent(const char *filename)-
2223{-
2224 // we're avoiding QFile here-
2225 int fd = qt_safe_open(filename, O_RDONLY);-
2226 if (fd == -1)
fd == -1Description
TRUEnever evaluated
FALSEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
0-9
2227 return QByteArray();
never executed: return QByteArray();
0
2228-
2229 QT_STATBUF sbuf;-
2230 if (QT_FSTAT(fd, &sbuf) == -1) {
::fstat64(fd, &sbuf) == -1Description
TRUEnever evaluated
FALSEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
0-9
2231 qt_safe_close(fd);-
2232 return QByteArray();
never executed: return QByteArray();
0
2233 }-
2234-
2235 QByteArray buffer(sbuf.st_size, Qt::Uninitialized);-
2236 buffer.resize(qt_safe_read(fd, buffer.data(), sbuf.st_size));-
2237 qt_safe_close(fd);-
2238 return buffer;
executed 9 times by 3 tests: return buffer;
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9
2239}-
2240-
2241static bool readEtcFile(QUnixOSVersion &v, const char *filename,-
2242 const QByteArray &idKey, const QByteArray &versionKey, const QByteArray &prettyNameKey)-
2243{-
2244-
2245 QByteArray buffer = getEtcFileContent(filename);-
2246 if (buffer.isEmpty())
buffer.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
0-9
2247 return false;
never executed: return false;
0
2248-
2249 const char *ptr = buffer.constData();-
2250 const char *end = buffer.constEnd();-
2251 const char *eol;-
2252 QByteArray line;-
2253 for ( ; ptr != end; ptr = eol + 1) {
ptr != endDescription
TRUEevaluated 72 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
FALSEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9-72
2254 // find the end of the line after ptr-
2255 eol = static_cast<const char *>(memchr(ptr, '\n', end - ptr));-
2256 if (!eol)
!eolDescription
TRUEnever evaluated
FALSEevaluated 72 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
0-72
2257 eol = end - 1;
never executed: eol = end - 1;
0
2258 line.setRawData(ptr, eol - ptr);-
2259-
2260 if (line.startsWith(idKey)) {
line.startsWith(idKey)Description
TRUEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
FALSEevaluated 63 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9-63
2261 ptr += idKey.length();-
2262 v.productType = unquote(ptr, eol);-
2263 continue;
executed 9 times by 3 tests: continue;
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9
2264 }-
2265-
2266 if (line.startsWith(prettyNameKey)) {
line.startsWith(prettyNameKey)Description
TRUEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
FALSEevaluated 54 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9-54
2267 ptr += prettyNameKey.length();-
2268 v.prettyName = unquote(ptr, eol);-
2269 continue;
executed 9 times by 3 tests: continue;
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9
2270 }-
2271-
2272 if (line.startsWith(versionKey)) {
line.startsWith(versionKey)Description
TRUEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
FALSEevaluated 45 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9-45
2273 ptr += versionKey.length();-
2274 v.productVersion = unquote(ptr, eol);-
2275 continue;
executed 9 times by 3 tests: continue;
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9
2276 }-
2277 }
executed 45 times by 3 tests: end of block
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
45
2278-
2279 return true;
executed 9 times by 3 tests: return true;
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9
2280}-
2281-
2282static bool readEtcOsRelease(QUnixOSVersion &v)-
2283{-
2284 return readEtcFile(v, "/etc/os-release", QByteArrayLiteral("ID="),
executed 9 times by 3 tests: return readEtcFile(v, "/etc/os-release", ([]() -> QByteArray { enum { Size = sizeof("ID=") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "ID=" }; QByteArrayDataPtr holder = { qbyt...AME=") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "PRETTY_NAME=" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()));
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
executed 9 times by 3 tests: return ba;
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9
2285 QByteArrayLiteral("VERSION_ID="), QByteArrayLiteral("PRETTY_NAME="));
executed 9 times by 3 tests: return readEtcFile(v, "/etc/os-release", ([]() -> QByteArray { enum { Size = sizeof("ID=") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "ID=" }; QByteArrayDataPtr holder = { qbyt...AME=") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "PRETTY_NAME=" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return ba; }()));
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
executed 9 times by 3 tests: return ba;
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
executed 9 times by 3 tests: return ba;
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9
2286}-
2287-
2288static bool readEtcLsbRelease(QUnixOSVersion &v)-
2289{-
2290 bool ok = readEtcFile(v, "/etc/lsb-release", QByteArrayLiteral("DISTRIB_ID="),
never executed: return ba;
0
2291 QByteArrayLiteral("DISTRIB_RELEASE="), QByteArrayLiteral("DISTRIB_DESCRIPTION="));
never executed: return ba;
never executed: return ba;
0
2292 if (ok && (v.prettyName.isEmpty() || v.prettyName == v.productType)) {
okDescription
TRUEnever evaluated
FALSEnever evaluated
v.prettyName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
v.prettyName == v.productTypeDescription
TRUEnever evaluated
FALSEnever evaluated
0
2293 // some distributions have redundant information for the pretty name,-
2294 // so try /etc/<lowercasename>-release-
2295-
2296 // we're still avoiding QFile here-
2297 QByteArray distrorelease = "/etc/" + v.productType.toLatin1().toLower() + "-release";-
2298 int fd = qt_safe_open(distrorelease, O_RDONLY);-
2299 if (fd != -1) {
fd != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
2300 QT_STATBUF sbuf;-
2301 if (QT_FSTAT(fd, &sbuf) != -1 && sbuf.st_size > v.prettyName.length()) {
::fstat64(fd, &sbuf) != -1Description
TRUEnever evaluated
FALSEnever evaluated
sbuf.st_size >...yName.length()Description
TRUEnever evaluated
FALSEnever evaluated
0
2302 // file apparently contains interesting information-
2303 QByteArray buffer(sbuf.st_size, Qt::Uninitialized);-
2304 buffer.resize(qt_safe_read(fd, buffer.data(), sbuf.st_size));-
2305 v.prettyName = QString::fromLatin1(buffer.trimmed());-
2306 }
never executed: end of block
0
2307 qt_safe_close(fd);-
2308 }
never executed: end of block
0
2309 }
never executed: end of block
0
2310-
2311 // some distributions have a /etc/lsb-release file that does not provide the values-
2312 // we are looking for, i.e. DISTRIB_ID, DISTRIB_RELEASE and DISTRIB_DESCRIPTION.-
2313 // Assuming that neither DISTRIB_ID nor DISTRIB_RELEASE were found, or contained valid values,-
2314 // returning false for readEtcLsbRelease will allow further /etc/<lowercasename>-release parsing.-
2315 return ok && !(v.productType.isEmpty() && v.productVersion.isEmpty());
never executed: return ok && !(v.productType.isEmpty() && v.productVersion.isEmpty());
0
2316}-
2317-
2318#if defined(Q_OS_LINUX)-
2319static QByteArray getEtcFileFirstLine(const char *fileName)-
2320{-
2321 QByteArray buffer = getEtcFileContent(fileName);-
2322 if (buffer.isEmpty())
buffer.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2323 return QByteArray();
never executed: return QByteArray();
0
2324-
2325 const char *ptr = buffer.constData();-
2326 int eol = buffer.indexOf("\n");-
2327 return QByteArray(ptr, eol).trimmed();
never executed: return QByteArray(ptr, eol).trimmed();
0
2328}-
2329-
2330static bool readEtcRedHatRelease(QUnixOSVersion &v)-
2331{-
2332 // /etc/redhat-release analysed should be a one line file-
2333 // the format of its content is <Vendor_ID release Version>-
2334 // i.e. "Red Hat Enterprise Linux Workstation release 6.5 (Santiago)"-
2335 QByteArray line = getEtcFileFirstLine("/etc/redhat-release");-
2336 if (line.isEmpty())
line.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2337 return false;
never executed: return false;
0
2338-
2339 v.prettyName = QString::fromLatin1(line);-
2340-
2341 const char keyword[] = "release ";-
2342 int releaseIndex = line.indexOf(keyword);-
2343 v.productType = QString::fromLatin1(line.mid(0, releaseIndex)).remove(QLatin1Char(' '));-
2344 int spaceIndex = line.indexOf(' ', releaseIndex + strlen(keyword));-
2345 v.productVersion = QString::fromLatin1(line.mid(releaseIndex + strlen(keyword),-
2346 spaceIndex > -1 ? spaceIndex - releaseIndex - int(strlen(keyword)) : -1));-
2347 return true;
never executed: return true;
0
2348}-
2349-
2350static bool readEtcDebianVersion(QUnixOSVersion &v)-
2351{-
2352 // /etc/debian_version analysed should be a one line file-
2353 // the format of its content is <Release_ID/sid>-
2354 // i.e. "jessie/sid"-
2355 QByteArray line = getEtcFileFirstLine("/etc/debian_version");-
2356 if (line.isEmpty())
line.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2357 return false;
never executed: return false;
0
2358-
2359 v.productType = QStringLiteral("Debian");
never executed: return qstring_literal_temp;
0
2360 v.productVersion = QString::fromLatin1(line);-
2361 return true;
never executed: return true;
0
2362}-
2363#endif-
2364-
2365static bool findUnixOsVersion(QUnixOSVersion &v)-
2366{-
2367 if (readEtcOsRelease(v))
readEtcOsRelease(v)Description
TRUEevaluated 9 times by 3 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
FALSEnever evaluated
0-9
2368 return true;
executed 9 times by 3 tests: return true;
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
  • tst_selftests - unknown status
9
2369 if (readEtcLsbRelease(v))
readEtcLsbRelease(v)Description
TRUEnever evaluated
FALSEnever evaluated
0
2370 return true;
never executed: return true;
0
2371#if defined(Q_OS_LINUX)-
2372 if (readEtcRedHatRelease(v))
readEtcRedHatRelease(v)Description
TRUEnever evaluated
FALSEnever evaluated
0
2373 return true;
never executed: return true;
0
2374 if (readEtcDebianVersion(v))
readEtcDebianVersion(v)Description
TRUEnever evaluated
FALSEnever evaluated
0
2375 return true;
never executed: return true;
0
2376#endif-
2377 return false;
never executed: return false;
0
2378}-
2379# endif // USE_ETC_OS_RELEASE-
2380#endif // Q_OS_UNIX-
2381-
2382-
2383/*!-
2384 \since 5.4-
2385-
2386 Returns the architecture of the CPU that Qt was compiled for, in text-
2387 format. Note that this may not match the actual CPU that the application is-
2388 running on if there's an emulation layer or if the CPU supports multiple-
2389 architectures (like x86-64 processors supporting i386 applications). To-
2390 detect that, use currentCpuArchitecture().-
2391-
2392 Values returned by this function are stable and will not change over time,-
2393 so applications can rely on the returned value as an identifier, except-
2394 that new CPU types may be added over time.-
2395-
2396 Typical returned values are (note: list not exhaustive):-
2397 \list-
2398 \li "arm"-
2399 \li "arm64"-
2400 \li "i386"-
2401 \li "ia64"-
2402 \li "mips"-
2403 \li "mips64"-
2404 \li "power"-
2405 \li "power64"-
2406 \li "sparc"-
2407 \li "sparcv9"-
2408 \li "x86_64"-
2409 \endlist-
2410-
2411 \sa QSysInfo::buildAbi(), QSysInfo::currentCpuArchitecture()-
2412*/-
2413QString QSysInfo::buildCpuArchitecture()-
2414{-
2415 return QStringLiteral(ARCH_PROCESSOR);
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "x86_64")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "x86_64" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
2416}-
2417-
2418/*!-
2419 \since 5.4-
2420-
2421 Returns the architecture of the CPU that the application is running on, in-
2422 text format. Note that this function depends on what the OS will report and-
2423 may not detect the actual CPU architecture if the OS hides that information-
2424 or is unable to provide it. For example, a 32-bit OS running on a 64-bit-
2425 CPU is usually unable to determine the CPU is actually capable of running-
2426 64-bit programs.-
2427-
2428 Values returned by this function are mostly stable: an attempt will be made-
2429 to ensure that they stay constant over time and match the values returned-
2430 by QSysInfo::builldCpuArchitecture(). However, due to the nature of the-
2431 operating system functions being used, there may be discrepancies.-
2432-
2433 Typical returned values are (note: list not exhaustive):-
2434 \list-
2435 \li "arm"-
2436 \li "arm64"-
2437 \li "i386"-
2438 \li "ia64"-
2439 \li "mips"-
2440 \li "mips64"-
2441 \li "power"-
2442 \li "power64"-
2443 \li "sparc"-
2444 \li "sparcv9"-
2445 \li "x86_64"-
2446 \endlist-
2447-
2448 \sa QSysInfo::buildAbi(), QSysInfo::buildCpuArchitecture()-
2449 */-
2450QString QSysInfo::currentCpuArchitecture()-
2451{-
2452#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)-
2453 // We don't need to catch all the CPU architectures in this function;-
2454 // only those where the host CPU might be different than the build target-
2455 // (usually, 64-bit platforms).-
2456 SYSTEM_INFO info;-
2457 GetNativeSystemInfo(&info);-
2458 switch (info.wProcessorArchitecture) {-
2459# ifdef PROCESSOR_ARCHITECTURE_AMD64-
2460 case PROCESSOR_ARCHITECTURE_AMD64:-
2461 return QStringLiteral("x86_64");-
2462# endif-
2463# ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64-
2464 case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:-
2465# endif-
2466 case PROCESSOR_ARCHITECTURE_IA64:-
2467 return QStringLiteral("ia64");-
2468 }-
2469#elif defined(Q_OS_UNIX)-
2470 long ret = -1;-
2471 struct utsname u;-
2472-
2473# if defined(Q_OS_SOLARIS)-
2474 // We need a special call for Solaris because uname(2) on x86 returns "i86pc" for-
2475 // both 32- and 64-bit CPUs. Reference:-
2476 // http://docs.oracle.com/cd/E18752_01/html/816-5167/sysinfo-2.html#REFMAN2sysinfo-2-
2477 // http://fxr.watson.org/fxr/source/common/syscall/systeminfo.c?v=OPENSOLARIS-
2478 // http://fxr.watson.org/fxr/source/common/conf/param.c?v=OPENSOLARIS;im=10#L530-
2479 if (ret == -1)-
2480 ret = sysinfo(SI_ARCHITECTURE_64, u.machine, sizeof u.machine);-
2481# endif-
2482-
2483 if (ret == -1)
ret == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
FALSEnever evaluated
0-1
2484 ret = uname(&u);
executed 1 time by 1 test: ret = uname(&u);
Executed by:
  • tst_QOpenGlConfig
1
2485-
2486 // we could use detectUnixVersion() above, but we only need a field no other function does-
2487 if (ret != -1) {
ret != -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
FALSEnever evaluated
0-1
2488 // the use of QT_BUILD_INTERNAL here is simply to ensure all branches build-
2489 // as we don't often build on some of the less common platforms-
2490# if defined(Q_PROCESSOR_ARM) || defined(QT_BUILD_INTERNAL)-
2491 if (strcmp(u.machine, "aarch64") == 0)
strcmp(u.machi...aarch64") == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
0-1
2492 return QStringLiteral("arm64");
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "arm64")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "arm64" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
2493 if (strncmp(u.machine, "armv", 4) == 0)
strncmp(u.mach...armv", 4) == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
0-1
2494 return QStringLiteral("arm");
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "arm")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "arm" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
2495# endif-
2496# if defined(Q_PROCESSOR_POWER) || defined(QT_BUILD_INTERNAL)-
2497 // harmonize "powerpc" and "ppc" to "power"-
2498 if (strncmp(u.machine, "ppc", 3) == 0)
strncmp(u.mach..."ppc", 3) == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
0-1
2499 return QLatin1String("power") + QLatin1String(u.machine + 3);
never executed: return QLatin1String("power") + QLatin1String(u.machine + 3);
0
2500 if (strncmp(u.machine, "powerpc", 7) == 0)
strncmp(u.mach...erpc", 7) == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
0-1
2501 return QLatin1String("power") + QLatin1String(u.machine + 7);
never executed: return QLatin1String("power") + QLatin1String(u.machine + 7);
0
2502 if (strcmp(u.machine, "Power Macintosh") == 0)
strcmp(u.machi...cintosh") == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
0-1
2503 return QLatin1String("power");
never executed: return QLatin1String("power");
0
2504# endif-
2505# if defined(Q_PROCESSOR_SPARC) || defined(QT_BUILD_INTERNAL)-
2506 // Solaris sysinfo(2) (above) uses "sparcv9", but uname -m says "sun4u";-
2507 // Linux says "sparc64"-
2508 if (strcmp(u.machine, "sun4u") == 0 || strcmp(u.machine, "sparc64") == 0)
strcmp(u.machi... "sun4u") == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
strcmp(u.machi...sparc64") == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
0-1
2509 return QStringLiteral("sparcv9");
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "sparcv9")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "sparcv9" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
2510 if (strcmp(u.machine, "sparc32") == 0)
strcmp(u.machi...sparc32") == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
0-1
2511 return QStringLiteral("sparc");
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "sparc")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "sparc" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
2512# endif-
2513# if defined(Q_PROCESSOR_X86) || defined(QT_BUILD_INTERNAL)-
2514 // harmonize all "i?86" to "i386"-
2515 if (strlen(u.machine) == 4 && u.machine[0] == 'i'
strlen(u.machine) == 4Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
u.machine[0] == 'i'Description
TRUEnever evaluated
FALSEnever evaluated
0-1
2516 && u.machine[2] == '8' && u.machine[3] == '6')
u.machine[2] == '8'Description
TRUEnever evaluated
FALSEnever evaluated
u.machine[3] == '6'Description
TRUEnever evaluated
FALSEnever evaluated
0
2517 return QStringLiteral("i386");
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "i386")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "i386" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
2518 if (strcmp(u.machine, "amd64") == 0) // Solaris
strcmp(u.machi... "amd64") == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
0-1
2519 return QStringLiteral("x86_64");
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "x86_64")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "x86_64" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
2520# endif-
2521 return QString::fromLatin1(u.machine);
executed 1 time by 1 test: return QString::fromLatin1(u.machine);
Executed by:
  • tst_QOpenGlConfig
1
2522 }-
2523#endif-
2524 return buildCpuArchitecture();
never executed: return buildCpuArchitecture();
0
2525}-
2526-
2527/*!-
2528 \since 5.4-
2529-
2530 Returns the full architecture string that Qt was compiled for. This string-
2531 is useful for identifying different, incompatible builds. For example, it-
2532 can be used as an identifier to request an upgrade package from a server.-
2533-
2534 The values returned from this function are kept stable as follows: the-
2535 mandatory components of the result will not change in future versions of-
2536 Qt, but optional suffixes may be added.-
2537-
2538 The returned value is composed of three or more parts, separated by dashes-
2539 ("-"). They are:-
2540-
2541 \table-
2542 \header \li Component \li Value-
2543 \row \li CPU Architecture \li The same as QSysInfo::buildCpuArchitecture(), such as "arm", "i386", "mips" or "x86_64"-
2544 \row \li Endianness \li "little_endian" or "big_endian"-
2545 \row \li Word size \li Whether it's a 32- or 64-bit application. Possible values are:-
2546 "llp64" (Windows 64-bit), "lp64" (Unix 64-bit), "ilp32" (32-bit)-
2547 \row \li (Optional) ABI \li Zero or more components identifying different ABIs possible in this architecture.-
2548 Currently, Qt has optional ABI components for ARM and MIPS processors: one-
2549 component is the main ABI (such as "eabi", "o32", "n32", "o64"); another is-
2550 whether the calling convention is using hardware floating point registers ("hardfloat"-
2551 is present).-
2552-
2553 Additionally, if Qt was configured with \c{-qreal float}, the ABI option tag "qreal_float"-
2554 will be present. If Qt was configured with another type as qreal, that type is present after-
2555 "qreal_", with all characters other than letters and digits escaped by an underscore, followed-
2556 by two hex digits. For example, \c{-qreal long double} becomes "qreal_long_20double".-
2557 \endtable-
2558-
2559 \sa QSysInfo::buildCpuArchitecture()-
2560*/-
2561QString QSysInfo::buildAbi()-
2562{-
2563#ifdef Q_COMPILER_UNICODE_STRINGS-
2564 // ARCH_FULL is a concatenation of strings (incl. ARCH_PROCESSOR), which breaks-
2565 // QStringLiteral on MSVC. Since the concatenation behavior we want is specified-
2566 // the same C++11 paper as the Unicode strings, we'll use that macro and hope-
2567 // that Microsoft implements the new behavior when they add support for Unicode strings.-
2568 return QStringLiteral(ARCH_FULL);
executed 1 time by 1 test: return ([]() -> QString { enum { Size = sizeof(u"" "x86_64" "-" "little_endian" "-" "lp64" "" "" "")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "x86_64" "-" "little_endian" "-" "lp64" "" "" "" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
Executed by:
  • tst_QGlobal
executed 1 time by 1 test: return qstring_literal_temp;
Executed by:
  • tst_QGlobal
1
2569#else-
2570 return QLatin1String(ARCH_FULL);-
2571#endif-
2572}-
2573-
2574static QString unknownText()-
2575{-
2576 return QStringLiteral("unknown");
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "unknown")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "unknown" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
never executed: return qstring_literal_temp;
0
2577}-
2578-
2579/*!-
2580 \since 5.4-
2581-
2582 Returns the type of the operating system kernel Qt was compiled for. It's-
2583 also the kernel the application is running on, unless the host operating-
2584 system is running a form of compatibility or virtualization layer.-
2585-
2586 Values returned by this function are stable and will not change over time,-
2587 so applications can rely on the returned value as an identifier, except-
2588 that new OS kernel types may be added over time.-
2589-
2590 On Windows, this function returns the type of Windows kernel, like "winnt".-
2591 On Unix systems, it returns the same as the output of \c{uname-
2592 -s} (lowercased).-
2593-
2594 \note This function may return surprising values: it returns "linux"-
2595 for all operating systems running Linux (including Android), "qnx" for all-
2596 operating systems running QNX, "freebsd" for-
2597 Debian/kFreeBSD, and "darwin" for \macos and iOS. For information on the type-
2598 of product the application is running on, see productType().-
2599-
2600 \sa QFileSelector, kernelVersion(), productType(), productVersion(), prettyProductName()-
2601*/-
2602QString QSysInfo::kernelType()-
2603{-
2604#if defined(Q_OS_WINCE)-
2605 return QStringLiteral("wince");-
2606#elif defined(Q_OS_WIN)-
2607 return QStringLiteral("winnt");-
2608#elif defined(Q_OS_UNIX)-
2609 struct utsname u;-
2610 if (uname(&u) == 0)
uname(&u) == 0Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
FALSEnever evaluated
0-4
2611 return QString::fromLatin1(u.sysname).toLower();
executed 4 times by 2 tests: return QString::fromLatin1(u.sysname).toLower();
Executed by:
  • tst_QFileSelector
  • tst_QOpenGlConfig
4
2612#endif-
2613 return unknownText();
never executed: return unknownText();
0
2614}-
2615-
2616/*!-
2617 \since 5.4-
2618-
2619 Returns the release version of the operating system kernel. On Windows, it-
2620 returns the version of the NT or CE kernel. On Unix systems, including-
2621 Android and \macos, it returns the same as the \c{uname -r}-
2622 command would return.-
2623-
2624 If the version could not be determined, this function may return an empty-
2625 string.-
2626-
2627 \sa kernelType(), productType(), productVersion(), prettyProductName()-
2628*/-
2629QString QSysInfo::kernelVersion()-
2630{-
2631#ifdef Q_OS_WIN-
2632 const OSVERSIONINFOEX osver = winOsVersion();-
2633 return QString::number(int(osver.dwMajorVersion)) + QLatin1Char('.') + QString::number(int(osver.dwMinorVersion))-
2634 + QLatin1Char('.') + QString::number(int(osver.dwBuildNumber));-
2635#else-
2636 struct utsname u;-
2637 if (uname(&u) == 0)
uname(&u) == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
FALSEnever evaluated
0-1
2638 return QString::fromLatin1(u.release);
executed 1 time by 1 test: return QString::fromLatin1(u.release);
Executed by:
  • tst_QOpenGlConfig
1
2639 return QString();
never executed: return QString();
0
2640#endif-
2641}-
2642-
2643-
2644/*!-
2645 \since 5.4-
2646-
2647 Returns the product name of the operating system this application is-
2648 running in. If the application is running on some sort of emulation or-
2649 virtualization layer (such as WINE on a Unix system), this function will-
2650 inspect the emulation / virtualization layer.-
2651-
2652 Values returned by this function are stable and will not change over time,-
2653 so applications can rely on the returned value as an identifier, except-
2654 that new OS types may be added over time.-
2655-
2656 \b{Linux and Android note}: this function returns "android" for Linux-
2657 systems running Android userspace, notably when using the Bionic library.-
2658 For all other Linux systems, regardless of C library being used, it tries-
2659 to determine the distribution name and returns that. If determining the-
2660 distribution name failed, it returns "unknown".-
2661-
2662 \b{Darwin, \macos and iOS note}: this function returns "macos" for macOS-
2663 systems, "ios" for iOS systems and "darwin" in case the system could not be-
2664 determined.-
2665-
2666 \b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12.-
2667-
2668 \b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and-
2669 "unknown" otherwise.-
2670-
2671 \b{Windows note}: this function returns "winphone" for builds for Windows-
2672 Phone, "winrt" for WinRT builds, and "windows" for normal desktop builds.-
2673-
2674 For other Unix-type systems, this function usually returns "unknown".-
2675-
2676 \sa QFileSelector, kernelType(), kernelVersion(), productVersion(), prettyProductName()-
2677*/-
2678QString QSysInfo::productType()-
2679{-
2680 // similar, but not identical to QFileSelectorPrivate::platformSelectors-
2681#if defined(Q_OS_WINPHONE)-
2682 return QStringLiteral("winphone");-
2683#elif defined(Q_OS_WINRT)-
2684 return QStringLiteral("winrt");-
2685#elif defined(Q_OS_WINCE)-
2686 return QStringLiteral("wince");-
2687#elif defined(Q_OS_WIN)-
2688 return QStringLiteral("windows");-
2689-
2690#elif defined(Q_OS_QNX)-
2691 return QStringLiteral("qnx");-
2692-
2693#elif defined(Q_OS_ANDROID)-
2694 return QStringLiteral("android");-
2695-
2696#elif defined(Q_OS_IOS)-
2697 return QStringLiteral("ios");-
2698#elif defined(Q_OS_MACOS)-
2699 const QAppleOperatingSystemVersion version = qt_apple_os_version();-
2700 if (version.major == 10 && version.minor < 12)-
2701 return QStringLiteral("osx");-
2702 return QStringLiteral("macos");-
2703#elif defined(Q_OS_DARWIN)-
2704 return QStringLiteral("darwin");-
2705-
2706#elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX-
2707 QUnixOSVersion unixOsVersion;-
2708 findUnixOsVersion(unixOsVersion);-
2709 if (!unixOsVersion.productType.isEmpty())
!unixOsVersion...Type.isEmpty()Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QFileSelector
  • tst_selftests - unknown status
FALSEnever evaluated
0-6
2710 return unixOsVersion.productType;
executed 6 times by 2 tests: return unixOsVersion.productType;
Executed by:
  • tst_QFileSelector
  • tst_selftests - unknown status
6
2711#endif-
2712 return unknownText();
never executed: return unknownText();
0
2713}-
2714-
2715/*!-
2716 \since 5.4-
2717-
2718 Returns the product version of the operating system in string form. If the-
2719 version could not be determined, this function returns "unknown".-
2720-
2721 It will return the Android, iOS, \macos, Windows full-product-
2722 versions on those systems. In particular, on OS X, iOS and Windows, the-
2723 returned string is similar to the macVersion() or windowsVersion() enums.-
2724-
2725 On Linux systems, it will try to determine the distribution version and will-
2726 return that. This is also done on Debian/kFreeBSD, so this function will-
2727 return Debian version in that case.-
2728-
2729 In all other Unix-type systems, this function always returns "unknown".-
2730-
2731 \note The version string returned from this function is only guaranteed to-
2732 be orderable on Android, \macos and iOS. On Windows, some Windows-
2733 versions are text ("XP" and "Vista", for example). On Linux, the version of-
2734 the distribution may jump unexpectedly, please refer to the distribution's-
2735 documentation for versioning practices.-
2736-
2737 \sa kernelType(), kernelVersion(), productType(), prettyProductName()-
2738*/-
2739QString QSysInfo::productVersion()-
2740{-
2741#if defined(Q_OS_MAC)-
2742 const QAppleOperatingSystemVersion version = qt_apple_os_version();-
2743 return QString::number(version.major) + QLatin1Char('.') + QString::number(version.minor);-
2744#elif defined(Q_OS_WIN)-
2745 const char *version = winVer_helper();-
2746 if (version) {-
2747 const QLatin1Char spaceChar(' ');-
2748 return QString::fromLatin1(version).remove(spaceChar).toLower() + winSp_helper().remove(spaceChar).toLower();-
2749 }-
2750 // fall through-
2751-
2752// Android should not fall through to the Unix code-
2753#elif defined(Q_OS_ANDROID)-
2754 return QJNIObjectPrivate::getStaticObjectField("android/os/Build$VERSION", "RELEASE", "Ljava/lang/String;").toString();-
2755#elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX-
2756 QUnixOSVersion unixOsVersion;-
2757 findUnixOsVersion(unixOsVersion);-
2758 if (!unixOsVersion.productVersion.isEmpty())
!unixOsVersion...sion.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_selftests - unknown status
FALSEnever evaluated
0-2
2759 return unixOsVersion.productVersion;
executed 2 times by 1 test: return unixOsVersion.productVersion;
Executed by:
  • tst_selftests - unknown status
2
2760#endif-
2761-
2762 // fallback-
2763 return unknownText();
never executed: return unknownText();
0
2764}-
2765-
2766/*!-
2767 \since 5.4-
2768-
2769 Returns a prettier form of productType() and productVersion(), containing-
2770 other tokens like the operating system type, codenames and other-
2771 information. The result of this function is suitable for displaying to the-
2772 user, but not for long-term storage, as the string may change with updates-
2773 to Qt.-
2774-
2775 If productType() is "unknown", this function will instead use the-
2776 kernelType() and kernelVersion() functions.-
2777-
2778 \sa kernelType(), kernelVersion(), productType(), productVersion()-
2779*/-
2780QString QSysInfo::prettyProductName()-
2781{-
2782#if defined(Q_OS_IOS)-
2783 return QLatin1String("iOS ") + productVersion();-
2784#elif defined(Q_OS_MACOS)-
2785 // get the known codenames-
2786 const char *basename = 0;-
2787 switch (int(MacintoshVersion)) {-
2788 case MV_CHEETAH:-
2789 case MV_PUMA:-
2790 case MV_JAGUAR:-
2791 case MV_PANTHER:-
2792 case MV_TIGER:-
2793 // This version of Qt does not run on those versions of OS X-
2794 // so this case label will never be reached-
2795 Q_UNREACHABLE();-
2796 break;-
2797 case MV_LEOPARD:-
2798 basename = "Mac OS X Leopard (";-
2799 break;-
2800 case MV_SNOWLEOPARD:-
2801 basename = "Mac OS X Snow Leopard (";-
2802 break;-
2803 case MV_LION:-
2804 basename = "OS X Lion (";-
2805 break;-
2806 case MV_MOUNTAINLION:-
2807 basename = "OS X Mountain Lion (";-
2808 break;-
2809 case MV_MAVERICKS:-
2810 basename = "OS X Mavericks (";-
2811 break;-
2812 case MV_YOSEMITE:-
2813 basename = "OS X Yosemite (";-
2814 break;-
2815 case MV_ELCAPITAN:-
2816 basename = "OS X El Capitan (";-
2817 break;-
2818 case MV_SIERRA:-
2819 basename = "macOS Sierra (";-
2820 break;-
2821 }-
2822 if (basename)-
2823 return QLatin1String(basename) + productVersion() + QLatin1Char(')');-
2824-
2825 // a future version of macOS-
2826 return QLatin1String("macOS ") + productVersion();-
2827#elif defined(Q_OS_WINPHONE)-
2828 return QLatin1String("Windows Phone ") + QLatin1String(winVer_helper());-
2829#elif defined(Q_OS_WIN)-
2830 return QLatin1String("Windows ") + QLatin1String(winVer_helper()) + winSp_helper();-
2831#elif defined(Q_OS_ANDROID)-
2832 return QLatin1String("Android ") + productVersion();-
2833#elif defined(Q_OS_HAIKU)-
2834 return QLatin1String("Haiku ") + productVersion();-
2835#elif defined(Q_OS_UNIX)-
2836# ifdef USE_ETC_OS_RELEASE-
2837 QUnixOSVersion unixOsVersion;-
2838 findUnixOsVersion(unixOsVersion);-
2839 if (!unixOsVersion.prettyName.isEmpty())
!unixOsVersion...Name.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QOpenGlConfig
FALSEnever evaluated
0-1
2840 return unixOsVersion.prettyName;
executed 1 time by 1 test: return unixOsVersion.prettyName;
Executed by:
  • tst_QOpenGlConfig
1
2841# endif-
2842 struct utsname u;-
2843 if (uname(&u) == 0)
uname(&u) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
2844 return QString::fromLatin1(u.sysname) + QLatin1Char(' ') + QString::fromLatin1(u.release);
never executed: return QString::fromLatin1(u.sysname) + QLatin1Char(' ') + QString::fromLatin1(u.release);
0
2845#endif-
2846 return unknownText();
never executed: return unknownText();
0
2847}-
2848-
2849#ifndef QT_BOOTSTRAPPED-
2850/*!-
2851 \since 5.6-
2852-
2853 Returns this machine's host name, if one is configured. Note that hostnames-
2854 are not guaranteed to be globally unique, especially if they were-
2855 configured automatically.-
2856-
2857 This function does not guarantee the returned host name is a Fully-
2858 Qualified Domain Name (FQDN). For that, use QHostInfo to resolve the-
2859 returned name to an FQDN.-
2860-
2861 This function returns the same as QHostInfo::localHostName().-
2862-
2863 \sa QHostInfo::localDomainName-
2864 */-
2865QString QSysInfo::machineHostName()-
2866{-
2867#if defined(Q_OS_LINUX)-
2868 // gethostname(3) on Linux just calls uname(2), so do it ourselves-
2869 // and avoid a memcpy-
2870 struct utsname u;-
2871 if (uname(&u) == 0)
uname(&u) == 0Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_Lancelot
  • tst_QHostInfo
FALSEnever evaluated
0-3
2872 return QString::fromLocal8Bit(u.nodename);
executed 3 times by 2 tests: return QString::fromLocal8Bit(u.nodename);
Executed by:
  • tst_Lancelot
  • tst_QHostInfo
3
2873#else-
2874# ifdef Q_OS_WIN-
2875 // Important: QtNetwork depends on machineHostName() initializing ws2_32.dll-
2876 winsockInit();-
2877# endif-
2878-
2879 char hostName[512];-
2880 if (gethostname(hostName, sizeof(hostName)) == -1)-
2881 return QString();-
2882 hostName[sizeof(hostName) - 1] = '\0';-
2883 return QString::fromLocal8Bit(hostName);-
2884#endif-
2885 return QString();
never executed: return QString();
0
2886}-
2887#endif // QT_BOOTSTRAPPED-
2888-
2889/*!-
2890 \macro void Q_ASSERT(bool test)-
2891 \relates <QtGlobal>-
2892-
2893 Prints a warning message containing the source code file name and-
2894 line number if \a test is \c false.-
2895-
2896 Q_ASSERT() is useful for testing pre- and post-conditions-
2897 during development. It does nothing if \c QT_NO_DEBUG was defined-
2898 during compilation.-
2899-
2900 Example:-
2901-
2902 \snippet code/src_corelib_global_qglobal.cpp 17-
2903-
2904 If \c b is zero, the Q_ASSERT statement will output the following-
2905 message using the qFatal() function:-
2906-
2907 \snippet code/src_corelib_global_qglobal.cpp 18-
2908-
2909 \sa Q_ASSERT_X(), qFatal(), {Debugging Techniques}-
2910*/-
2911-
2912/*!-
2913 \macro void Q_ASSERT_X(bool test, const char *where, const char *what)-
2914 \relates <QtGlobal>-
2915-
2916 Prints the message \a what together with the location \a where,-
2917 the source file name and line number if \a test is \c false.-
2918-
2919 Q_ASSERT_X is useful for testing pre- and post-conditions during-
2920 development. It does nothing if \c QT_NO_DEBUG was defined during-
2921 compilation.-
2922-
2923 Example:-
2924-
2925 \snippet code/src_corelib_global_qglobal.cpp 19-
2926-
2927 If \c b is zero, the Q_ASSERT_X statement will output the following-
2928 message using the qFatal() function:-
2929-
2930 \snippet code/src_corelib_global_qglobal.cpp 20-
2931-
2932 \sa Q_ASSERT(), qFatal(), {Debugging Techniques}-
2933*/-
2934-
2935/*!-
2936 \macro void Q_ASSUME(bool expr)-
2937 \relates <QtGlobal>-
2938 \since 5.0-
2939-
2940 Causes the compiler to assume that \a expr is \c true. This macro is useful-
2941 for improving code generation, by providing the compiler with hints about-
2942 conditions that it would not otherwise know about. However, there is no-
2943 guarantee that the compiler will actually use those hints.-
2944-
2945 This macro could be considered a "lighter" version of \l{Q_ASSERT()}. While-
2946 Q_ASSERT will abort the program's execution if the condition is \c false,-
2947 Q_ASSUME will tell the compiler not to generate code for those conditions.-
2948 Therefore, it is important that the assumptions always hold, otherwise-
2949 undefined behaviour may occur.-
2950-
2951 If \a expr is a constantly \c false condition, Q_ASSUME will tell the compiler-
2952 that the current code execution cannot be reached. That is, Q_ASSUME(false)-
2953 is equivalent to Q_UNREACHABLE().-
2954-
2955 In debug builds the condition is enforced by an assert to facilitate debugging.-
2956-
2957 \note Q_LIKELY() tells the compiler that the expression is likely, but not-
2958 the only possibility. Q_ASSUME tells the compiler that it is the only-
2959 possibility.-
2960-
2961 \sa Q_ASSERT(), Q_UNREACHABLE(), Q_LIKELY()-
2962*/-
2963-
2964/*!-
2965 \macro void Q_UNREACHABLE()-
2966 \relates <QtGlobal>-
2967 \since 5.0-
2968-
2969 Tells the compiler that the current point cannot be reached by any-
2970 execution, so it may optimize any code paths leading here as dead code, as-
2971 well as code continuing from here.-
2972-
2973 This macro is useful to mark impossible conditions. For example, given the-
2974 following enum:-
2975-
2976 \snippet code/src_corelib_global_qglobal.cpp qunreachable-enum-
2977-
2978 One can write a switch table like so:-
2979-
2980 \snippet code/src_corelib_global_qglobal.cpp qunreachable-switch-
2981-
2982 The advantage of inserting Q_UNREACHABLE() at that point is that the-
2983 compiler is told not to generate code for a shape variable containing that-
2984 value. If the macro is missing, the compiler will still generate the-
2985 necessary comparisons for that value. If the case label were removed, some-
2986 compilers could produce a warning that some enum values were not checked.-
2987-
2988 By using this macro in impossible conditions, code coverage may be improved-
2989 as dead code paths may be eliminated.-
2990-
2991 In debug builds the condition is enforced by an assert to facilitate debugging.-
2992-
2993 \sa Q_ASSERT(), Q_ASSUME(), qFatal()-
2994*/-
2995-
2996/*!-
2997 \macro void Q_CHECK_PTR(void *pointer)-
2998 \relates <QtGlobal>-
2999-
3000 If \a pointer is 0, prints a message containing the source-
3001 code's file name and line number, saying that the program ran out-
3002 of memory and aborts program execution. It throws \c std::bad_alloc instead-
3003 if exceptions are enabled.-
3004-
3005 Q_CHECK_PTR does nothing if \c QT_NO_DEBUG and \c QT_NO_EXCEPTIONS were-
3006 defined during compilation. Therefore you must not use Q_CHECK_PTR to check-
3007 for successful memory allocations because the check will be disabled in-
3008 some cases.-
3009-
3010 Example:-
3011-
3012 \snippet code/src_corelib_global_qglobal.cpp 21-
3013-
3014 \sa qWarning(), {Debugging Techniques}-
3015*/-
3016-
3017/*!-
3018 \fn T *q_check_ptr(T *pointer)-
3019 \relates <QtGlobal>-
3020-
3021 Uses Q_CHECK_PTR on \a pointer, then returns \a pointer.-
3022-
3023 This can be used as an inline version of Q_CHECK_PTR.-
3024*/-
3025-
3026/*!-
3027 \macro const char* Q_FUNC_INFO()-
3028 \relates <QtGlobal>-
3029-
3030 Expands to a string that describe the function the macro resides in. How this string looks-
3031 more specifically is compiler dependent. With GNU GCC it is typically the function signature,-
3032 while with other compilers it might be the line and column number.-
3033-
3034 Q_FUNC_INFO can be conveniently used with qDebug(). For example, this function:-
3035-
3036 \snippet code/src_corelib_global_qglobal.cpp 22-
3037-
3038 when instantiated with the integer type, will with the GCC compiler produce:-
3039-
3040 \tt{const TInputType& myMin(const TInputType&, const TInputType&) [with TInputType = int] was called with value1: 3 value2: 4}-
3041-
3042 If this macro is used outside a function, the behavior is undefined.-
3043 */-
3044-
3045/*-
3046 The Q_CHECK_PTR macro calls this function if an allocation check-
3047 fails.-
3048*/-
3049void qt_check_pointer(const char *n, int l)-
3050{-
3051 qFatal("In file %s, line %d: Out of memory", n, l);-
3052}
never executed: end of block
0
3053-
3054/*-
3055 \internal-
3056 Allows you to throw an exception without including <new>-
3057 Called internally from Q_CHECK_PTR on certain OS combinations-
3058*/-
3059void qBadAlloc()-
3060{-
3061 QT_THROW(std::bad_alloc());
never executed: throw std::bad_alloc();
0
3062}-
3063-
3064#ifndef QT_NO_EXCEPTIONS-
3065/*-
3066 \internal-
3067 Allows you to call std::terminate() without including <exception>.-
3068 Called internally from QT_TERMINATE_ON_EXCEPTION-
3069*/-
3070Q_NORETURN void qTerminate() Q_DECL_NOTHROW-
3071{-
3072 std::terminate();-
3073}
never executed: end of block
0
3074#endif-
3075-
3076/*-
3077 The Q_ASSERT macro calls this function when the test fails.-
3078*/-
3079void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW-
3080{-
3081 qFatal("ASSERT: \"%s\" in file %s, line %d", assertion, file, line);-
3082}
never executed: end of block
0
3083-
3084/*-
3085 The Q_ASSERT_X macro calls this function when the test fails.-
3086*/-
3087void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW-
3088{-
3089 qFatal("ASSERT failure in %s: \"%s\", file %s, line %d", where, what, file, line);-
3090}
never executed: end of block
0
3091-
3092-
3093/*-
3094 Dijkstra's bisection algorithm to find the square root of an integer.-
3095 Deliberately not exported as part of the Qt API, but used in both-
3096 qsimplerichtext.cpp and qgfxraster_qws.cpp-
3097*/-
3098Q_CORE_EXPORT unsigned int qt_int_sqrt(unsigned int n)-
3099{-
3100 // n must be in the range 0...UINT_MAX/2-1-
3101 if (n >= (UINT_MAX>>2)) {
n >= ((2147483...* 2U + 1U)>>2)Description
TRUEnever evaluated
FALSEevaluated 23 times by 4 tests
Evaluated by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
0-23
3102 unsigned int r = 2 * qt_int_sqrt(n / 4);-
3103 unsigned int r2 = r + 1;-
3104 return (n >= r2 * r2) ? r2 : r;
never executed: return (n >= r2 * r2) ? r2 : r;
0
3105 }-
3106 uint h, p= 0, q= 1, r= n;-
3107 while (q <= n)
q <= nDescription
TRUEevaluated 190 times by 4 tests
Evaluated by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
FALSEevaluated 23 times by 4 tests
Evaluated by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
23-190
3108 q <<= 2;
executed 190 times by 4 tests: q <<= 2;
Executed by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
190
3109 while (q != 1) {
q != 1Description
TRUEevaluated 190 times by 4 tests
Evaluated by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
FALSEevaluated 23 times by 4 tests
Evaluated by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
23-190
3110 q >>= 2;-
3111 h= p + q;-
3112 p >>= 1;-
3113 if (r >= h) {
r >= hDescription
TRUEevaluated 96 times by 4 tests
Evaluated by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
FALSEevaluated 94 times by 4 tests
Evaluated by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
94-96
3114 p += q;-
3115 r -= h;-
3116 }
executed 96 times by 4 tests: end of block
Executed by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
96
3117 }
executed 190 times by 4 tests: end of block
Executed by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
190
3118 return p;
executed 23 times by 4 tests: return p;
Executed by:
  • tst_QMessageBox
  • tst_QStaticText
  • tst_QTextDocument
  • tst_QWizard
23
3119}-
3120-
3121void *qMemCopy(void *dest, const void *src, size_t n) { return memcpy(dest, src, n); }
never executed: return memcpy(dest, src, n);
0
3122void *qMemSet(void *dest, int c, size_t n) { return memset(dest, c, n); }
never executed: return memset(dest, c, n);
0
3123-
3124#if !defined(Q_OS_WIN) && !defined(QT_NO_THREAD) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX) && \-
3125 defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L-
3126namespace {-
3127 // There are two incompatible versions of strerror_r:-
3128 // a) the XSI/POSIX.1 version, which returns an int,-
3129 // indicating success or not-
3130 // b) the GNU version, which returns a char*, which may or may not-
3131 // be the beginning of the buffer we used-
3132 // The GNU libc manpage for strerror_r says you should use the XSI-
3133 // version in portable code. However, it's impossible to do that if-
3134 // _GNU_SOURCE is defined so we use C++ overloading to decide what to do-
3135 // depending on the return type-
3136 static inline Q_DECL_UNUSED QString fromstrerror_helper(int, const QByteArray &buf)-
3137 {-
3138 return QString::fromLocal8Bit(buf.constData());
never executed: return QString::fromLocal8Bit(buf.constData());
0
3139 }-
3140 static inline Q_DECL_UNUSED QString fromstrerror_helper(const char *str, const QByteArray &)-
3141 {-
3142 return QString::fromLocal8Bit(str);
executed 17 times by 5 tests: return QString::fromLocal8Bit(str);
Executed by:
  • tst_PlatformSocketEngine
  • tst_QDir
  • tst_QFile
  • tst_QSaveFile
  • tst_qmakelib
17
3143 }-
3144}-
3145#endif-
3146-
3147QString qt_error_string(int errorCode)-
3148{-
3149 const char *s = 0;-
3150 QString ret;-
3151 if (errorCode == -1) {
errorCode == -1Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_PlatformSocketEngine
  • tst_QTemporaryDir
FALSEevaluated 3716 times by 52 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTime
  • tst_QDir
  • tst_QDnsLookup_Appless
  • tst_QFile
  • tst_QGlobal
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLabel
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPixmap
  • ...
9-3716
3152#if defined(Q_OS_WIN)-
3153 errorCode = GetLastError();-
3154#else-
3155 errorCode = errno;-
3156#endif-
3157 }
executed 9 times by 2 tests: end of block
Executed by:
  • tst_PlatformSocketEngine
  • tst_QTemporaryDir
9
3158 switch (errorCode) {-
3159 case 0:
never executed: case 0:
0
3160 break;
never executed: break;
0
3161 case EACCES:
executed 47 times by 7 tests: case 13:
Executed by:
  • tst_QDir
  • tst_QFile
  • tst_QImageWriter
  • tst_QNetworkReply
  • tst_QSaveFile
  • tst_QTemporaryDir
  • tst_QTemporaryFile
47
3162 s = QT_TRANSLATE_NOOP("QIODevice", "Permission denied");-
3163 break;
executed 47 times by 7 tests: break;
Executed by:
  • tst_QDir
  • tst_QFile
  • tst_QImageWriter
  • tst_QNetworkReply
  • tst_QSaveFile
  • tst_QTemporaryDir
  • tst_QTemporaryFile
47
3164 case EMFILE:
never executed: case 24:
0
3165 s = QT_TRANSLATE_NOOP("QIODevice", "Too many open files");-
3166 break;
never executed: break;
0
3167 case ENOENT:
executed 3655 times by 50 tests: case 2:
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTime
  • tst_QDnsLookup_Appless
  • tst_QFile
  • tst_QGlobal
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLabel
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPixmap
  • tst_QPlainTextEdit
  • ...
3655
3168 s = QT_TRANSLATE_NOOP("QIODevice", "No such file or directory");-
3169 break;
executed 3655 times by 50 tests: break;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTime
  • tst_QDnsLookup_Appless
  • tst_QFile
  • tst_QGlobal
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLabel
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPixmap
  • tst_QPlainTextEdit
  • ...
3655
3170 case ENOSPC:
executed 6 times by 1 test: case 28:
Executed by:
  • tst_QFile
6
3171 s = QT_TRANSLATE_NOOP("QIODevice", "No space left on device");-
3172 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QFile
6
3173 default: {
executed 17 times by 5 tests: default:
Executed by:
  • tst_PlatformSocketEngine
  • tst_QDir
  • tst_QFile
  • tst_QSaveFile
  • tst_qmakelib
17
3174#if defined(Q_OS_WIN)-
3175 // Retrieve the system error message for the last-error code.-
3176# ifndef Q_OS_WINRT-
3177 wchar_t *string = 0;-
3178 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLOCATE_BUFFER,-
3179 NULL,-
3180 errorCode,-
3181 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),-
3182 (LPWSTR)&string,-
3183 0,-
3184 NULL);-
3185 ret = QString::fromWCharArray(string);-
3186 LocalFree((HLOCAL)string);-
3187# else // !Q_OS_WINRT-
3188 __declspec(thread) static wchar_t errorString[4096];-
3189 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,-
3190 NULL,-
3191 errorCode,-
3192 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),-
3193 errorString,-
3194 ARRAYSIZE(errorString),-
3195 NULL);-
3196 ret = QString::fromWCharArray(errorString);-
3197# endif // Q_OS_WINRT-
3198-
3199 if (ret.isEmpty() && errorCode == ERROR_MOD_NOT_FOUND)-
3200 ret = QString::fromLatin1("The specified module could not be found.");-
3201#elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_QNX)-
3202 QByteArray buf(1024, '\0');-
3203 ret = fromstrerror_helper(strerror_r(errorCode, buf.data(), buf.size()), buf);-
3204#else-
3205 ret = QString::fromLocal8Bit(strerror(errorCode));-
3206#endif-
3207 break; }
executed 17 times by 5 tests: break;
Executed by:
  • tst_PlatformSocketEngine
  • tst_QDir
  • tst_QFile
  • tst_QSaveFile
  • tst_qmakelib
17
3208 }-
3209 if (s)
sDescription
TRUEevaluated 3708 times by 52 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTime
  • tst_QDir
  • tst_QDnsLookup_Appless
  • tst_QFile
  • tst_QGlobal
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLabel
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPixmap
  • ...
FALSEevaluated 17 times by 5 tests
Evaluated by:
  • tst_PlatformSocketEngine
  • tst_QDir
  • tst_QFile
  • tst_QSaveFile
  • tst_qmakelib
17-3708
3210 // ######## this breaks moc build currently-
3211// ret = QCoreApplication::translate("QIODevice", s);-
3212 ret = QString::fromLatin1(s);
executed 3708 times by 52 tests: ret = QString::fromLatin1(s);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTime
  • tst_QDir
  • tst_QDnsLookup_Appless
  • tst_QFile
  • tst_QGlobal
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLabel
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QPixmap
  • ...
3708
3213 return ret.trimmed();
executed 3725 times by 53 tests: return ret.trimmed();
Executed by:
  • tst_PlatformSocketEngine
  • tst_QAbstractNetworkCache
  • tst_QApplication
  • tst_QCommandLineParser
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTime
  • tst_QDir
  • tst_QDnsLookup_Appless
  • tst_QFile
  • tst_QGlobal
  • tst_QGraphicsWidget
  • tst_QGuiApplication
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLabel
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkConfigurationManager
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • ...
3725
3214}-
3215-
3216// In the C runtime on all platforms access to the environment is not thread-safe. We-
3217// add thread-safety for the Qt wrappers.-
3218static QBasicMutex environmentMutex;-
3219-
3220// getenv is declared as deprecated in VS2005. This function-
3221// makes use of the new secure getenv function.-
3222/*!-
3223 \relates <QtGlobal>-
3224-
3225 Returns the value of the environment variable with name \a-
3226 varName. To get the variable string, use QByteArray::constData().-
3227-
3228 \note qgetenv() was introduced because getenv() from the standard-
3229 C library was deprecated in VC2005 (and later versions). qgetenv()-
3230 uses the new replacement function in VC, and calls the standard C-
3231 library's implementation on all other platforms.-
3232-
3233 \sa qputenv(), qEnvironmentVariableIsSet(), qEnvironmentVariableIsEmpty()-
3234*/-
3235QByteArray qgetenv(const char *varName)-
3236{-
3237 QMutexLocker locker(&environmentMutex);-
3238#if defined(_MSC_VER) && _MSC_VER >= 1400-
3239 size_t requiredSize = 0;-
3240 QByteArray buffer;-
3241 getenv_s(&requiredSize, 0, 0, varName);-
3242 if (requiredSize == 0)-
3243 return buffer;-
3244 buffer.resize(int(requiredSize));-
3245 getenv_s(&requiredSize, buffer.data(), requiredSize, varName);-
3246 // requiredSize includes the terminating null, which we don't want.-
3247 Q_ASSERT(buffer.endsWith('\0'));-
3248 buffer.chop(1);-
3249 return buffer;-
3250#else-
3251 return QByteArray(::getenv(varName));
executed 48198 times by 361 tests: return QByteArray(::getenv(varName));
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • ...
48198
3252#endif-
3253}-
3254-
3255/*!-
3256 \relates <QtGlobal>-
3257 \since 5.1-
3258-
3259 Returns whether the environment variable \a varName is empty.-
3260-
3261 Equivalent to-
3262 \code-
3263 qgetenv(varName).isEmpty()-
3264 \endcode-
3265 except that it's potentially much faster, and can't throw exceptions.-
3266-
3267 \sa qgetenv(), qEnvironmentVariableIsSet()-
3268*/-
3269bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT-
3270{-
3271 QMutexLocker locker(&environmentMutex);-
3272#if defined(_MSC_VER) && _MSC_VER >= 1400-
3273 // we provide a buffer that can only hold the empty string, so-
3274 // when the env.var isn't empty, we'll get an ERANGE error (buffer-
3275 // too small):-
3276 size_t dummy;-
3277 char buffer = '\0';-
3278 return getenv_s(&dummy, &buffer, 1, varName) != ERANGE;-
3279#else-
3280 const char * const value = ::getenv(varName);-
3281 return !value || !*value;
executed 1243771 times by 517 tests: return !value || !*value;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • ...
1243771
3282#endif-
3283}-
3284-
3285/*!-
3286 \relates <QtGlobal>-
3287 \since 5.5-
3288-
3289 Returns the numerical value of the environment variable \a varName.-
3290 If \a ok is not null, sets \c{*ok} to \c true or \c false depending-
3291 on the success of the conversion.-
3292-
3293 Equivalent to-
3294 \code-
3295 qgetenv(varName).toInt()-
3296 \endcode-
3297 except that it's much faster, and can't throw exceptions.-
3298-
3299 \sa qgetenv(), qEnvironmentVariableIsSet()-
3300*/-
3301int qEnvironmentVariableIntValue(const char *varName, bool *ok) Q_DECL_NOEXCEPT-
3302{-
3303 QMutexLocker locker(&environmentMutex);-
3304#if defined(_MSC_VER) && _MSC_VER >= 1400-
3305 // we provide a buffer that can hold any int value:-
3306 static const int NumBinaryDigitsPerOctalDigit = 3;-
3307 static const int MaxDigitsForOctalInt =-
3308 (std::numeric_limits<uint>::digits + NumBinaryDigitsPerOctalDigit - 1) / NumBinaryDigitsPerOctalDigit;-
3309 char buffer[MaxDigitsForOctalInt + 2]; // +1 for NUL +1 for optional '-'-
3310 size_t dummy;-
3311 if (getenv_s(&dummy, buffer, sizeof buffer, varName) != 0) {-
3312 if (ok)-
3313 *ok = false;-
3314 return 0;-
3315 }-
3316#else-
3317 const char * const buffer = ::getenv(varName);-
3318 if (!buffer || !*buffer) {
!bufferDescription
TRUEevaluated 2761 times by 507 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
FALSEevaluated 45 times by 2 tests
Evaluated by:
  • tst_QGestureRecognizer
  • tst_QGetPutEnv
!*bufferDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QGetPutEnv
FALSEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QGestureRecognizer
  • tst_QGetPutEnv
2-2761
3319 if (ok)
okDescription
TRUEevaluated 1503 times by 503 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
FALSEevaluated 1260 times by 196 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • ...
1260-1503
3320 *ok = false;
executed 1503 times by 503 tests: *ok = false;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
1503
3321 return 0;
executed 2763 times by 507 tests: return 0;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSocket
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • ...
2763
3322 }-
3323#endif-
3324 bool ok_ = true;-
3325 const qlonglong value = qstrtoll(buffer, Q_NULLPTR, 0, &ok_);-
3326 if (int(value) != value) { // this is the check in QByteArray::toInt(), keep it in sync
int(value) != valueDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QGetPutEnv
FALSEevaluated 29 times by 2 tests
Evaluated by:
  • tst_QGestureRecognizer
  • tst_QGetPutEnv
14-29
3327 if (ok)
okDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QGetPutEnv
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QGetPutEnv
7
3328 *ok = false;
executed 7 times by 1 test: *ok = false;
Executed by:
  • tst_QGetPutEnv
7
3329 return 0;
executed 14 times by 1 test: return 0;
Executed by:
  • tst_QGetPutEnv
14
3330 } else if (ok) {
okDescription
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QGestureRecognizer
  • tst_QGetPutEnv
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QGetPutEnv
14-15
3331 *ok = ok_;-
3332 }
executed 15 times by 2 tests: end of block
Executed by:
  • tst_QGestureRecognizer
  • tst_QGetPutEnv
15
3333 return int(value);
executed 29 times by 2 tests: return int(value);
Executed by:
  • tst_QGestureRecognizer
  • tst_QGetPutEnv
29
3334}-
3335-
3336/*!-
3337 \relates <QtGlobal>-
3338 \since 5.1-
3339-
3340 Returns whether the environment variable \a varName is set.-
3341-
3342 Equivalent to-
3343 \code-
3344 !qgetenv(varName).isNull()-
3345 \endcode-
3346 except that it's potentially much faster, and can't throw exceptions.-
3347-
3348 \sa qgetenv(), qEnvironmentVariableIsEmpty()-
3349*/-
3350bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT-
3351{-
3352 QMutexLocker locker(&environmentMutex);-
3353#if defined(_MSC_VER) && _MSC_VER >= 1400-
3354 size_t requiredSize = 0;-
3355 (void)getenv_s(&requiredSize, 0, 0, varName);-
3356 return requiredSize != 0;-
3357#else-
3358 return ::getenv(varName) != 0;
executed 1985 times by 178 tests: return ::getenv(varName) != 0;
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDBusXmlParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • ...
1985
3359#endif-
3360}-
3361-
3362/*!-
3363 \relates <QtGlobal>-
3364-
3365 This function sets the \a value of the environment variable named-
3366 \a varName. It will create the variable if it does not exist. It-
3367 returns 0 if the variable could not be set.-
3368-
3369 Calling qputenv with an empty value removes the environment variable on-
3370 Windows, and makes it set (but empty) on Unix. Prefer using qunsetenv()-
3371 for fully portable behavior.-
3372-
3373 \note qputenv() was introduced because putenv() from the standard-
3374 C library was deprecated in VC2005 (and later versions). qputenv()-
3375 uses the replacement function in VC, and calls the standard C-
3376 library's implementation on all other platforms.-
3377-
3378 \sa qgetenv()-
3379*/-
3380bool qputenv(const char *varName, const QByteArray& value)-
3381{-
3382 QMutexLocker locker(&environmentMutex);-
3383#if defined(_MSC_VER) && _MSC_VER >= 1400-
3384 return _putenv_s(varName, value.constData()) == 0;-
3385#elif (defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L) || defined(Q_OS_HAIKU)-
3386 // POSIX.1-2001 has setenv-
3387 return setenv(varName, value.constData(), true) == 0;
executed 1846 times by 13 tests: return setenv(varName, value.constData(), true) == 0;
Executed by:
  • tst_QApplication
  • tst_QDateTime
  • tst_QDir
  • tst_QGetPutEnv
  • tst_QLogging
  • tst_QLoggingRegistry
  • tst_QMimeDatabase
  • tst_QNetworkProxyFactory
  • tst_QProcessEnvironment
  • tst_qmimetype
  • tst_qstandardpaths
  • tst_rcc
  • tst_selftests - unknown status
1846
3388#else-
3389 QByteArray buffer(varName);-
3390 buffer += '=';-
3391 buffer += value;-
3392 char* envVar = qstrdup(buffer.constData());-
3393 int result = putenv(envVar);-
3394 if (result != 0) // error. we have to delete the string.-
3395 delete[] envVar;-
3396 return result == 0;-
3397#endif-
3398}-
3399-
3400/*!-
3401 \relates <QtGlobal>-
3402-
3403 This function deletes the variable \a varName from the environment.-
3404-
3405 Returns \c true on success.-
3406-
3407 \since 5.1-
3408-
3409 \sa qputenv(), qgetenv()-
3410*/-
3411bool qunsetenv(const char *varName)-
3412{-
3413 QMutexLocker locker(&environmentMutex);-
3414#if defined(_MSC_VER) && _MSC_VER >= 1400-
3415 return _putenv_s(varName, "") == 0;-
3416#elif (defined(_POSIX_VERSION) && (_POSIX_VERSION-0) >= 200112L) || defined(Q_OS_BSD4) || defined(Q_OS_HAIKU)-
3417 // POSIX.1-2001, BSD and Haiku have unsetenv-
3418 return unsetenv(varName) == 0;
executed 74 times by 4 tests: return unsetenv(varName) == 0;
Executed by:
  • tst_QDateTime
  • tst_QGetPutEnv
  • tst_QLoggingRegistry
  • tst_QNetworkProxyFactory
74
3419#elif defined(Q_CC_MINGW)-
3420 // On mingw, putenv("var=") removes "var" from the environment-
3421 QByteArray buffer(varName);-
3422 buffer += '=';-
3423 return putenv(buffer.constData()) == 0;-
3424#else-
3425 // Fallback to putenv("var=") which will insert an empty var into the-
3426 // environment and leak it-
3427 QByteArray buffer(varName);-
3428 buffer += '=';-
3429 char *envVar = qstrdup(buffer.constData());-
3430 return putenv(envVar) == 0;-
3431#endif-
3432}-
3433-
3434#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)-
3435-
3436# if defined(Q_OS_INTEGRITY) && defined(__GHS_VERSION_NUMBER) && (__GHS_VERSION_NUMBER < 500)-
3437// older versions of INTEGRITY used a long instead of a uint for the seed.-
3438typedef long SeedStorageType;-
3439# else-
3440typedef uint SeedStorageType;-
3441# endif-
3442-
3443typedef QThreadStorage<SeedStorageType *> SeedStorage;-
3444Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value
executed 52 times by 51 tests: end of block
Executed by:
  • tst_compiler - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qalgorithms - unknown status
  • tst_qauthenticator - unknown status
  • tst_qcolordialog - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdir - unknown status
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
  • tst_qfile - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qfileinfo - unknown status
  • tst_qfilesystemmodel - unknown status
  • tst_qfilesystemwatcher - unknown status
  • tst_qfuture - unknown status
  • tst_qgraphicsitem - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qgraphicsscene - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qicon - unknown status
  • ...
executed 52 times by 51 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_compiler - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qalgorithms - unknown status
  • tst_qauthenticator - unknown status
  • tst_qcolordialog - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdir - unknown status
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
  • tst_qfile - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qfileinfo - unknown status
  • tst_qfilesystemmodel - unknown status
  • tst_qfilesystemwatcher - unknown status
  • tst_qfuture - unknown status
  • tst_qgraphicsitem - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qgraphicsscene - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qicon - unknown status
  • ...
executed 20183061 times by 51 tests: return &holder.value;
Executed by:
  • tst_Compiler
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAlgorithms
  • tst_QAuthenticator
  • tst_QColorDialog
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFuture
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QImage
  • ...
guard.load() =...c::InitializedDescription
TRUEevaluated 52 times by 51 tests
Evaluated by:
  • tst_compiler - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_networkselftest - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qalgorithms - unknown status
  • tst_qauthenticator - unknown status
  • tst_qcolordialog - unknown status
  • tst_qdbusmarshall - unknown status
  • tst_qdir - unknown status
  • tst_qdnslookup - unknown status
  • tst_qdnslookup_appless - unknown status
  • tst_qfile - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qfileinfo - unknown status
  • tst_qfilesystemmodel - unknown status
  • tst_qfilesystemwatcher - unknown status
  • tst_qfuture - unknown status
  • tst_qgraphicsitem - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qgraphicsscene - unknown status
  • tst_qhttpnetworkconnection - unknown status
  • tst_qhttpsocketengine - unknown status
  • tst_qicon - unknown status
  • ...
FALSEnever evaluated
0-20183061
3445-
3446#elif defined(Q_OS_ANDROID)-
3447typedef QThreadStorage<QJNIObjectPrivate> AndroidRandomStorage;-
3448Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS)-
3449#endif-
3450-
3451/*!-
3452 \relates <QtGlobal>-
3453 \since 4.2-
3454-
3455 Thread-safe version of the standard C++ \c srand() function.-
3456-
3457 Sets the argument \a seed to be used to generate a new random number sequence of-
3458 pseudo random integers to be returned by qrand().-
3459-
3460 The sequence of random numbers generated is deterministic per thread. For example,-
3461 if two threads call qsrand(1) and subsequently call qrand(), the threads will get-
3462 the same random number sequence.-
3463-
3464 \sa qrand()-
3465*/-
3466void qsrand(uint seed)-
3467{-
3468#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)-
3469 SeedStorage *seedStorage = randTLS();-
3470 if (seedStorage) {
seedStorageDescription
TRUEevaluated 30 times by 6 tests
Evaluated by:
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QNetworkReply
  • tst_QRand
  • tst_QTemporaryFile
  • tst_Spdy
FALSEnever evaluated
0-30
3471 SeedStorageType *pseed = seedStorage->localData();-
3472 if (!pseed)
!pseedDescription
TRUEevaluated 23 times by 2 tests
Evaluated by:
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
FALSEevaluated 7 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QRand
  • tst_QTemporaryFile
  • tst_Spdy
7-23
3473 seedStorage->setLocalData(pseed = new SeedStorageType);
executed 23 times by 2 tests: seedStorage->setLocalData(pseed = new SeedStorageType);
Executed by:
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
23
3474 *pseed = seed;-
3475 } else {
executed 30 times by 6 tests: end of block
Executed by:
  • tst_QDnsLookup
  • tst_QDnsLookup_Appless
  • tst_QNetworkReply
  • tst_QRand
  • tst_QTemporaryFile
  • tst_Spdy
30
3476 //global static seed storage should always exist,-
3477 //except after being deleted by QGlobalStaticDeleter.-
3478 //But since it still can be called from destructor of another-
3479 //global static object, fallback to srand(seed)-
3480 srand(seed);-
3481 }
never executed: end of block
0
3482#elif defined(Q_OS_ANDROID)-
3483 if (randomTLS->hasLocalData()) {-
3484 randomTLS->localData().callMethod<void>("setSeed", "(J)V", jlong(seed));-
3485 return;-
3486 }-
3487-
3488 QJNIObjectPrivate random("java/util/Random",-
3489 "(J)V",-
3490 jlong(seed));-
3491 if (!random.isValid()) {-
3492 srand(seed);-
3493 return;-
3494 }-
3495-
3496 randomTLS->setLocalData(random);-
3497#else-
3498 // On Windows srand() and rand() already use Thread-Local-Storage-
3499 // to store the seed between calls-
3500 // this is also valid for QT_NO_THREAD-
3501 srand(seed);-
3502#endif-
3503}-
3504-
3505/*!-
3506 \relates <QtGlobal>-
3507 \since 4.2-
3508-
3509 Thread-safe version of the standard C++ \c rand() function.-
3510-
3511 Returns a value between 0 and \c RAND_MAX (defined in \c <cstdlib> and-
3512 \c <stdlib.h>), the next number in the current sequence of pseudo-random-
3513 integers.-
3514-
3515 Use \c qsrand() to initialize the pseudo-random number generator with-
3516 a seed value.-
3517-
3518 \sa qsrand()-
3519*/-
3520int qrand()-
3521{-
3522#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)-
3523 SeedStorage *seedStorage = randTLS();-
3524 if (seedStorage) {
seedStorageDescription
TRUEevaluated 20183031 times by 50 tests
Evaluated by:
  • tst_Compiler
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAlgorithms
  • tst_QAuthenticator
  • tst_QColorDialog
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QDnsLookup
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFuture
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • ...
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qlockfile - unknown status
1-20183031
3525 SeedStorageType *pseed = seedStorage->localData();-
3526 if (!pseed) {
!pseedDescription
TRUEevaluated 649 times by 48 tests
Evaluated by:
  • tst_Compiler
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAlgorithms
  • tst_QAuthenticator
  • tst_QColorDialog
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFuture
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLockFile
  • ...
FALSEevaluated 20182382 times by 44 tests
Evaluated by:
  • tst_Compiler
  • tst_LargeFile
  • tst_QAbstractNetworkCache
  • tst_QAlgorithms
  • tst_QAuthenticator
  • tst_QColorDialog
  • tst_QDir
  • tst_QDnsLookup
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • ...
649-20182382
3527 seedStorage->setLocalData(pseed = new SeedStorageType);-
3528 *pseed = 1;-
3529 }
executed 649 times by 48 tests: end of block
Executed by:
  • tst_Compiler
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAlgorithms
  • tst_QAuthenticator
  • tst_QColorDialog
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFuture
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QLockFile
  • ...
649
3530 return rand_r(pseed);
executed 20183031 times by 50 tests: return rand_r(pseed);
Executed by:
  • tst_Compiler
  • tst_LargeFile
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QAlgorithms
  • tst_QAuthenticator
  • tst_QColorDialog
  • tst_QDBusMarshall
  • tst_QDir
  • tst_QDnsLookup
  • tst_QFile
  • tst_QFileDialog2
  • tst_QFileInfo
  • tst_QFileSystemModel
  • tst_QFileSystemWatcher
  • tst_QFiledialog
  • tst_QFuture
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • ...
20183031
3531 } else {-
3532 //global static seed storage should always exist,-
3533 //except after being deleted by QGlobalStaticDeleter.-
3534 //But since it still can be called from destructor of another-
3535 //global static object, fallback to rand()-
3536 return rand();
executed 1 time by 1 test: return rand();
Executed by:
  • tst_qlockfile - unknown status
1
3537 }-
3538#elif defined(Q_OS_ANDROID)-
3539 AndroidRandomStorage *randomStorage = randomTLS();-
3540 if (!randomStorage)-
3541 return rand();-
3542-
3543 if (randomStorage->hasLocalData()) {-
3544 return randomStorage->localData().callMethod<jint>("nextInt",-
3545 "(I)I",-
3546 RAND_MAX);-
3547 }-
3548-
3549 QJNIObjectPrivate random("java/util/Random",-
3550 "(J)V",-
3551 jlong(1));-
3552-
3553 if (!random.isValid())-
3554 return rand();-
3555-
3556 randomStorage->setLocalData(random);-
3557 return random.callMethod<jint>("nextInt", "(I)I", RAND_MAX);-
3558#else-
3559 // On Windows srand() and rand() already use Thread-Local-Storage-
3560 // to store the seed between calls-
3561 // this is also valid for QT_NO_THREAD-
3562 return rand();-
3563#endif-
3564}-
3565-
3566/*!-
3567 \macro forever-
3568 \relates <QtGlobal>-
3569-
3570 This macro is provided for convenience for writing infinite-
3571 loops.-
3572-
3573 Example:-
3574-
3575 \snippet code/src_corelib_global_qglobal.cpp 31-
3576-
3577 It is equivalent to \c{for (;;)}.-
3578-
3579 If you're worried about namespace pollution, you can disable this-
3580 macro by adding the following line to your \c .pro file:-
3581-
3582 \snippet code/src_corelib_global_qglobal.cpp 32-
3583-
3584 \sa Q_FOREVER-
3585*/-
3586-
3587/*!-
3588 \macro Q_FOREVER-
3589 \relates <QtGlobal>-
3590-
3591 Same as \l{forever}.-
3592-
3593 This macro is available even when \c no_keywords is specified-
3594 using the \c .pro file's \c CONFIG variable.-
3595-
3596 \sa foreach()-
3597*/-
3598-
3599/*!-
3600 \macro foreach(variable, container)-
3601 \relates <QtGlobal>-
3602-
3603 This macro is used to implement Qt's \c foreach loop. The \a-
3604 variable parameter is a variable name or variable definition; the-
3605 \a container parameter is a Qt container whose value type-
3606 corresponds to the type of the variable. See \l{The foreach-
3607 Keyword} for details.-
3608-
3609 If you're worried about namespace pollution, you can disable this-
3610 macro by adding the following line to your \c .pro file:-
3611-
3612 \snippet code/src_corelib_global_qglobal.cpp 33-
3613-
3614 \note Since Qt 5.7, the use of this macro is discouraged. It will-
3615 be removed in a future version of Qt. Please use C++11 range-for,-
3616 possibly with qAsConst(), as needed.-
3617-
3618 \sa qAsConst()-
3619*/-
3620-
3621/*!-
3622 \macro Q_FOREACH(variable, container)-
3623 \relates <QtGlobal>-
3624-
3625 Same as foreach(\a variable, \a container).-
3626-
3627 This macro is available even when \c no_keywords is specified-
3628 using the \c .pro file's \c CONFIG variable.-
3629-
3630 \note Since Qt 5.7, the use of this macro is discouraged. It will-
3631 be removed in a future version of Qt. Please use C++11 range-for,-
3632 possibly with qAsConst(), as needed.-
3633-
3634 \sa qAsConst()-
3635*/-
3636-
3637/*!-
3638 \fn qAsConst(T &t)-
3639 \relates <QtGlobal>-
3640 \since 5.7-
3641-
3642 Returns \a t cast to \c{const T}.-
3643-
3644 This function is a Qt implementation of C++17's std::as_const(),-
3645 a cast function like std::move(). But while std::move() turns-
3646 lvalues into rvalues, this function turns non-const lvalues into-
3647 const lvalues. Like std::as_const(), it doesn't work on rvalues,-
3648 because it cannot be efficiently implemented for rvalues without-
3649 leaving dangling references.-
3650-
3651 Its main use in Qt is to prevent implicitly-shared Qt containers-
3652 from detaching:-
3653 \code-
3654 QString s = ...;-
3655 for (QChar ch : s) // detaches 's' (performs a deep-copy if 's' was shared)-
3656 process(ch);-
3657 for (QChar ch : qAsConst(s)) // ok, no detach attempt-
3658 process(ch);-
3659 \endcode-
3660-
3661 Of course, in this case, you could (and probably should) have declared-
3662 \c s as \c const in the first place:-
3663 \code-
3664 const QString s = ...;-
3665 for (QChar ch : s) // ok, no detach attempt on const objects-
3666 process(ch);-
3667 \endcode-
3668 but often that is not easily possible.-
3669-
3670 It is important to note that qAsConst() does not copy its argument,-
3671 it just performs a \c{const_cast<const T&>(t)}. This is also the reason-
3672 why it is designed to fail for rvalues: The returned reference would go-
3673 stale too soon. So while this works (but detaches the returned object):-
3674 \code-
3675 for (QChar ch : funcReturningQString())-
3676 process(ch); // OK, the returned object is kept alive for the loop's duration-
3677 \endcode-
3678-
3679 this would not:-
3680 \code-
3681 for (QChar ch : qAsConst(funcReturningQString()))-
3682 process(ch); // ERROR: ch is copied from deleted memory-
3683 \endcode-
3684-
3685 To prevent this construct from compiling (and failing at runtime), qAsConst() has-
3686 a second, deleted, overload which binds to rvalues.-
3687*/-
3688-
3689/*!-
3690 \fn qAsConst(const T &&t)-
3691 \relates <QtGlobal>-
3692 \since 5.7-
3693 \overload-
3694-
3695 This overload is deleted to prevent a dangling reference in code like-
3696 \code-
3697 for (QChar ch : qAsConst(funcReturningQString()))-
3698 process(ch); // ERROR: ch is copied from deleted memory-
3699 \endcode-
3700*/-
3701-
3702/*!-
3703 \macro QT_TR_NOOP(sourceText)-
3704 \relates <QtGlobal>-
3705-
3706 Marks the string literal \a sourceText for dynamic translation in-
3707 the current context (class), i.e the stored \a sourceText will not-
3708 be altered.-
3709-
3710 The macro expands to \a sourceText.-
3711-
3712 Example:-
3713-
3714 \snippet code/src_corelib_global_qglobal.cpp 34-
3715-
3716 The macro QT_TR_NOOP_UTF8() is identical except that it tells lupdate-
3717 that the source string is encoded in UTF-8. Corresponding variants-
3718 exist in the QT_TRANSLATE_NOOP() family of macros, too.-
3719-
3720 \sa QT_TRANSLATE_NOOP(), {Internationalization with Qt}-
3721*/-
3722-
3723/*!-
3724 \macro QT_TRANSLATE_NOOP(context, sourceText)-
3725 \relates <QtGlobal>-
3726-
3727 Marks the string literal \a sourceText for dynamic translation in-
3728 the given \a context; i.e, the stored \a sourceText will not be-
3729 altered. The \a context is typically a class and also needs to-
3730 be specified as string literal.-
3731-
3732 The macro expands to \a sourceText.-
3733-
3734 Example:-
3735-
3736 \snippet code/src_corelib_global_qglobal.cpp 35-
3737-
3738 \sa QT_TR_NOOP(), QT_TRANSLATE_NOOP3(), {Internationalization with Qt}-
3739*/-
3740-
3741/*!-
3742 \macro QT_TRANSLATE_NOOP3(context, sourceText, comment)-
3743 \relates <QtGlobal>-
3744 \since 4.4-
3745-
3746 Marks the string literal \a sourceText for dynamic translation in the-
3747 given \a context and with \a comment, i.e the stored \a sourceText will-
3748 not be altered. The \a context is typically a class and also needs to-
3749 be specified as string literal. The string literal \a comment-
3750 will be available for translators using e.g. Qt Linguist.-
3751-
3752 The macro expands to anonymous struct of the two string-
3753 literals passed as \a sourceText and \a comment.-
3754-
3755 Example:-
3756-
3757 \snippet code/src_corelib_global_qglobal.cpp 36-
3758-
3759 \sa QT_TR_NOOP(), QT_TRANSLATE_NOOP(), {Internationalization with Qt}-
3760*/-
3761-
3762/*!-
3763 \fn QString qtTrId(const char *id, int n = -1)-
3764 \relates <QtGlobal>-
3765 \reentrant-
3766 \since 4.6-
3767-
3768 \brief The qtTrId function finds and returns a translated string.-
3769-
3770 Returns a translated string identified by \a id.-
3771 If no matching string is found, the id itself is returned. This-
3772 should not happen under normal conditions.-
3773-
3774 If \a n >= 0, all occurrences of \c %n in the resulting string-
3775 are replaced with a decimal representation of \a n. In addition,-
3776 depending on \a n's value, the translation text may vary.-
3777-
3778 Meta data and comments can be passed as documented for QObject::tr().-
3779 In addition, it is possible to supply a source string template like that:-
3780-
3781 \tt{//% <C string>}-
3782-
3783 or-
3784-
3785 \tt{\\begincomment% <C string> \\endcomment}-
3786-
3787 Example:-
3788-
3789 \snippet code/src_corelib_global_qglobal.cpp qttrid-
3790-
3791 Creating QM files suitable for use with this function requires passing-
3792 the \c -idbased option to the \c lrelease tool.-
3793-
3794 \warning This method is reentrant only if all translators are-
3795 installed \e before calling this method. Installing or removing-
3796 translators while performing translations is not supported. Doing-
3797 so will probably result in crashes or other undesirable behavior.-
3798-
3799 \sa QObject::tr(), QCoreApplication::translate(), {Internationalization with Qt}-
3800*/-
3801-
3802/*!-
3803 \macro QT_TRID_NOOP(id)-
3804 \relates <QtGlobal>-
3805 \since 4.6-
3806-
3807 \brief The QT_TRID_NOOP macro marks an id for dynamic translation.-
3808-
3809 The only purpose of this macro is to provide an anchor for attaching-
3810 meta data like to qtTrId().-
3811-
3812 The macro expands to \a id.-
3813-
3814 Example:-
3815-
3816 \snippet code/src_corelib_global_qglobal.cpp qttrid_noop-
3817-
3818 \sa qtTrId(), {Internationalization with Qt}-
3819*/-
3820-
3821/*!-
3822 \macro Q_LIKELY(expr)-
3823 \relates <QtGlobal>-
3824 \since 4.8-
3825-
3826 \brief Hints to the compiler that the enclosed condition, \a expr, is-
3827 likely to evaluate to \c true.-
3828-
3829 Use of this macro can help the compiler to optimize the code.-
3830-
3831 Example:-
3832-
3833 \snippet code/src_corelib_global_qglobal.cpp qlikely-
3834-
3835 \sa Q_UNLIKELY()-
3836*/-
3837-
3838/*!-
3839 \macro Q_UNLIKELY(expr)-
3840 \relates <QtGlobal>-
3841 \since 4.8-
3842-
3843 \brief Hints to the compiler that the enclosed condition, \a expr, is-
3844 likely to evaluate to \c false.-
3845-
3846 Use of this macro can help the compiler to optimize the code.-
3847-
3848 Example:-
3849-
3850 \snippet code/src_corelib_global_qglobal.cpp qunlikely-
3851-
3852 \sa Q_LIKELY()-
3853*/-
3854-
3855/*!-
3856 \macro QT_POINTER_SIZE-
3857 \relates <QtGlobal>-
3858-
3859 Expands to the size of a pointer in bytes (4 or 8). This is-
3860 equivalent to \c sizeof(void *) but can be used in a preprocessor-
3861 directive.-
3862*/-
3863-
3864/*!-
3865 \macro QABS(n)-
3866 \relates <QtGlobal>-
3867 \obsolete-
3868-
3869 Use qAbs(\a n) instead.-
3870-
3871 \sa QMIN(), QMAX()-
3872*/-
3873-
3874/*!-
3875 \macro QMIN(x, y)-
3876 \relates <QtGlobal>-
3877 \obsolete-
3878-
3879 Use qMin(\a x, \a y) instead.-
3880-
3881 \sa QMAX(), QABS()-
3882*/-
3883-
3884/*!-
3885 \macro QMAX(x, y)-
3886 \relates <QtGlobal>-
3887 \obsolete-
3888-
3889 Use qMax(\a x, \a y) instead.-
3890-
3891 \sa QMIN(), QABS()-
3892*/-
3893-
3894/*!-
3895 \macro const char *qPrintable(const QString &str)-
3896 \relates <QtGlobal>-
3897-
3898 Returns \a str as a \c{const char *}. This is equivalent to-
3899 \a{str}.toLocal8Bit().constData().-
3900-
3901 The char pointer will be invalid after the statement in which-
3902 qPrintable() is used. This is because the array returned by-
3903 QString::toLocal8Bit() will fall out of scope.-
3904-
3905 \note qDebug(), qInfo(), qWarning(), qCritical(), qFatal() expect-
3906 %s arguments to be UTF-8 encoded, while qPrintable() converts to-
3907 local 8-bit encoding. Therefore qUtf8Printable() should be used-
3908 for logging strings instead of qPrintable().-
3909-
3910 \sa qUtf8Printable()-
3911*/-
3912-
3913/*!-
3914 \macro const char *qUtf8Printable(const QString &str)-
3915 \relates <QtGlobal>-
3916 \since 5.4-
3917-
3918 Returns \a str as a \c{const char *}. This is equivalent to-
3919 \a{str}.toUtf8().constData().-
3920-
3921 The char pointer will be invalid after the statement in which-
3922 qUtf8Printable() is used. This is because the array returned by-
3923 QString::toUtf8() will fall out of scope.-
3924-
3925 Example:-
3926-
3927 \snippet code/src_corelib_global_qglobal.cpp 37-
3928-
3929 \sa qPrintable(), qDebug(), qInfo(), qWarning(), qCritical(), qFatal()-
3930*/-
3931-
3932/*!-
3933 \macro const wchar_t *qUtf16Printable(const QString &str)-
3934 \relates <QtGlobal>-
3935 \since 5.7-
3936-
3937 Returns \a str as a \c{const ushort *}, but cast to a \c{const wchar_t *}-
3938 to avoid warnings. This is equivalent to \a{str}.utf16() plus some casting.-
3939-
3940 The only useful thing you can do with the return value of this macro is to-
3941 pass it to QString::asprintf() for use in a \c{%ls} conversion. In particular,-
3942 the return value is \e{not} a valid \c{const wchar_t*}!-
3943-
3944 In general, the pointer will be invalid after the statement in which-
3945 qUtf16Printable() is used. This is because the pointer may have been-
3946 obtained from a temporary expression, which will fall out of scope.-
3947-
3948 Example:-
3949-
3950 \snippet code/src_corelib_global_qglobal.cpp qUtf16Printable-
3951-
3952 \sa qPrintable(), qDebug(), qInfo(), qWarning(), qCritical(), qFatal()-
3953*/-
3954-
3955/*!-
3956 \macro Q_DECLARE_TYPEINFO(Type, Flags)-
3957 \relates <QtGlobal>-
3958-
3959 You can use this macro to specify information about a custom type-
3960 \a Type. With accurate type information, Qt's \l{Container Classes}-
3961 {generic containers} can choose appropriate storage methods and-
3962 algorithms.-
3963-
3964 \a Flags can be one of the following:-
3965-
3966 \list-
3967 \li \c Q_PRIMITIVE_TYPE specifies that \a Type is a POD (plain old-
3968 data) type with no constructor or destructor, or else a type where-
3969 every bit pattern is a valid object and memcpy() creates a valid-
3970 independent copy of the object.-
3971 \li \c Q_MOVABLE_TYPE specifies that \a Type has a constructor-
3972 and/or a destructor but can be moved in memory using \c-
3973 memcpy(). Note: despite the name, this has nothing to do with move-
3974 constructors or C++ move semantics.-
3975 \li \c Q_COMPLEX_TYPE (the default) specifies that \a Type has-
3976 constructors and/or a destructor and that it may not be moved-
3977 in memory.-
3978 \endlist-
3979-
3980 Example of a "primitive" type:-
3981-
3982 \snippet code/src_corelib_global_qglobal.cpp 38-
3983-
3984 An example of a non-POD "primitive" type is QUuid: Even though-
3985 QUuid has constructors (and therefore isn't POD), every bit-
3986 pattern still represents a valid object, and memcpy() can be used-
3987 to create a valid independent copy of a QUuid object.-
3988-
3989 Example of a movable type:-
3990-
3991 \snippet code/src_corelib_global_qglobal.cpp 39-
3992*/-
3993-
3994/*!-
3995 \macro Q_UNUSED(name)-
3996 \relates <QtGlobal>-
3997-
3998 Indicates to the compiler that the parameter with the specified-
3999 \a name is not used in the body of a function. This can be used to-
4000 suppress compiler warnings while allowing functions to be defined-
4001 with meaningful parameter names in their signatures.-
4002*/-
4003-
4004struct QInternal_CallBackTable {-
4005 QVector<QList<qInternalCallback> > callbacks;-
4006};-
4007-
4008Q_GLOBAL_STATIC(QInternal_CallBackTable, global_callback_table)
executed 1172 times by 420 tests: end of block
Executed by:
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qanimationgroup - unknown status
  • tst_qapplication - unknown status
  • ...
executed 1172 times by 420 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qanimationgroup - unknown status
  • tst_qapplication - unknown status
  • ...
executed 1768577 times by 526 tests: return &holder.value;
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • ...
guard.load() =...c::InitializedDescription
TRUEevaluated 1172 times by 420 tests
Evaluated by:
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractnetworkcache - unknown status
  • tst_qabstractprintdialog - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qabstractscrollarea - unknown status
  • tst_qabstractslider - unknown status
  • tst_qabstractsocket - unknown status
  • tst_qabstractspinbox - unknown status
  • tst_qabstracttextdocumentlayout - unknown status
  • tst_qaccessibility - unknown status
  • tst_qaction - unknown status
  • tst_qactiongroup - unknown status
  • tst_qanimationgroup - unknown status
  • tst_qapplication - unknown status
  • ...
FALSEnever evaluated
0-1768577
4009-
4010bool QInternal::registerCallback(Callback cb, qInternalCallback callback)-
4011{-
4012 if (cb >= 0 && cb < QInternal::LastCallback) {
cb >= 0Description
TRUEnever evaluated
FALSEnever evaluated
cb < QInternal::LastCallbackDescription
TRUEnever evaluated
FALSEnever evaluated
0
4013 QInternal_CallBackTable *cbt = global_callback_table();-
4014 cbt->callbacks.resize(cb + 1);-
4015 cbt->callbacks[cb].append(callback);-
4016 return true;
never executed: return true;
0
4017 }-
4018 return false;
never executed: return false;
0
4019}-
4020-
4021bool QInternal::unregisterCallback(Callback cb, qInternalCallback callback)-
4022{-
4023 if (cb >= 0 && cb < QInternal::LastCallback) {
cb >= 0Description
TRUEnever evaluated
FALSEnever evaluated
cb < QInternal::LastCallbackDescription
TRUEnever evaluated
FALSEnever evaluated
0
4024 QInternal_CallBackTable *cbt = global_callback_table();-
4025 return (bool) cbt->callbacks[cb].removeAll(callback);
never executed: return (bool) cbt->callbacks[cb].removeAll(callback);
0
4026 }-
4027 return false;
never executed: return false;
0
4028}-
4029-
4030bool QInternal::activateCallbacks(Callback cb, void **parameters)-
4031{-
4032 Q_ASSERT_X(cb >= 0, "QInternal::activateCallback()", "Callback id must be a valid id");-
4033-
4034 QInternal_CallBackTable *cbt = global_callback_table();-
4035 if (cbt && cb < cbt->callbacks.size()) {
cbtDescription
TRUEevaluated 1768591 times by 526 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • ...
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_qdbusconnection_no_app - unknown status
cb < cbt->callbacks.size()Description
TRUEnever evaluated
FALSEevaluated 1768591 times by 526 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • ...
0-1768591
4036 QList<qInternalCallback> callbacks = cbt->callbacks[cb];-
4037 bool ret = false;-
4038 for (int i=0; i<callbacks.size(); ++i)
i<callbacks.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
4039 ret |= (callbacks.at(i))(parameters);
never executed: ret |= (callbacks.at(i))(parameters);
0
4040 return ret;
never executed: return ret;
0
4041 }-
4042 return false;
executed 1768594 times by 527 tests: return false;
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractAnimation
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBuffer
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • ...
1768594
4043}-
4044-
4045/*!-
4046 \macro Q_BYTE_ORDER-
4047 \relates <QtGlobal>-
4048-
4049 This macro can be used to determine the byte order your system-
4050 uses for storing data in memory. i.e., whether your system is-
4051 little-endian or big-endian. It is set by Qt to one of the macros-
4052 Q_LITTLE_ENDIAN or Q_BIG_ENDIAN. You normally won't need to worry-
4053 about endian-ness, but you might, for example if you need to know-
4054 which byte of an integer or UTF-16 character is stored in the-
4055 lowest address. Endian-ness is important in networking, where-
4056 computers with different values for Q_BYTE_ORDER must pass data-
4057 back and forth.-
4058-
4059 Use this macro as in the following examples.-
4060-
4061 \snippet code/src_corelib_global_qglobal.cpp 40-
4062-
4063 \sa Q_BIG_ENDIAN, Q_LITTLE_ENDIAN-
4064*/-
4065-
4066/*!-
4067 \macro Q_LITTLE_ENDIAN-
4068 \relates <QtGlobal>-
4069-
4070 This macro represents a value you can compare to the macro-
4071 Q_BYTE_ORDER to determine the endian-ness of your system. In a-
4072 little-endian system, the least significant byte is stored at the-
4073 lowest address. The other bytes follow in increasing order of-
4074 significance.-
4075-
4076 \snippet code/src_corelib_global_qglobal.cpp 41-
4077-
4078 \sa Q_BYTE_ORDER, Q_BIG_ENDIAN-
4079*/-
4080-
4081/*!-
4082 \macro Q_BIG_ENDIAN-
4083 \relates <QtGlobal>-
4084-
4085 This macro represents a value you can compare to the macro-
4086 Q_BYTE_ORDER to determine the endian-ness of your system. In a-
4087 big-endian system, the most significant byte is stored at the-
4088 lowest address. The other bytes follow in decreasing order of-
4089 significance.-
4090-
4091 \snippet code/src_corelib_global_qglobal.cpp 42-
4092-
4093 \sa Q_BYTE_ORDER, Q_LITTLE_ENDIAN-
4094*/-
4095-
4096/*!-
4097 \macro Q_GLOBAL_STATIC(type, name)-
4098 \internal-
4099-
4100 Declares a global static variable with the given \a type and \a name.-
4101-
4102 Use this macro to instantiate an object in a thread-safe way, creating-
4103 a global pointer that can be used to refer to it.-
4104-
4105 \warning This macro is subject to a race condition that can cause the object-
4106 to be constructed twice. However, if this occurs, the second instance will-
4107 be immediately deleted.-
4108-
4109 See also-
4110 \l{http://www.aristeia.com/publications.html}{"C++ and the perils of Double-Checked Locking"}-
4111 by Scott Meyers and Andrei Alexandrescu.-
4112*/-
4113-
4114/*!-
4115 \macro Q_GLOBAL_STATIC_WITH_ARGS(type, name, arguments)-
4116 \internal-
4117-
4118 Declares a global static variable with the specified \a type and \a name.-
4119-
4120 Use this macro to instantiate an object using the \a arguments specified-
4121 in a thread-safe way, creating a global pointer that can be used to refer-
4122 to it.-
4123-
4124 \warning This macro is subject to a race condition that can cause the object-
4125 to be constructed twice. However, if this occurs, the second instance will-
4126 be immediately deleted.-
4127-
4128 See also-
4129 \l{http://www.aristeia.com/publications.html}{"C++ and the perils of Double-Checked Locking"}-
4130 by Scott Meyers and Andrei Alexandrescu.-
4131*/-
4132-
4133/*!-
4134 \macro QT_NAMESPACE-
4135 \internal-
4136-
4137 If this macro is defined to \c ns all Qt classes are put in a namespace-
4138 called \c ns. Also, moc will output code putting metaobjects etc.-
4139 into namespace \c ns.-
4140-
4141 \sa QT_BEGIN_NAMESPACE, QT_END_NAMESPACE,-
4142 QT_PREPEND_NAMESPACE, QT_USE_NAMESPACE,-
4143 QT_BEGIN_INCLUDE_NAMESPACE, QT_END_INCLUDE_NAMESPACE,-
4144 QT_BEGIN_MOC_NAMESPACE, QT_END_MOC_NAMESPACE,-
4145*/-
4146-
4147/*!-
4148 \macro QT_PREPEND_NAMESPACE(identifier)-
4149 \internal-
4150-
4151 This macro qualifies \a identifier with the full namespace.-
4152 It expands to \c{::QT_NAMESPACE::identifier} if \c QT_NAMESPACE is defined-
4153 and only \a identifier otherwise.-
4154-
4155 \sa QT_NAMESPACE-
4156*/-
4157-
4158/*!-
4159 \macro QT_USE_NAMESPACE-
4160 \internal-
4161-
4162 This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined-
4163 and nothing otherwise.-
4164-
4165 \sa QT_NAMESPACE-
4166*/-
4167-
4168/*!-
4169 \macro QT_BEGIN_NAMESPACE-
4170 \internal-
4171-
4172 This macro expands to-
4173-
4174 \snippet code/src_corelib_global_qglobal.cpp begin namespace macro-
4175-
4176 if \c QT_NAMESPACE is defined and nothing otherwise. If should always-
4177 appear in the file-level scope and be followed by \c QT_END_NAMESPACE-
4178 at the same logical level with respect to preprocessor conditionals-
4179 in the same file.-
4180-
4181 As a rule of thumb, \c QT_BEGIN_NAMESPACE should appear in all Qt header-
4182 and Qt source files after the last \c{#include} line and before the first-
4183 declaration.-
4184-
4185 If that rule can't be followed because, e.g., \c{#include} lines and-
4186 declarations are wildly mixed, place \c QT_BEGIN_NAMESPACE before-
4187 the first declaration and wrap the \c{#include} lines in-
4188 \c QT_BEGIN_INCLUDE_NAMESPACE and \c QT_END_INCLUDE_NAMESPACE.-
4189-
4190 When using the \c QT_NAMESPACE feature in user code-
4191 (e.g., when building plugins statically linked to Qt) where-
4192 the user code is not intended to go into the \c QT_NAMESPACE-
4193 namespace, all forward declarations of Qt classes need to-
4194 be wrapped in \c QT_BEGIN_NAMESPACE and \c QT_END_NAMESPACE.-
4195 After that, a \c QT_USE_NAMESPACE should follow.-
4196 No further changes should be needed.-
4197-
4198 \sa QT_NAMESPACE-
4199*/-
4200-
4201/*!-
4202 \macro QT_END_NAMESPACE-
4203 \internal-
4204-
4205 This macro expands to-
4206-
4207 \snippet code/src_corelib_global_qglobal.cpp end namespace macro-
4208-
4209 if \c QT_NAMESPACE is defined and nothing otherwise. It is used to cancel-
4210 the effect of \c QT_BEGIN_NAMESPACE.-
4211-
4212 If a source file ends with a \c{#include} directive that includes a moc file,-
4213 \c QT_END_NAMESPACE should be placed before that \c{#include}.-
4214-
4215 \sa QT_NAMESPACE-
4216*/-
4217-
4218/*!-
4219 \macro QT_BEGIN_INCLUDE_NAMESPACE-
4220 \internal-
4221-
4222 This macro is equivalent to \c QT_END_NAMESPACE.-
4223 It only serves as syntactic sugar and is intended-
4224 to be used before #include lines within a-
4225 \c QT_BEGIN_NAMESPACE ... \c QT_END_NAMESPACE block.-
4226-
4227 \sa QT_NAMESPACE-
4228*/-
4229-
4230/*!-
4231 \macro QT_END_INCLUDE_NAMESPACE-
4232 \internal-
4233-
4234 This macro is equivalent to \c QT_BEGIN_NAMESPACE.-
4235 It only serves as syntactic sugar and is intended-
4236 to be used after #include lines within a-
4237 \c QT_BEGIN_NAMESPACE ... \c QT_END_NAMESPACE block.-
4238-
4239 \sa QT_NAMESPACE-
4240*/-
4241-
4242/*!-
4243 \macro QT_BEGIN_MOC_NAMESPACE-
4244 \internal-
4245-
4246 This macro is output by moc at the beginning of-
4247 moc files. It is equivalent to \c QT_USE_NAMESPACE.-
4248-
4249 \sa QT_NAMESPACE-
4250*/-
4251-
4252/*!-
4253 \macro QT_END_MOC_NAMESPACE-
4254 \internal-
4255-
4256 This macro is output by moc at the beginning of-
4257 moc files. It expands to nothing.-
4258-
4259 \sa QT_NAMESPACE-
4260*/-
4261-
4262/*!-
4263 \fn bool qFuzzyCompare(double p1, double p2)-
4264 \relates <QtGlobal>-
4265 \since 4.4-
4266 \threadsafe-
4267-
4268 Compares the floating point value \a p1 and \a p2 and-
4269 returns \c true if they are considered equal, otherwise \c false.-
4270-
4271 Note that comparing values where either \a p1 or \a p2 is 0.0 will not work,-
4272 nor does comparing values where one of the values is NaN or infinity.-
4273 If one of the values is always 0.0, use qFuzzyIsNull instead. If one of the-
4274 values is likely to be 0.0, one solution is to add 1.0 to both values.-
4275-
4276 \snippet code/src_corelib_global_qglobal.cpp 46-
4277-
4278 The two numbers are compared in a relative way, where the-
4279 exactness is stronger the smaller the numbers are.-
4280 */-
4281-
4282/*!-
4283 \fn bool qFuzzyCompare(float p1, float p2)-
4284 \relates <QtGlobal>-
4285 \since 4.4-
4286 \threadsafe-
4287-
4288 Compares the floating point value \a p1 and \a p2 and-
4289 returns \c true if they are considered equal, otherwise \c false.-
4290-
4291 The two numbers are compared in a relative way, where the-
4292 exactness is stronger the smaller the numbers are.-
4293 */-
4294-
4295/*!-
4296 \macro QT_REQUIRE_VERSION(int argc, char **argv, const char *version)-
4297 \relates <QtGlobal>-
4298-
4299 This macro can be used to ensure that the application is run-
4300 against a recent enough version of Qt. This is especially useful-
4301 if your application depends on a specific bug fix introduced in a-
4302 bug-fix release (e.g., 4.0.2).-
4303-
4304 The \a argc and \a argv parameters are the \c main() function's-
4305 \c argc and \c argv parameters. The \a version parameter is a-
4306 string literal that specifies which version of Qt the application-
4307 requires (e.g., "4.0.2").-
4308-
4309 Example:-
4310-
4311 \snippet code/src_gui_dialogs_qmessagebox.cpp 4-
4312*/-
4313-
4314/*!-
4315 \macro Q_DECL_EXPORT-
4316 \relates <QtGlobal>-
4317-
4318 This macro marks a symbol for shared library export (see-
4319 \l{sharedlibrary.html}{Creating Shared Libraries}).-
4320-
4321 \sa Q_DECL_IMPORT-
4322*/-
4323-
4324/*!-
4325 \macro Q_DECL_IMPORT-
4326 \relates <QtGlobal>-
4327-
4328 This macro declares a symbol to be an import from a shared library (see-
4329 \l{sharedlibrary.html}{Creating Shared Libraries}).-
4330-
4331 \sa Q_DECL_EXPORT-
4332*/-
4333-
4334/*!-
4335 \macro Q_DECL_CONSTEXPR-
4336 \relates <QtGlobal>-
4337-
4338 This macro can be used to declare variable that should be constructed at compile-time,-
4339 or an inline function that can be computed at compile-time.-
4340-
4341 It expands to "constexpr" if your compiler supports that C++11 keyword, or to nothing-
4342 otherwise.-
4343-
4344 \sa Q_DECL_RELAXED_CONSTEXPR-
4345*/-
4346-
4347/*!-
4348 \macro Q_DECL_RELAXED_CONSTEXPR-
4349 \relates <QtGlobal>-
4350-
4351 This macro can be used to declare an inline function that can be computed-
4352 at compile-time according to the relaxed rules from C++14.-
4353-
4354 It expands to "constexpr" if your compiler supports C++14 relaxed constant-
4355 expressions, or to nothing otherwise.-
4356-
4357 \sa Q_DECL_CONSTEXPR-
4358*/-
4359-
4360/*!-
4361 \macro qDebug(const char *message, ...)-
4362 \relates <QtGlobal>-
4363-
4364 Calls the message handler with the debug message \a message. If no-
4365 message handler has been installed, the message is printed to-
4366 stderr. Under Windows the message is sent to the console, if it is a-
4367 console application; otherwise, it is sent to the debugger. On QNX, the-
4368 message is sent to slogger2. This function does nothing if \c QT_NO_DEBUG_OUTPUT-
4369 was defined during compilation.-
4370-
4371 If you pass the function a format string and a list of arguments,-
4372 it works in similar way to the C printf() function. The format-
4373 should be a Latin-1 string.-
4374-
4375 Example:-
4376-
4377 \snippet code/src_corelib_global_qglobal.cpp 24-
4378-
4379 If you include \c <QtDebug>, a more convenient syntax is also-
4380 available:-
4381-
4382 \snippet code/src_corelib_global_qglobal.cpp 25-
4383-
4384 With this syntax, the function returns a QDebug object that is-
4385 configured to use the QtDebugMsg message type. It automatically-
4386 puts a single space between each item, and outputs a newline at-
4387 the end. It supports many C++ and Qt types.-
4388-
4389 To suppress the output at run-time, install your own message handler-
4390 with qInstallMessageHandler().-
4391-
4392 \sa qInfo(), qWarning(), qCritical(), qFatal(), qInstallMessageHandler(),-
4393 {Debugging Techniques}-
4394*/-
4395-
4396/*!-
4397 \macro qInfo(const char *message, ...)-
4398 \relates <QtGlobal>-
4399 \since 5.5-
4400-
4401 Calls the message handler with the informational message \a message. If no-
4402 message handler has been installed, the message is printed to-
4403 stderr. Under Windows, the message is sent to the console, if it is a-
4404 console application; otherwise, it is sent to the debugger. On QNX the-
4405 message is sent to slogger2. This function does nothing if \c QT_NO_INFO_OUTPUT-
4406 was defined during compilation.-
4407-
4408 If you pass the function a format string and a list of arguments,-
4409 it works in similar way to the C printf() function. The format-
4410 should be a Latin-1 string.-
4411-
4412 Example:-
4413-
4414 \snippet code/src_corelib_global_qglobal.cpp qInfo_printf-
4415-
4416 If you include \c <QtDebug>, a more convenient syntax is also-
4417 available:-
4418-
4419 \snippet code/src_corelib_global_qglobal.cpp qInfo_stream-
4420-
4421 With this syntax, the function returns a QDebug object that is-
4422 configured to use the QtInfoMsg message type. It automatically-
4423 puts a single space between each item, and outputs a newline at-
4424 the end. It supports many C++ and Qt types.-
4425-
4426 To suppress the output at run-time, install your own message handler-
4427 with qInstallMessageHandler().-
4428-
4429 \sa qDebug(), qWarning(), qCritical(), qFatal(), qInstallMessageHandler(),-
4430 {Debugging Techniques}-
4431*/-
4432-
4433/*!-
4434 \macro qWarning(const char *message, ...)-
4435 \relates <QtGlobal>-
4436-
4437 Calls the message handler with the warning message \a message. If no-
4438 message handler has been installed, the message is printed to-
4439 stderr. Under Windows, the message is sent to the debugger.-
4440 On QNX the message is sent to slogger2. This-
4441 function does nothing if \c QT_NO_WARNING_OUTPUT was defined-
4442 during compilation; it exits if the environment variable \c-
4443 QT_FATAL_WARNINGS is not empty.-
4444-
4445 This function takes a format string and a list of arguments,-
4446 similar to the C printf() function. The format should be a Latin-1-
4447 string.-
4448-
4449 Example:-
4450 \snippet code/src_corelib_global_qglobal.cpp 26-
4451-
4452 If you include <QtDebug>, a more convenient syntax is-
4453 also available:-
4454-
4455 \snippet code/src_corelib_global_qglobal.cpp 27-
4456-
4457 This syntax inserts a space between each item, and-
4458 appends a newline at the end.-
4459-
4460 To suppress the output at runtime, install your own message handler-
4461 with qInstallMessageHandler().-
4462-
4463 \sa qDebug(), qInfo(), qCritical(), qFatal(), qInstallMessageHandler(),-
4464 {Debugging Techniques}-
4465*/-
4466-
4467/*!-
4468 \macro qCritical(const char *message, ...)-
4469 \relates <QtGlobal>-
4470-
4471 Calls the message handler with the critical message \a message. If no-
4472 message handler has been installed, the message is printed to-
4473 stderr. Under Windows, the message is sent to the debugger.-
4474 On QNX the message is sent to slogger2-
4475-
4476 It exits if the environment variable QT_FATAL_CRITICALS is not empty.-
4477-
4478 This function takes a format string and a list of arguments,-
4479 similar to the C printf() function. The format should be a Latin-1-
4480 string.-
4481-
4482 Example:-
4483 \snippet code/src_corelib_global_qglobal.cpp 28-
4484-
4485 If you include <QtDebug>, a more convenient syntax is-
4486 also available:-
4487-
4488 \snippet code/src_corelib_global_qglobal.cpp 29-
4489-
4490 A space is inserted between the items, and a newline is-
4491 appended at the end.-
4492-
4493 To suppress the output at runtime, install your own message handler-
4494 with qInstallMessageHandler().-
4495-
4496 \sa qDebug(), qInfo(), qWarning(), qFatal(), qInstallMessageHandler(),-
4497 {Debugging Techniques}-
4498*/-
4499-
4500/*!-
4501 \macro qFatal(const char *message, ...)-
4502 \relates <QtGlobal>-
4503-
4504 Calls the message handler with the fatal message \a message. If no-
4505 message handler has been installed, the message is printed to-
4506 stderr. Under Windows, the message is sent to the debugger.-
4507 On QNX the message is sent to slogger2-
4508-
4509 If you are using the \b{default message handler} this function will-
4510 abort on Unix systems to create a core dump. On Windows, for debug builds,-
4511 this function will report a _CRT_ERROR enabling you to connect a debugger-
4512 to the application.-
4513-
4514 This function takes a format string and a list of arguments,-
4515 similar to the C printf() function.-
4516-
4517 Example:-
4518 \snippet code/src_corelib_global_qglobal.cpp 30-
4519-
4520 To suppress the output at runtime, install your own message handler-
4521 with qInstallMessageHandler().-
4522-
4523 \sa qDebug(), qInfo(), qWarning(), qCritical(), qInstallMessageHandler(),-
4524 {Debugging Techniques}-
4525*/-
4526-
4527/*!-
4528 \macro qMove(x)-
4529 \relates <QtGlobal>-
4530-
4531 It expands to "std::move" if your compiler supports that C++11 function, or to nothing-
4532 otherwise.-
4533-
4534 qMove takes an rvalue reference to its parameter \a x, and converts it to an xvalue.-
4535*/-
4536-
4537/*!-
4538 \macro Q_DECL_NOTHROW-
4539 \relates <QtGlobal>-
4540 \since 5.0-
4541-
4542 This macro marks a function as never throwing, under no-
4543 circumstances. If the function does nevertheless throw, the-
4544 behaviour is undefined.-
4545-
4546 The macro expands to either "throw()", if that has some benefit on-
4547 the compiler, or to C++11 noexcept, if available, or to nothing-
4548 otherwise.-
4549-
4550 If you need C++11 noexcept semantics, don't use this macro, use-
4551 Q_DECL_NOEXCEPT/Q_DECL_NOEXCEPT_EXPR instead.-
4552-
4553 \sa Q_DECL_NOEXCEPT, Q_DECL_NOEXCEPT_EXPR()-
4554*/-
4555-
4556/*!-
4557 \macro QT_TERMINATE_ON_EXCEPTION(expr)-
4558 \relates <QtGlobal>-
4559 \internal-
4560-
4561 In general, use of the Q_DECL_NOEXCEPT macro is preferred over-
4562 Q_DECL_NOTHROW, because it exhibits well-defined behavior and-
4563 supports the more powerful Q_DECL_NOEXCEPT_EXPR variant. However,-
4564 use of Q_DECL_NOTHROW has the advantage that Windows builds-
4565 benefit on a wide range or compiler versions that do not yet-
4566 support the C++11 noexcept feature.-
4567-
4568 It may therefore be beneficial to use Q_DECL_NOTHROW and emulate-
4569 the C++11 behavior manually with an embedded try/catch.-
4570-
4571 Qt provides the QT_TERMINATE_ON_EXCEPTION(expr) macro for this-
4572 purpose. It either expands to \c expr (if Qt is compiled without-
4573 exception support or the compiler supports C++11 noexcept-
4574 semantics) or to-
4575 \code-
4576 try { expr; } catch(...) { qTerminate(); }-
4577 \endcode-
4578 otherwise.-
4579-
4580 Since this macro expands to just \c expr if the compiler supports-
4581 C++11 noexcept, expecting the compiler to take over responsibility-
4582 of calling std::terminate() in that case, it should not be used-
4583 outside Q_DECL_NOTHROW functions.-
4584-
4585 \sa Q_DECL_NOEXCEPT, Q_DECL_NOTHROW, qTerminate()-
4586*/-
4587-
4588/*!-
4589 \macro Q_DECL_NOEXCEPT-
4590 \relates <QtGlobal>-
4591 \since 5.0-
4592-
4593 This macro marks a function as never throwing. If the function-
4594 does nevertheless throw, the behaviour is defined:-
4595 std::terminate() is called.-
4596-
4597 The macro expands to C++11 noexcept, if available, or to nothing-
4598 otherwise.-
4599-
4600 If you need the operator version of C++11 noexcept, use-
4601 Q_DECL_NOEXCEPT_EXPR(x).-
4602-
4603 If you don't need C++11 noexcept semantics, e.g. because your-
4604 function can't possibly throw, don't use this macro, use-
4605 Q_DECL_NOTHROW instead.-
4606-
4607 \sa Q_DECL_NOTHROW, Q_DECL_NOEXCEPT_EXPR()-
4608*/-
4609-
4610/*!-
4611 \macro Q_DECL_NOEXCEPT_EXPR(x)-
4612 \relates <QtGlobal>-
4613 \since 5.0-
4614-
4615 This macro marks a function as non-throwing if \a x is \c true. If-
4616 the function does nevertheless throw, the behaviour is defined:-
4617 std::terminate() is called.-
4618-
4619 The macro expands to C++11 noexcept(x), if available, or to-
4620 nothing otherwise.-
4621-
4622 If you need the always-true version of C++11 noexcept, use-
4623 Q_DECL_NOEXCEPT.-
4624-
4625 If you don't need C++11 noexcept semantics, e.g. because your-
4626 function can't possibly throw, don't use this macro, use-
4627 Q_DECL_NOTHROW instead.-
4628-
4629 \sa Q_DECL_NOTHROW, Q_DECL_NOEXCEPT-
4630*/-
4631-
4632/*!-
4633 \macro Q_DECL_OVERRIDE-
4634 \since 5.0-
4635 \relates <QtGlobal>-
4636-
4637 This macro can be used to declare an overriding virtual-
4638 function. Use of this markup will allow the compiler to generate-
4639 an error if the overriding virtual function does not in fact-
4640 override anything.-
4641-
4642 It expands to "override" if your compiler supports that C++11-
4643 contextual keyword, or to nothing otherwise.-
4644-
4645 The macro goes at the end of the function, usually after the-
4646 \c{const}, if any:-
4647 \code-
4648 // generate error if this doesn't actually override anything:-
4649 virtual void MyWidget::paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;-
4650 \endcode-
4651-
4652 \sa Q_DECL_FINAL-
4653*/-
4654-
4655/*!-
4656 \macro Q_DECL_FINAL-
4657 \since 5.0-
4658 \relates <QtGlobal>-
4659-
4660 This macro can be used to declare an overriding virtual or a class-
4661 as "final", with Java semantics. Further-derived classes can then-
4662 no longer override this virtual function, or inherit from this-
4663 class, respectively.-
4664-
4665 It expands to "final" if your compiler supports that C++11-
4666 contextual keyword, or something non-standard if your compiler-
4667 supports something close enough to the C++11 semantics, or to-
4668 nothing otherwise.-
4669-
4670 The macro goes at the end of the function, usually after the-
4671 \c{const}, if any:-
4672 \code-
4673 // more-derived classes no longer permitted to override this:-
4674 virtual void MyWidget::paintEvent(QPaintEvent*) Q_DECL_FINAL;-
4675 \endcode-
4676-
4677 For classes, it goes in front of the \c{:} in the class-
4678 definition, if any:-
4679 \code-
4680 class QRect Q_DECL_FINAL { // cannot be derived from-
4681 // ...-
4682 };-
4683 \endcode-
4684-
4685 \sa Q_DECL_OVERRIDE-
4686*/-
4687-
4688/*!-
4689 \macro Q_FORWARD_DECLARE_OBJC_CLASS(classname)-
4690 \since 5.2-
4691 \relates <QtGlobal>-
4692-
4693 Forward-declares an Objective-C \a classname in a manner such that it can be-
4694 compiled as either Objective-C or C++.-
4695-
4696 This is primarily intended for use in header files that may be included by-
4697 both Objective-C and C++ source files.-
4698*/-
4699-
4700/*!-
4701 \macro Q_FORWARD_DECLARE_CF_TYPE(type)-
4702 \since 5.2-
4703 \relates <QtGlobal>-
4704-
4705 Forward-declares a Core Foundation \a type. This includes the actual-
4706 type and the ref type. For example, Q_FORWARD_DECLARE_CF_TYPE(CFString)-
4707 declares __CFString and CFStringRef.-
4708*/-
4709-
4710/*!-
4711 \macro Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(type)-
4712 \since 5.2-
4713 \relates <QtGlobal>-
4714-
4715 Forward-declares a mutable Core Foundation \a type. This includes the actual-
4716 type and the ref type. For example, Q_FORWARD_DECLARE_MUTABLE_CF_TYPE(CFMutableString)-
4717 declares __CFMutableString and CFMutableStringRef.-
4718*/-
4719-
4720QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9