mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
refs #624 Some more occurrences of constexpr.
This commit is contained in:
@@ -39,7 +39,7 @@ namespace BlackGui
|
||||
|
||||
public:
|
||||
//! Number of models which can be published at once
|
||||
static const int MaxModelPublished = 1000;
|
||||
static constexpr int MaxModelPublished = 1000;
|
||||
|
||||
//! Constructor
|
||||
explicit CDbStashComponent(QWidget *parent = nullptr);
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace BlackGui
|
||||
|
||||
int CGuiUtility::metaTypeIdFromSwiftDragAndDropData(const QMimeData *mime)
|
||||
{
|
||||
static const int Unknown = static_cast<int>(QMetaType::UnknownType);
|
||||
constexpr int Unknown = static_cast<int>(QMetaType::UnknownType);
|
||||
|
||||
if (!hasSwiftVariantMimeType(mime)) { return Unknown; }
|
||||
QJsonDocument jsonDoc(QJsonDocument::fromJson(mime->data(swiftJsonDragAndDropMimeType())));
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BlackGui
|
||||
|
||||
public:
|
||||
//! Number of elements when to use asynchronous updates
|
||||
static const int asyncThreshold = 50;
|
||||
static constexpr int asyncThreshold = 50;
|
||||
|
||||
//! Destructor
|
||||
virtual ~CListModelBaseNonTemplate() {}
|
||||
|
||||
@@ -96,10 +96,10 @@ namespace BlackGui
|
||||
Q_DECLARE_FLAGS(Menu, MenuFlag)
|
||||
|
||||
//! When (row count) to use asynchronous updates
|
||||
static const int ASyncRowsCountThreshold = 50;
|
||||
static constexpr int ASyncRowsCountThreshold = 50;
|
||||
|
||||
//! When to use pre-sizing with random elements
|
||||
static const int ResizeSubsetThreshold = 50;
|
||||
static constexpr int ResizeSubsetThreshold = 50;
|
||||
|
||||
//! Clear data
|
||||
virtual void clear() = 0;
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace BlackSimPlugin
|
||||
//! Inject weather grid to simulator
|
||||
void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid);
|
||||
|
||||
static const int SkipUpdateCyclesForCockpit = 10; //!< skip x cycles before updating cockpit again
|
||||
static constexpr int SkipUpdateCyclesForCockpit = 10; //!< skip x cycles before updating cockpit again
|
||||
bool m_simConnected = false; //!< Is simulator connected?
|
||||
bool m_simSimulating = false; //!< Simulator running?
|
||||
bool m_useSbOffsets = true; //!< with SB offsets
|
||||
|
||||
Reference in New Issue
Block a user