libcalamares: deal with QPair
Use std::pair instead. Also applies to Qt5 build.
This commit is contained in:
parent
dfb778984c
commit
50f2a6ad4a
@ -12,16 +12,19 @@
|
||||
|
||||
#include "DllMacro.h"
|
||||
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include <utility>
|
||||
|
||||
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() )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,10 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
|
||||
#include <utility>
|
||||
|
||||
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() )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -17,33 +17,35 @@
|
||||
#include <QVariant>
|
||||
|
||||
#include <chrono>
|
||||
#include <utility>
|
||||
|
||||
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 )
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user