mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 17:30:12 +08:00
refs #624 Replace typedef with using.
This commit is contained in:
@@ -42,7 +42,7 @@ namespace BlackCore
|
||||
|
||||
public:
|
||||
//! List of callsigns and their last activity
|
||||
typedef QHash<BlackMisc::Aviation::CCallsign, qint64> CCallsignTimestampSet;
|
||||
using CCallsignTimestampSet = QHash<BlackMisc::Aviation::CCallsign, qint64>;
|
||||
|
||||
//! Constructor
|
||||
CAirspaceAnalyzer(BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! Type of values stored in the set.
|
||||
typedef T value_type;
|
||||
using value_type = T;
|
||||
|
||||
//! Insert a new value into the set.
|
||||
typename QMap<T, T>::iterator insert(const T &value) { return QMap<T, T>::insert(value, value); }
|
||||
@@ -447,7 +447,7 @@ namespace BlackMisc
|
||||
template <class I> static I insertHelper(std::pair<I, bool> p) { return p.first; }
|
||||
};
|
||||
|
||||
typedef QScopedPointer<PimplBase> PimplPtr;
|
||||
using PimplPtr = QScopedPointer<PimplBase>;
|
||||
PimplPtr m_pimpl;
|
||||
|
||||
CCollection(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace BlackMisc
|
||||
|
||||
public:
|
||||
//! The implementation container
|
||||
typedef Impl<Key,Value> impl_type;
|
||||
using impl_type = Impl<Key,Value>;
|
||||
|
||||
//! STL compatibility
|
||||
//! @{
|
||||
|
||||
@@ -27,17 +27,17 @@ namespace BlackMisc
|
||||
struct index_sequence
|
||||
{
|
||||
static const size_t size = sizeof...(Is);
|
||||
typedef std::tuple<std::integral_constant<size_t, Is>...> tuple_type;
|
||||
using tuple_type = std::tuple<std::integral_constant<size_t, Is>...>;
|
||||
};
|
||||
template <size_t I, size_t C, size_t... Is>
|
||||
struct GenSequence
|
||||
{
|
||||
typedef typename GenSequence<I + 1, C, Is..., I>::type type;
|
||||
using type = typename GenSequence<I + 1, C, Is..., I>::type;
|
||||
};
|
||||
template <size_t C, size_t... Is>
|
||||
struct GenSequence<C, C, Is...>
|
||||
{
|
||||
typedef index_sequence<Is...> type;
|
||||
using type = index_sequence<Is...>;
|
||||
};
|
||||
template <size_t C>
|
||||
using make_index_sequence = typename GenSequence<0, C>::type;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace BlackMisc
|
||||
// http://en.wikibooks.org/wiki/More_C++_Idioms/Member_Detector
|
||||
struct Empty {};
|
||||
struct Fallback { int propertyByIndex; };
|
||||
template <int Fallback:: *> struct int_t { typedef int type; };
|
||||
template <int Fallback:: *> struct int_t { using type = int; };
|
||||
template <typename U> struct Derived : public Fallback, public std::conditional_t<std::is_void<U>::value, Empty, U> {};
|
||||
|
||||
template <typename U> static void test(typename int_t<&Derived<U>::propertyByIndex>::type);
|
||||
@@ -62,7 +62,7 @@ namespace BlackMisc
|
||||
|
||||
public:
|
||||
//! Type of T::base_type, or void if not declared.
|
||||
typedef decltype(test<typename BaseOf<T>::type>(0)) type;
|
||||
using type = decltype(test<typename BaseOf<T>::type>(0));
|
||||
};
|
||||
|
||||
/*!
|
||||
|
||||
@@ -426,7 +426,7 @@ namespace BlackMisc
|
||||
I m_impl;
|
||||
};
|
||||
|
||||
typedef QScopedPointer<PimplBase> PimplPtr;
|
||||
using PimplPtr = QScopedPointer<PimplBase>;
|
||||
PimplPtr m_pimpl;
|
||||
|
||||
explicit ConstForwardIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()
|
||||
@@ -633,7 +633,7 @@ namespace BlackMisc
|
||||
I m_impl;
|
||||
};
|
||||
|
||||
typedef QScopedPointer<PimplBase> PimplPtr;
|
||||
using PimplPtr = QScopedPointer<PimplBase>;
|
||||
PimplPtr m_pimpl;
|
||||
|
||||
explicit ConstBidirectionalIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()
|
||||
@@ -854,7 +854,7 @@ namespace BlackMisc
|
||||
I m_impl;
|
||||
};
|
||||
|
||||
typedef QScopedPointer<PimplBase> PimplPtr;
|
||||
using PimplPtr = QScopedPointer<PimplBase>;
|
||||
PimplPtr m_pimpl;
|
||||
|
||||
explicit BidirectionalIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace BlackMisc
|
||||
MU m_unit; //!< unit part
|
||||
|
||||
//! Which subclass of CMeasurementUnit is used?
|
||||
typedef MU UnitClass;
|
||||
using UnitClass = MU;
|
||||
|
||||
//! Implementation of compare
|
||||
static int compareImpl(const PQ &, const PQ &);
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace BlackMisc
|
||||
struct FeetToMeters { static double factor() { return 0.3048; } };
|
||||
struct MilesToMeters { static double factor() { return 1609.344; } };
|
||||
struct StatuteMilesToMeters { static double factor() { return 1609.3472; } };
|
||||
typedef One MetersToMeters;
|
||||
using MetersToMeters = One;
|
||||
|
||||
public:
|
||||
//! Base type
|
||||
@@ -170,7 +170,7 @@ namespace BlackMisc
|
||||
{}
|
||||
|
||||
struct RadiansToDegrees { static double factor() { return 180.0 / M_PI; } };
|
||||
typedef One DegreesToDegrees;
|
||||
using DegreesToDegrees = One;
|
||||
|
||||
public:
|
||||
//! Base type
|
||||
@@ -268,7 +268,7 @@ namespace BlackMisc
|
||||
CMeasurementUnit(name, symbol, nullptr)
|
||||
{}
|
||||
|
||||
typedef One HertzToHertz;
|
||||
using HertzToHertz = One;
|
||||
|
||||
public:
|
||||
//! Base type
|
||||
@@ -358,7 +358,7 @@ namespace BlackMisc
|
||||
CMeasurementUnit(name, symbol, nullptr)
|
||||
{}
|
||||
|
||||
typedef Milli<One> GramsToKilograms;
|
||||
using GramsToKilograms = Milli<One>;
|
||||
struct PoundsToKilograms { static double factor() { return 0.45359237; } };
|
||||
|
||||
public:
|
||||
@@ -457,7 +457,7 @@ namespace BlackMisc
|
||||
CMeasurementUnit(name, symbol, nullptr)
|
||||
{}
|
||||
|
||||
typedef Centi<One> PascalsToHectopascals;
|
||||
using PascalsToHectopascals = Centi<One>;
|
||||
struct PsiToHectopascals { static double factor() { return 68.948; } };
|
||||
struct InchesToHectopascals { static double factor() { return 33.86389; } };
|
||||
struct MillimetersToHectopascals { static double factor() { return 860.142806; } };
|
||||
@@ -773,7 +773,7 @@ namespace BlackMisc
|
||||
CMeasurementUnit(name, symbol, nullptr)
|
||||
{}
|
||||
|
||||
typedef One SecondsToSeconds;
|
||||
using SecondsToSeconds = One;
|
||||
struct DaysToSeconds { static double factor() { return 60.0 * 60.0 * 24.0; } };
|
||||
struct HoursToSeconds { static double factor() { return 60.0 * 60.0; } };
|
||||
struct MinutesToSeconds { static double factor() { return 60.0; } };
|
||||
|
||||
@@ -704,7 +704,7 @@ namespace BlackMisc
|
||||
C m_impl;
|
||||
};
|
||||
|
||||
typedef QScopedPointer<PimplBase> PimplPtr;
|
||||
using PimplPtr = QScopedPointer<PimplBase>;
|
||||
PimplPtr m_pimpl;
|
||||
|
||||
explicit CSequence(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
#else
|
||||
typedef unsigned long DWORD; //!< Fake Windows DWORD
|
||||
using DWORD = unsigned long; //!< Fake Windows DWORD
|
||||
#endif
|
||||
|
||||
namespace BlackMisc
|
||||
|
||||
@@ -36,10 +36,10 @@ namespace BlackMisc
|
||||
static const int MaxPartsPerCallsign = 3; //!< How many parts per callsign
|
||||
|
||||
//! Situations per callsign
|
||||
typedef QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftSituationList> CSituationsPerCallsign;
|
||||
using CSituationsPerCallsign = QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftSituationList>;
|
||||
|
||||
//! Parts per callsign
|
||||
typedef QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftPartsList> CPartsPerCallsign;
|
||||
using CPartsPerCallsign = QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftPartsList>;
|
||||
|
||||
//! All remote aircraft
|
||||
//! \threadsafe
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BlackMisc
|
||||
* \ingroup Tuples
|
||||
*/
|
||||
#define BLACK_ENABLE_TUPLE_CONVERSION(T) \
|
||||
public: typedef std::true_type EnabledTupleConversion; \
|
||||
public: using EnabledTupleConversion = std::true_type; \
|
||||
private: friend class BlackMisc::TupleConverter<T>;
|
||||
|
||||
/*!
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace BlackMisc
|
||||
template <class T>
|
||||
struct HasEnabledTupleConversion
|
||||
{
|
||||
typedef decltype(hasEnabledTupleConversionHelper(static_cast<T *>(nullptr))) type;
|
||||
using type = decltype(hasEnabledTupleConversionHelper(static_cast<T *>(nullptr)));
|
||||
static const bool value = type::value;
|
||||
};
|
||||
|
||||
@@ -80,23 +80,23 @@ namespace BlackMisc
|
||||
struct GenSequenceOnPredicate<P, I, C, true, I2, Is...>
|
||||
{
|
||||
static const bool test = P::template test<I>::value;
|
||||
typedef typename GenSequenceOnPredicate<P, I + 1, C, test, I, Is..., I2>::type type;
|
||||
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;
|
||||
typedef typename GenSequenceOnPredicate<P, I + 1, C, test, I, Is...>::type type;
|
||||
using type = typename GenSequenceOnPredicate<P, I + 1, C, test, I, Is...>::type;
|
||||
};
|
||||
template <class P, size_t C, size_t I2, size_t... Is>
|
||||
struct GenSequenceOnPredicate<P, C, C, true, I2, Is...>
|
||||
{
|
||||
typedef index_sequence<Is..., I2> type;
|
||||
using type = index_sequence<Is..., I2>;
|
||||
};
|
||||
template <class P, size_t C, size_t I2, size_t... Is>
|
||||
struct GenSequenceOnPredicate<P, C, C, false, I2, Is...>
|
||||
{
|
||||
typedef index_sequence<Is...> type;
|
||||
using type = index_sequence<Is...>;
|
||||
};
|
||||
template <class P>
|
||||
using make_index_sequence_if = typename GenSequenceOnPredicate<P, 0, std::tuple_size<typename P::tuple_type>::value>::type;
|
||||
@@ -105,14 +105,14 @@ namespace BlackMisc
|
||||
template <qint64 F, class Tu>
|
||||
struct FlagPresent
|
||||
{
|
||||
typedef Tu tuple_type;
|
||||
using tuple_type = Tu;
|
||||
template <size_t I>
|
||||
struct test : std::integral_constant<bool, bool(std::tuple_element_t<I, Tu>::flags & F)> {};
|
||||
};
|
||||
template <qint64 F, class Tu>
|
||||
struct FlagMissing
|
||||
{
|
||||
typedef Tu tuple_type;
|
||||
using tuple_type = Tu;
|
||||
template <size_t I>
|
||||
struct test : std::integral_constant<bool, ! bool(std::tuple_element_t<I, Tu>::flags & F)> {};
|
||||
};
|
||||
@@ -171,7 +171,7 @@ namespace BlackMisc
|
||||
template <class T, qint64 Flags = 0>
|
||||
struct Attribute : public AttributeComparable<Attribute<T, Flags>, bool(Flags & DisabledForComparison), bool(Flags & CaseInsensitiveComparison)>
|
||||
{
|
||||
typedef T type;
|
||||
using type = T;
|
||||
static const qint64 flags = Flags;
|
||||
|
||||
Attribute(T &obj, QString jsonName = {}) : m_obj(obj), m_jsonName(jsonName) {}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackMisc
|
||||
//! \private SFINAE for CValueObject constructor to avoid being selected as a viable copy constructor.
|
||||
template <typename...> struct DecayFirst
|
||||
{
|
||||
typedef void type;
|
||||
using type = void;
|
||||
};
|
||||
//! \private
|
||||
template <typename T, typename... Ts> struct DecayFirst<T, Ts...>
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace BlackMisc
|
||||
//! \cond PRIVATE
|
||||
// http://en.wikibooks.org/wiki/More_C++_Idioms/Member_Detector
|
||||
struct Fallback { int toJson, convertFromJson, setPropertyByIndex, propertyByIndex, propertyByIndexAsString, equalsPropertyByIndex, toIcon; };
|
||||
template <int Fallback::*> struct int_t { typedef int type; };
|
||||
template <int Fallback::*> struct int_t { using type = int; };
|
||||
template <typename U> struct Derived : public U, public Fallback {};
|
||||
# define DISABLE_IF_HAS(MEMBER) typename int_t<&Derived<U>::MEMBER>::type
|
||||
//! \endcond
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace BlackSimPlugin
|
||||
struct CallbackWrapper
|
||||
{
|
||||
//! Typedef to a MemberFunction
|
||||
typedef ReturnType (Object::*MemberFunction)(Argument1, Argument2);
|
||||
using MemberFunction = ReturnType (Object::*)(Argument1, Argument2);
|
||||
|
||||
//! Constructor
|
||||
CallbackWrapper(Object *obj, MemberFunction memberFunction) :
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace BlackSimPlugin
|
||||
|
||||
QMutex m_mutexHostList; //!< Host list mutex
|
||||
|
||||
typedef CallbackWrapper<CDirectPlayPeer, HRESULT, DWORD, void *> TCallbackWrapper; //!< DirectPlay peer message handler wrapper
|
||||
using TCallbackWrapper = CallbackWrapper<CDirectPlayPeer, HRESULT, DWORD, void *>; //!< DirectPlay peer message handler wrapper
|
||||
TCallbackWrapper m_callbackWrapper; //!< Callback wrapper
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace BlackSimPlugin
|
||||
|
||||
DPNHANDLE m_applicationHandle = 0;
|
||||
|
||||
typedef CallbackWrapper<CLobbyClient, HRESULT, DWORD, void *> TCallbackWrapper; //!< DirectPlay message handler wrapper
|
||||
using TCallbackWrapper = CallbackWrapper<CLobbyClient, HRESULT, DWORD, void *>; //!< DirectPlay message handler wrapper
|
||||
TCallbackWrapper m_callbackWrapper; //!< Callback wrapper
|
||||
TCallbackWrapper m_lobbyCallbackWrapper; //!< Callback wrapper
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ namespace XBus
|
||||
DataRef() : DataRefImpl(DataRefTraits::name()) {}
|
||||
|
||||
//! Traits type
|
||||
typedef DataRefTraits TraitsType;
|
||||
using TraitsType = DataRefTraits;
|
||||
|
||||
//! Dataref type
|
||||
typedef typename DataRefTraits::type DataRefType;
|
||||
using DataRefType = typename DataRefTraits::type;
|
||||
|
||||
//! Set the value of the dataref (if it is writable)
|
||||
void set(DataRefType d) { DataRefImpl::implSet(d); }
|
||||
@@ -114,10 +114,10 @@ namespace XBus
|
||||
ArrayDataRef() : ArrayDataRefImpl(DataRefTraits::name(), DataRefTraits::size) {}
|
||||
|
||||
//! Traits type
|
||||
typedef DataRefTraits TraitsType;
|
||||
using TraitsType = DataRefTraits;
|
||||
|
||||
//! Dataref type
|
||||
typedef typename DataRefTraits::type DataRefType;
|
||||
using DataRefType = typename DataRefTraits::type;
|
||||
|
||||
//! Set the value of the whole array (if it is writable)
|
||||
void setAll(std::vector<DataRefType> const& a) { ArrayDataRefImpl::implSetAll(a); }
|
||||
|
||||
@@ -31,7 +31,7 @@ class QTimer;
|
||||
//! \endcond
|
||||
|
||||
//! Typedef needed to use QList<double> as a DBus argument
|
||||
typedef QList<double> QDoubleList;
|
||||
using QDoubleList = QList<double>;
|
||||
|
||||
//! Typedef needed to use QList<double> as a DBus argument
|
||||
Q_DECLARE_METATYPE(QDoubleList)
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace BlackCoreTest
|
||||
|
||||
// Helper traits class. Given T is a pointer-to-member-of-U, ClassOf<T>::type is U.
|
||||
template <class T> struct ClassOf;
|
||||
template <class U, class R> struct ClassOf<R U::*> { typedef U type; };
|
||||
template <class U, class R> struct ClassOf<R U::*> { using type = U; };
|
||||
|
||||
// Given T is a pointer-to-member-of-U, subject<T>() returns Expect's subject casted to U*.
|
||||
template <class T> typename ClassOf<T>::type *subject() const { return qobject_cast<typename ClassOf<T>::type *>(m_subject.data()); }
|
||||
|
||||
@@ -96,16 +96,16 @@ Q_DECLARE_METATYPE(BlackMisc::CNotHashable)
|
||||
// https://bugreports.qt-project.org/browse/QTBUG-11485
|
||||
|
||||
//! Test value object dictionary using ordered container
|
||||
typedef BlackMisc::CDictionary<BlackMisc::CTestValueObject, BlackMisc::CTestValueObject> CValueObjectDictionary;
|
||||
using CValueObjectDictionary = BlackMisc::CDictionary<BlackMisc::CTestValueObject, BlackMisc::CTestValueObject>;
|
||||
|
||||
//! Test value object dictionary using unordered container
|
||||
typedef BlackMisc::CDictionary<BlackMisc::CTestValueObject, BlackMisc::CTestValueObject, QHash> CValueObjectHashDictionary;
|
||||
using CValueObjectHashDictionary = BlackMisc::CDictionary<BlackMisc::CTestValueObject, BlackMisc::CTestValueObject, QHash>;
|
||||
|
||||
//! Test value object dictionary using ordered container with not hashable key
|
||||
typedef BlackMisc::CDictionary<BlackMisc::CNotHashable, QString> CNotHashableDictionary;
|
||||
using CNotHashableDictionary = BlackMisc::CDictionary<BlackMisc::CNotHashable, QString>;
|
||||
|
||||
//! Test value object dictionary using unordered container with not hashable key
|
||||
typedef BlackMisc::CDictionary<BlackMisc::CNotHashable, QString, QMap> CNotHashableMapDictionary;
|
||||
using CNotHashableMapDictionary = BlackMisc::CDictionary<BlackMisc::CNotHashable, QString, QMap>;
|
||||
Q_DECLARE_METATYPE(CValueObjectDictionary)
|
||||
Q_DECLARE_METATYPE(CNotHashableDictionary)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user