From 4017bc5adc658efe6d7e8f57ee5f6f6a08b9dd9d Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 26 Feb 2024 15:29:20 +0100 Subject: [PATCH] Introduce feature timezone_locale and begin implementing it The feature remains disabled for now since its implementation is incomplete. This facilitates introducing the various parts of it in reviewable chunks, prior to actually plumbing it into the code that'll end up using it and enabling it. Includes stubs of the files that shall contain its source code. Task-number: QTBUG-115158 Change-Id: Ie49251c0aaf5feaf1ff522e469479020e4c73065 Reviewed-by: Alexey Edelev --- src/corelib/CMakeLists.txt | 12 +++++++ src/corelib/configure.cmake | 6 ++++ src/corelib/time/qtimezonelocale.cpp | 29 +++++++++++++++++ src/corelib/time/qtimezonelocale_data_p.h | 39 +++++++++++++++++++++++ src/corelib/time/qtimezonelocale_p.h | 30 +++++++++++++++++ 5 files changed, 116 insertions(+) create mode 100644 src/corelib/time/qtimezonelocale.cpp create mode 100644 src/corelib/time/qtimezonelocale_data_p.h create mode 100644 src/corelib/time/qtimezonelocale_p.h diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index 83de88bd7ec..43576b4aa40 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -922,6 +922,18 @@ qt_internal_extend_target(Core time/qtimezoneprivate_win.cpp ) +qt_internal_extend_target(Core + CONDITION QT_FEATURE_timezone_locale + SOURCES + time/qtimezonelocale.cpp time/qtimezonelocale_p.h +) + +qt_internal_extend_target(Core + CONDITION QT_FEATURE_timezone_locale AND NOT QT_FEATURE_icu + SOURCES + time/qtimezonelocale_data_p.h +) + qt_internal_extend_target(Core CONDITION QT_FEATURE_datetimeparser SOURCES time/qdatetimeparser.cpp time/qdatetimeparser_p.h diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake index be628fcf048..58329d3b8f0 100644 --- a/src/corelib/configure.cmake +++ b/src/corelib/configure.cmake @@ -805,6 +805,12 @@ qt_feature("timezone" PUBLIC PURPOSE "Provides support for time-zone handling." CONDITION NOT WASM AND NOT VXWORKS ) +qt_feature("timezone_locale" PRIVATE + SECTION "Utilities" + LABEL "QTimeZone" + PURPOSE "Provides support for localized time-zone display names." + DISABLE ON # Implementation is currently incomplete, so leave turned off +) qt_feature("datetimeparser" PRIVATE SECTION "Utilities" LABEL "QDateTimeParser" diff --git a/src/corelib/time/qtimezonelocale.cpp b/src/corelib/time/qtimezonelocale.cpp new file mode 100644 index 00000000000..5757e55d285 --- /dev/null +++ b/src/corelib/time/qtimezonelocale.cpp @@ -0,0 +1,29 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include +#include + +#if !QT_CONFIG(icu) // Use data generated from CLDR: +# include +# include +#endif + +QT_BEGIN_NAMESPACE + +#if QT_CONFIG(icu) // Get data from ICU: +namespace QtTimeZoneLocale { + +} // QtTimeZoneLocale +#else // No ICU, use QTZ[LP}_data_p.h data for feature timezone_locale. +namespace { +using namespace QtTimeZoneLocale; // QTZL_data_p.h +using namespace QtTimeZoneCldr; // QTZP_data_p.h +// Accessors for the QTZL_data_p.h + +// Accessors for the QTZP_data_p.h + +} // nameless namespace +#endif // ICU + +QT_END_NAMESPACE diff --git a/src/corelib/time/qtimezonelocale_data_p.h b/src/corelib/time/qtimezonelocale_data_p.h new file mode 100644 index 00000000000..1cdbbaa952a --- /dev/null +++ b/src/corelib/time/qtimezonelocale_data_p.h @@ -0,0 +1,39 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: Unicode-3.0 + +#ifndef QTIMEZONELOCALE_DATA_P_H +#define QTIMEZONELOCALE_DATA_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of internal files. This header file may change from version to version +// without notice, or even be removed. +// +// We mean it. +// + +// Only qtimezonelocale.cpp should #include this (after other things it needs), +// and even that only when feature icu is disabled. +#include "qtimezonelocale_p.h" + +QT_REQUIRE_CONFIG(timezone_locale); +#if QT_CONFIG(icu) +# error "This file should only be needed (or seen) when ICU is not in use" +#endif + +QT_BEGIN_NAMESPACE + +namespace QtTimeZoneLocale { + +// GENERATED PART STARTS HERE + +// GENERATED PART ENDS HERE + +} // QtTimeZoneLocale + +QT_END_NAMESPACE + +#endif // QTIMEZONELOCALE_DATA_P_H diff --git a/src/corelib/time/qtimezonelocale_p.h b/src/corelib/time/qtimezonelocale_p.h new file mode 100644 index 00000000000..2b2c4451d80 --- /dev/null +++ b/src/corelib/time/qtimezonelocale_p.h @@ -0,0 +1,30 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QTIMEZONELOCALE_P_H +#define QTIMEZONELOCALE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of internal files. This header file may change from version to version +// without notice, or even be removed. +// +// We mean it. +// + +#include + +QT_REQUIRE_CONFIG(timezone_locale); + +namespace QtTimeZoneLocale { +#if QT_CONFIG(icu) +#else +// Define data types for QTZL_data_p.h + +#endif +} + +#endif // QTIMEZONELOCALE_P_H