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