From 50f2a6ad4a15f3b8e41a7a00626044b1a30428c5 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 3 Sep 2023 14:26:07 +0200 Subject: [PATCH] libcalamares: deal with QPair Use std::pair instead. Also applies to Qt5 build. --- src/libcalamares/geoip/Interface.h | 15 +++++++++------ src/libcalamares/modulesystem/InstanceKey.h | 11 +++++++---- src/libcalamares/utils/CommandList.h | 10 ++++++---- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/libcalamares/geoip/Interface.h b/src/libcalamares/geoip/Interface.h index 2edf62155..dc9ef982f 100644 --- a/src/libcalamares/geoip/Interface.h +++ b/src/libcalamares/geoip/Interface.h @@ -12,16 +12,19 @@ #include "DllMacro.h" -#include #include #include +#include + class QByteArray; namespace CalamaresUtils { namespace GeoIP { +using RegionZonePairBase = std::pair< QString, QString >; + /** @brief A Region, Zone pair of strings * * A GeoIP lookup returns a timezone, which is represented as a Region, @@ -29,22 +32,22 @@ namespace GeoIP * pasting the strings back together with a "/" is the right thing to * do. The Zone **may** contain a "/" (e.g. "Kentucky/Monticello"). */ -class DLLEXPORT RegionZonePair : public QPair< QString, QString > +class DLLEXPORT RegionZonePair : public RegionZonePairBase { public: /** @brief Construct from an existing pair. */ - explicit RegionZonePair( const QPair& p ) - : QPair( p ) + explicit RegionZonePair( const RegionZonePairBase& p ) + : RegionZonePairBase( p ) { } /** @brief Construct from two strings, like qMakePair(). */ RegionZonePair( const QString& region, const QString& zone ) - : QPair( region, zone ) + : RegionZonePairBase( region, zone ) { } /** @brief An invalid zone pair (empty strings). */ RegionZonePair() - : QPair( QString(), QString() ) + : RegionZonePairBase( QString(), QString() ) { } diff --git a/src/libcalamares/modulesystem/InstanceKey.h b/src/libcalamares/modulesystem/InstanceKey.h index e85aa18a4..7848b026c 100644 --- a/src/libcalamares/modulesystem/InstanceKey.h +++ b/src/libcalamares/modulesystem/InstanceKey.h @@ -13,9 +13,10 @@ #include #include -#include #include +#include + namespace Calamares { namespace ModuleSystem @@ -34,12 +35,14 @@ namespace ModuleSystem * This is supported by the *instances* configuration entry * in `settings.conf`. */ -class InstanceKey : public QPair< QString, QString > +class InstanceKey : public std::pair< QString, QString > { public: + using Base = std::pair< QString, QString >; + /// @brief Create an instance key from explicit module and id. InstanceKey( const QString& module, const QString& id ) - : QPair( module, id ) + : Base( module, id ) { if ( second.isEmpty() ) { @@ -50,7 +53,7 @@ public: /// @brief Create unusual, invalid instance key InstanceKey() - : QPair( QString(), QString() ) + : Base( QString(), QString() ) { } diff --git a/src/libcalamares/utils/CommandList.h b/src/libcalamares/utils/CommandList.h index 586b04ed3..af23a1f2f 100644 --- a/src/libcalamares/utils/CommandList.h +++ b/src/libcalamares/utils/CommandList.h @@ -17,33 +17,35 @@ #include #include +#include class KMacroExpanderBase; namespace CalamaresUtils { +using CommandLineBase = std::pair< QString, std::chrono::seconds >; /** * Each command can have an associated timeout in seconds. The timeout * defaults to 10 seconds. Provide some convenience naming and construction. */ -struct CommandLine : public QPair< QString, std::chrono::seconds > +struct CommandLine : public CommandLineBase { static inline constexpr std::chrono::seconds TimeoutNotSet() { return std::chrono::seconds( -1 ); } /// An invalid command line CommandLine() - : QPair( QString(), TimeoutNotSet() ) + : CommandLineBase( QString(), TimeoutNotSet() ) { } CommandLine( const QString& s ) - : QPair( s, TimeoutNotSet() ) + : CommandLineBase( s, TimeoutNotSet() ) { } CommandLine( const QString& s, std::chrono::seconds t ) - : QPair( s, t ) + : CommandLineBase( s, t ) { }