QOperatingSystemVersion: clean up after QOSVBase extraction

When 3446313c7a5cd6005089866a7b20c9f28e132a0a extracted most functions
from QOperatingSystemVersion to a new unexported
QOperatingSystemVersionBase, for BC reasons, it kept the existing QOSV
methods as (inline or out-of-line) forwarders to the new QOSVBase
ones.

But the only ones that are actually still required are currentType(),
type(), and isAnyOfType(), because their Base equivalents use a
different enum type (we should probably make the OS Type an enum in
namespace Qt instead; other patch).

The others can just be REMOVED_SINCE, and should be, to make new code
use the base class implementations, where inlining and constexpr
properly work (they don't, on Windows, in exported classes).

Re-use the existing REMOVED_SINCE(6,3) block in removed_api.cpp to
move these functions there.

Amends 3446313c7a5cd6005089866a7b20c9f28e132a0a.

Reverts a tiny part of 215677818470e48e9090d7ae4411e1fea62207b8 (will
conflict in backports).

Pick-to: 6.6 6.5
Change-Id: I1d7ba784634ccd7c9ba5f7ceddb15b7787468d31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 1214edc0d94fd8b3c0d2660879d9175256c14bbc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-02-22 07:53:17 +01:00 committed by Qt Cherry-pick Bot
parent dfa4ebc150
commit 3de01e4e64
3 changed files with 18 additions and 11 deletions

View File

@ -139,6 +139,16 @@ QLocale::Language QLocale::codeToLanguage(QStringView languageCode) noexcept
#include "qoperatingsystemversion.h"
QOperatingSystemVersion QOperatingSystemVersion::current()
{
return QOperatingSystemVersionBase::current();
}
QString QOperatingSystemVersion::name() const
{
return QOperatingSystemVersionBase::name();
}
int QOperatingSystemVersion::compare(const QOperatingSystemVersion &v1,
const QOperatingSystemVersion &v2)
{

View File

@ -111,15 +111,11 @@ QT_BEGIN_NAMESPACE
*/
/*!
\fn QOperatingSystemVersion::current()
Returns a QOperatingSystemVersion indicating the current OS and its version number.
\sa currentType()
*/
QOperatingSystemVersion QOperatingSystemVersion::current()
{
return QOperatingSystemVersionBase::current();
}
QOperatingSystemVersionBase QOperatingSystemVersionBase::current()
{
static const QOperatingSystemVersionBase v = current_impl();
@ -306,11 +302,6 @@ int QOperatingSystemVersionBase::compare(QOperatingSystemVersionBase v1,
\sa type()
*/
QString QOperatingSystemVersion::name() const
{
return QOperatingSystemVersionBase::name();
}
QString QOperatingSystemVersionBase::name(QOperatingSystemVersionBase osversion)
{
switch (osversion.type()) {

View File

@ -236,13 +236,16 @@ public:
{
}
#if QT_CORE_REMOVED_SINCE(6, 3) || defined(Q_QDOC)
static QOperatingSystemVersion current();
#endif
static constexpr OSType currentType()
{
return OSType(QOperatingSystemVersionBase::currentType());
}
#if QT_CORE_REMOVED_SINCE(6, 3) || defined(Q_QDOC)
QVersionNumber version() const { return QOperatingSystemVersionBase::version(); }
constexpr int majorVersion() const { return QOperatingSystemVersionBase::majorVersion(); }
@ -251,10 +254,13 @@ public:
constexpr int segmentCount() const
{ return QOperatingSystemVersionBase::segmentCount(); }
#endif // QT_CORE_REMOVED_SINCE(6, 3)
constexpr OSType type() const { return OSType(QOperatingSystemVersionBase::type()); }
QT7_ONLY(Q_CORE_EXPORT) bool isAnyOfType(std::initializer_list<OSType> types) const;
QT7_ONLY(Q_CORE_EXPORT) QString name() const;
#if QT_CORE_REMOVED_SINCE(6, 3) || defined(Q_QDOC)
QString name() const;
#endif
private:
QOperatingSystemVersion() = default;