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 "DllMacro.h"
|
||||||
|
|
||||||
#include <QPair>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
class QByteArray;
|
class QByteArray;
|
||||||
|
|
||||||
namespace CalamaresUtils
|
namespace CalamaresUtils
|
||||||
{
|
{
|
||||||
namespace GeoIP
|
namespace GeoIP
|
||||||
{
|
{
|
||||||
|
using RegionZonePairBase = std::pair< QString, QString >;
|
||||||
|
|
||||||
/** @brief A Region, Zone pair of strings
|
/** @brief A Region, Zone pair of strings
|
||||||
*
|
*
|
||||||
* A GeoIP lookup returns a timezone, which is represented as a Region,
|
* 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
|
* pasting the strings back together with a "/" is the right thing to
|
||||||
* do. The Zone **may** contain a "/" (e.g. "Kentucky/Monticello").
|
* do. The Zone **may** contain a "/" (e.g. "Kentucky/Monticello").
|
||||||
*/
|
*/
|
||||||
class DLLEXPORT RegionZonePair : public QPair< QString, QString >
|
class DLLEXPORT RegionZonePair : public RegionZonePairBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** @brief Construct from an existing pair. */
|
/** @brief Construct from an existing pair. */
|
||||||
explicit RegionZonePair( const QPair& p )
|
explicit RegionZonePair( const RegionZonePairBase& p )
|
||||||
: QPair( p )
|
: RegionZonePairBase( p )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/** @brief Construct from two strings, like qMakePair(). */
|
/** @brief Construct from two strings, like qMakePair(). */
|
||||||
RegionZonePair( const QString& region, const QString& zone )
|
RegionZonePair( const QString& region, const QString& zone )
|
||||||
: QPair( region, zone )
|
: RegionZonePairBase( region, zone )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/** @brief An invalid zone pair (empty strings). */
|
/** @brief An invalid zone pair (empty strings). */
|
||||||
RegionZonePair()
|
RegionZonePair()
|
||||||
: QPair( QString(), QString() )
|
: RegionZonePairBase( QString(), QString() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPair>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
namespace ModuleSystem
|
namespace ModuleSystem
|
||||||
@ -34,12 +35,14 @@ namespace ModuleSystem
|
|||||||
* This is supported by the *instances* configuration entry
|
* This is supported by the *instances* configuration entry
|
||||||
* in `settings.conf`.
|
* in `settings.conf`.
|
||||||
*/
|
*/
|
||||||
class InstanceKey : public QPair< QString, QString >
|
class InstanceKey : public std::pair< QString, QString >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
using Base = std::pair< QString, QString >;
|
||||||
|
|
||||||
/// @brief Create an instance key from explicit module and id.
|
/// @brief Create an instance key from explicit module and id.
|
||||||
InstanceKey( const QString& module, const QString& id )
|
InstanceKey( const QString& module, const QString& id )
|
||||||
: QPair( module, id )
|
: Base( module, id )
|
||||||
{
|
{
|
||||||
if ( second.isEmpty() )
|
if ( second.isEmpty() )
|
||||||
{
|
{
|
||||||
@ -50,7 +53,7 @@ public:
|
|||||||
|
|
||||||
/// @brief Create unusual, invalid instance key
|
/// @brief Create unusual, invalid instance key
|
||||||
InstanceKey()
|
InstanceKey()
|
||||||
: QPair( QString(), QString() )
|
: Base( QString(), QString() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,33 +17,35 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
class KMacroExpanderBase;
|
class KMacroExpanderBase;
|
||||||
|
|
||||||
namespace CalamaresUtils
|
namespace CalamaresUtils
|
||||||
{
|
{
|
||||||
|
using CommandLineBase = std::pair< QString, std::chrono::seconds >;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each command can have an associated timeout in seconds. The timeout
|
* Each command can have an associated timeout in seconds. The timeout
|
||||||
* defaults to 10 seconds. Provide some convenience naming and construction.
|
* 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 ); }
|
static inline constexpr std::chrono::seconds TimeoutNotSet() { return std::chrono::seconds( -1 ); }
|
||||||
|
|
||||||
/// An invalid command line
|
/// An invalid command line
|
||||||
CommandLine()
|
CommandLine()
|
||||||
: QPair( QString(), TimeoutNotSet() )
|
: CommandLineBase( QString(), TimeoutNotSet() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandLine( const QString& s )
|
CommandLine( const QString& s )
|
||||||
: QPair( s, TimeoutNotSet() )
|
: CommandLineBase( s, TimeoutNotSet() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandLine( const QString& s, std::chrono::seconds t )
|
CommandLine( const QString& s, std::chrono::seconds t )
|
||||||
: QPair( s, t )
|
: CommandLineBase( s, t )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user