From c8160ea1dbb5c20856c9c385053f8e5611a9f4d6 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 20 Feb 2012 09:41:09 +0100 Subject: Move QSysInfo out of qglobal.h and into a separate header qsysinfo.h is still included by qglobal.h, but it may be possible to remove the include from qglobal.h and instead include qsysinfo.h only where needed (e.g. qendian.h, qdatastream.h). Change-Id: Ifa2c72e0dae206d88eaa192e15a906297673c048 Reviewed-by: Thiago Macieira --- src/corelib/global/global.pri | 3 +- src/corelib/global/qglobal.h | 102 +--------------------------- src/corelib/global/qsysinfo.h | 154 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+), 102 deletions(-) create mode 100644 src/corelib/global/qsysinfo.h diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index ddba51950a..49128374e0 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -10,7 +10,8 @@ HEADERS += \ global/qnumeric_p.h \ global/qnumeric.h \ global/qlogging.h \ - global/qtypeinfo.h + global/qtypeinfo.h \ + global/qsysinfo.h SOURCES += \ global/qglobal.cpp \ diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index b7ff27018e..1fb5778f14 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -844,107 +844,6 @@ inline void qt_noop(void) {} # define QT_RETHROW throw #endif -/* - System information -*/ - -class QString; -class Q_CORE_EXPORT QSysInfo { -public: - enum Sizes { - WordSize = (sizeof(void *)<<3) - }; - -#if defined(QT_BUILD_QMAKE) - enum Endian { - BigEndian, - LittleEndian - }; - /* needed to bootstrap qmake */ - static const int ByteOrder; -#elif defined(Q_BYTE_ORDER) - enum Endian { - BigEndian, - LittleEndian - -# ifdef qdoc - , ByteOrder = -# elif Q_BYTE_ORDER == Q_BIG_ENDIAN - , ByteOrder = BigEndian -# elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN - , ByteOrder = LittleEndian -# else -# error "Undefined byte order" -# endif - }; -#else -# error "Qt not configured correctly, please run configure" -#endif -#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) - enum WinVersion { - WV_32s = 0x0001, - WV_95 = 0x0002, - WV_98 = 0x0003, - WV_Me = 0x0004, - WV_DOS_based= 0x000f, - - /* codenames */ - WV_NT = 0x0010, - WV_2000 = 0x0020, - WV_XP = 0x0030, - WV_2003 = 0x0040, - WV_VISTA = 0x0080, - WV_WINDOWS7 = 0x0090, - WV_NT_based = 0x00f0, - - /* version numbers */ - WV_4_0 = WV_NT, - WV_5_0 = WV_2000, - WV_5_1 = WV_XP, - WV_5_2 = WV_2003, - WV_6_0 = WV_VISTA, - WV_6_1 = WV_WINDOWS7, - - WV_CE = 0x0100, - WV_CENET = 0x0200, - WV_CE_5 = 0x0300, - WV_CE_6 = 0x0400, - WV_CE_based = 0x0f00 - }; - static const WinVersion WindowsVersion; - static WinVersion windowsVersion(); - -#endif -#ifdef Q_OS_MAC - enum MacVersion { - MV_Unknown = 0x0000, - - /* version */ - MV_9 = 0x0001, - MV_10_0 = 0x0002, - MV_10_1 = 0x0003, - MV_10_2 = 0x0004, - MV_10_3 = 0x0005, - MV_10_4 = 0x0006, - MV_10_5 = 0x0007, - MV_10_6 = 0x0008, - MV_10_7 = 0x0009, - - /* codenames */ - MV_CHEETAH = MV_10_0, - MV_PUMA = MV_10_1, - MV_JAGUAR = MV_10_2, - MV_PANTHER = MV_10_3, - MV_TIGER = MV_10_4, - MV_LEOPARD = MV_10_5, - MV_SNOWLEOPARD = MV_10_6, - MV_LION = MV_10_7 - }; - static const MacVersion MacintoshVersion; - static MacVersion macVersion(); -#endif -}; - Q_CORE_EXPORT const char *qVersion(); Q_CORE_EXPORT bool qSharedBuild(); @@ -1609,6 +1508,7 @@ QT_END_HEADER // qDebug and friends #include +#include #include #endif /* __cplusplus */ diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h new file mode 100644 index 0000000000..e6e207ec3d --- /dev/null +++ b/src/corelib/global/qsysinfo.h @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the FOO module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSYSINFO_H +#define QSYSINFO_H + +#include + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +/* + System information +*/ + +class QString; +class Q_CORE_EXPORT QSysInfo { +public: + enum Sizes { + WordSize = (sizeof(void *)<<3) + }; + +#if defined(QT_BUILD_QMAKE) + enum Endian { + BigEndian, + LittleEndian + }; + /* needed to bootstrap qmake */ + static const int ByteOrder; +#elif defined(Q_BYTE_ORDER) + enum Endian { + BigEndian, + LittleEndian + +# ifdef qdoc + , ByteOrder = +# elif Q_BYTE_ORDER == Q_BIG_ENDIAN + , ByteOrder = BigEndian +# elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN + , ByteOrder = LittleEndian +# else +# error "Undefined byte order" +# endif + }; +#else +# error "Qt not configured correctly, please run configure" +#endif +#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) + enum WinVersion { + WV_32s = 0x0001, + WV_95 = 0x0002, + WV_98 = 0x0003, + WV_Me = 0x0004, + WV_DOS_based= 0x000f, + + /* codenames */ + WV_NT = 0x0010, + WV_2000 = 0x0020, + WV_XP = 0x0030, + WV_2003 = 0x0040, + WV_VISTA = 0x0080, + WV_WINDOWS7 = 0x0090, + WV_NT_based = 0x00f0, + + /* version numbers */ + WV_4_0 = WV_NT, + WV_5_0 = WV_2000, + WV_5_1 = WV_XP, + WV_5_2 = WV_2003, + WV_6_0 = WV_VISTA, + WV_6_1 = WV_WINDOWS7, + + WV_CE = 0x0100, + WV_CENET = 0x0200, + WV_CE_5 = 0x0300, + WV_CE_6 = 0x0400, + WV_CE_based = 0x0f00 + }; + static const WinVersion WindowsVersion; + static WinVersion windowsVersion(); + +#endif +#ifdef Q_OS_MAC + enum MacVersion { + MV_Unknown = 0x0000, + + /* version */ + MV_9 = 0x0001, + MV_10_0 = 0x0002, + MV_10_1 = 0x0003, + MV_10_2 = 0x0004, + MV_10_3 = 0x0005, + MV_10_4 = 0x0006, + MV_10_5 = 0x0007, + MV_10_6 = 0x0008, + MV_10_7 = 0x0009, + + /* codenames */ + MV_CHEETAH = MV_10_0, + MV_PUMA = MV_10_1, + MV_JAGUAR = MV_10_2, + MV_PANTHER = MV_10_3, + MV_TIGER = MV_10_4, + MV_LEOPARD = MV_10_5, + MV_SNOWLEOPARD = MV_10_6, + MV_LION = MV_10_7 + }; + static const MacVersion MacintoshVersion; + static MacVersion macVersion(); +#endif +}; + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // QSYSINFO_H -- cgit v1.2.3