mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
refs #624 Some more occurrences of constexpr.
This commit is contained in:
@@ -47,7 +47,7 @@ namespace BlackMisc
|
||||
void CSettingsAudio::initNotificationFlags()
|
||||
{
|
||||
// if we add flags in the future, we automatically extend ...
|
||||
static const int l = 1 + static_cast<int>(CNotificationSounds::Notification::NotificationsLoadSounds);
|
||||
constexpr int l = 1 + static_cast<int>(CNotificationSounds::Notification::NotificationsLoadSounds);
|
||||
if (this->m_notificationFlags.length() < l)
|
||||
{
|
||||
int cl = m_notificationFlags.length();
|
||||
|
||||
@@ -37,8 +37,8 @@ namespace BlackMisc
|
||||
DVFR //!< Defense VFR
|
||||
};
|
||||
|
||||
static const int MaxRemarksLength = 150; //!< Max remarks length
|
||||
static const int MaxRouteLength = 150; //!< Max route length
|
||||
static constexpr int MaxRemarksLength = 150; //!< Max remarks length
|
||||
static constexpr int MaxRouteLength = 150; //!< Max route length
|
||||
|
||||
//! Default constructor
|
||||
CFlightPlan() = default;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace BlackMisc
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CJoystickButton)
|
||||
int m_buttonIndex = m_invalidIndex;
|
||||
|
||||
static const int m_invalidIndex = -1;
|
||||
static constexpr int m_invalidIndex = -1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace BlackMisc
|
||||
class BLACKMISC_EXPORT IRemoteAircraftProvider
|
||||
{
|
||||
public:
|
||||
static const int MaxSituationsPerCallsign = 6; //!< How many situations per callsign
|
||||
static const int MaxPartsPerCallsign = 3; //!< How many parts per callsign
|
||||
static constexpr int MaxSituationsPerCallsign = 6; //!< How many situations per callsign
|
||||
static constexpr int MaxPartsPerCallsign = 3; //!< How many parts per callsign
|
||||
|
||||
//! Situations per callsign
|
||||
using CSituationsPerCallsign = QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftSituationList>;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace BlackMisc
|
||||
struct HasEnabledTupleConversion
|
||||
{
|
||||
using type = decltype(hasEnabledTupleConversionHelper(static_cast<T *>(nullptr)));
|
||||
static const bool value = type::value;
|
||||
static constexpr bool value = type::value;
|
||||
};
|
||||
|
||||
// Using tag dispatch to select which implementation of compare() to use
|
||||
@@ -79,13 +79,13 @@ namespace BlackMisc
|
||||
template <class P, size_t I, size_t C, size_t I2, size_t... Is>
|
||||
struct GenSequenceOnPredicate<P, I, C, true, I2, Is...>
|
||||
{
|
||||
static const bool test = P::template test<I>::value;
|
||||
static constexpr bool test = P::template test<I>::value;
|
||||
using type = typename GenSequenceOnPredicate<P, I + 1, C, test, I, Is..., I2>::type;
|
||||
};
|
||||
template <class P, size_t I, size_t C, size_t I2, size_t... Is>
|
||||
struct GenSequenceOnPredicate<P, I, C, false, I2, Is...>
|
||||
{
|
||||
static const bool test = P::template test<I>::value;
|
||||
static constexpr bool test = P::template test<I>::value;
|
||||
using type = typename GenSequenceOnPredicate<P, I + 1, C, test, I, Is...>::type;
|
||||
};
|
||||
template <class P, size_t C, size_t I2, size_t... Is>
|
||||
@@ -172,7 +172,7 @@ namespace BlackMisc
|
||||
struct Attribute : public AttributeComparable<Attribute<T, Flags>, bool(Flags & DisabledForComparison), bool(Flags & CaseInsensitiveComparison)>
|
||||
{
|
||||
using type = T;
|
||||
static const qint64 flags = Flags;
|
||||
static constexpr qint64 flags = Flags;
|
||||
|
||||
Attribute(T &obj, QString jsonName = {}) : m_obj(obj), m_jsonName(jsonName) {}
|
||||
void extend(QString jsonName) { if (m_jsonName.isEmpty()) m_jsonName = jsonName; }
|
||||
|
||||
Reference in New Issue
Block a user