refs #624 Replace typedef with using.

This commit is contained in:
Mathew Sutcliffe
2016-03-20 21:52:49 +00:00
parent a8fc899219
commit 6f1cf8e3d7
22 changed files with 47 additions and 47 deletions

View File

@@ -42,7 +42,7 @@ namespace BlackCore
public: public:
//! List of callsigns and their last activity //! List of callsigns and their last activity
typedef QHash<BlackMisc::Aviation::CCallsign, qint64> CCallsignTimestampSet; using CCallsignTimestampSet = QHash<BlackMisc::Aviation::CCallsign, qint64>;
//! Constructor //! Constructor
CAirspaceAnalyzer(BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider, CAirspaceAnalyzer(BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,

View File

@@ -34,7 +34,7 @@ namespace BlackMisc
{ {
public: public:
//! Type of values stored in the set. //! Type of values stored in the set.
typedef T value_type; using value_type = T;
//! Insert a new value into the set. //! Insert a new value into the set.
typename QMap<T, T>::iterator insert(const T &value) { return QMap<T, T>::insert(value, value); } 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; } 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; PimplPtr m_pimpl;
CCollection(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl() CCollection(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()

View File

@@ -93,7 +93,7 @@ namespace BlackMisc
public: public:
//! The implementation container //! The implementation container
typedef Impl<Key,Value> impl_type; using impl_type = Impl<Key,Value>;
//! STL compatibility //! STL compatibility
//! @{ //! @{

View File

@@ -27,17 +27,17 @@ namespace BlackMisc
struct index_sequence struct index_sequence
{ {
static const size_t size = sizeof...(Is); 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> template <size_t I, size_t C, size_t... Is>
struct GenSequence 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> template <size_t C, size_t... Is>
struct GenSequence<C, C, Is...> struct GenSequence<C, C, Is...>
{ {
typedef index_sequence<Is...> type; using type = index_sequence<Is...>;
}; };
template <size_t C> template <size_t C>
using make_index_sequence = typename GenSequence<0, C>::type; using make_index_sequence = typename GenSequence<0, C>::type;

View File

@@ -54,7 +54,7 @@ namespace BlackMisc
// http://en.wikibooks.org/wiki/More_C++_Idioms/Member_Detector // http://en.wikibooks.org/wiki/More_C++_Idioms/Member_Detector
struct Empty {}; struct Empty {};
struct Fallback { int propertyByIndex; }; 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> 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); template <typename U> static void test(typename int_t<&Derived<U>::propertyByIndex>::type);
@@ -62,7 +62,7 @@ namespace BlackMisc
public: public:
//! Type of T::base_type, or void if not declared. //! 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));
}; };
/*! /*!

View File

@@ -426,7 +426,7 @@ namespace BlackMisc
I m_impl; I m_impl;
}; };
typedef QScopedPointer<PimplBase> PimplPtr; using PimplPtr = QScopedPointer<PimplBase>;
PimplPtr m_pimpl; PimplPtr m_pimpl;
explicit ConstForwardIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl() explicit ConstForwardIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()
@@ -633,7 +633,7 @@ namespace BlackMisc
I m_impl; I m_impl;
}; };
typedef QScopedPointer<PimplBase> PimplPtr; using PimplPtr = QScopedPointer<PimplBase>;
PimplPtr m_pimpl; PimplPtr m_pimpl;
explicit ConstBidirectionalIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl() explicit ConstBidirectionalIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()
@@ -854,7 +854,7 @@ namespace BlackMisc
I m_impl; I m_impl;
}; };
typedef QScopedPointer<PimplBase> PimplPtr; using PimplPtr = QScopedPointer<PimplBase>;
PimplPtr m_pimpl; PimplPtr m_pimpl;
explicit BidirectionalIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl() explicit BidirectionalIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()

View File

@@ -228,7 +228,7 @@ namespace BlackMisc
MU m_unit; //!< unit part MU m_unit; //!< unit part
//! Which subclass of CMeasurementUnit is used? //! Which subclass of CMeasurementUnit is used?
typedef MU UnitClass; using UnitClass = MU;
//! Implementation of compare //! Implementation of compare
static int compareImpl(const PQ &, const PQ &); static int compareImpl(const PQ &, const PQ &);

View File

@@ -55,7 +55,7 @@ namespace BlackMisc
struct FeetToMeters { static double factor() { return 0.3048; } }; struct FeetToMeters { static double factor() { return 0.3048; } };
struct MilesToMeters { static double factor() { return 1609.344; } }; struct MilesToMeters { static double factor() { return 1609.344; } };
struct StatuteMilesToMeters { static double factor() { return 1609.3472; } }; struct StatuteMilesToMeters { static double factor() { return 1609.3472; } };
typedef One MetersToMeters; using MetersToMeters = One;
public: public:
//! Base type //! Base type
@@ -170,7 +170,7 @@ namespace BlackMisc
{} {}
struct RadiansToDegrees { static double factor() { return 180.0 / M_PI; } }; struct RadiansToDegrees { static double factor() { return 180.0 / M_PI; } };
typedef One DegreesToDegrees; using DegreesToDegrees = One;
public: public:
//! Base type //! Base type
@@ -268,7 +268,7 @@ namespace BlackMisc
CMeasurementUnit(name, symbol, nullptr) CMeasurementUnit(name, symbol, nullptr)
{} {}
typedef One HertzToHertz; using HertzToHertz = One;
public: public:
//! Base type //! Base type
@@ -358,7 +358,7 @@ namespace BlackMisc
CMeasurementUnit(name, symbol, nullptr) CMeasurementUnit(name, symbol, nullptr)
{} {}
typedef Milli<One> GramsToKilograms; using GramsToKilograms = Milli<One>;
struct PoundsToKilograms { static double factor() { return 0.45359237; } }; struct PoundsToKilograms { static double factor() { return 0.45359237; } };
public: public:
@@ -457,7 +457,7 @@ namespace BlackMisc
CMeasurementUnit(name, symbol, nullptr) CMeasurementUnit(name, symbol, nullptr)
{} {}
typedef Centi<One> PascalsToHectopascals; using PascalsToHectopascals = Centi<One>;
struct PsiToHectopascals { static double factor() { return 68.948; } }; struct PsiToHectopascals { static double factor() { return 68.948; } };
struct InchesToHectopascals { static double factor() { return 33.86389; } }; struct InchesToHectopascals { static double factor() { return 33.86389; } };
struct MillimetersToHectopascals { static double factor() { return 860.142806; } }; struct MillimetersToHectopascals { static double factor() { return 860.142806; } };
@@ -773,7 +773,7 @@ namespace BlackMisc
CMeasurementUnit(name, symbol, nullptr) CMeasurementUnit(name, symbol, nullptr)
{} {}
typedef One SecondsToSeconds; using SecondsToSeconds = One;
struct DaysToSeconds { static double factor() { return 60.0 * 60.0 * 24.0; } }; struct DaysToSeconds { static double factor() { return 60.0 * 60.0 * 24.0; } };
struct HoursToSeconds { static double factor() { return 60.0 * 60.0; } }; struct HoursToSeconds { static double factor() { return 60.0 * 60.0; } };
struct MinutesToSeconds { static double factor() { return 60.0; } }; struct MinutesToSeconds { static double factor() { return 60.0; } };

View File

@@ -704,7 +704,7 @@ namespace BlackMisc
C m_impl; C m_impl;
}; };
typedef QScopedPointer<PimplBase> PimplPtr; using PimplPtr = QScopedPointer<PimplBase>;
PimplPtr m_pimpl; PimplPtr m_pimpl;
explicit CSequence(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl() explicit CSequence(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()

View File

@@ -25,7 +25,7 @@
#endif #endif
#include <Windows.h> #include <Windows.h>
#else #else
typedef unsigned long DWORD; //!< Fake Windows DWORD using DWORD = unsigned long; //!< Fake Windows DWORD
#endif #endif
namespace BlackMisc namespace BlackMisc

View File

@@ -36,10 +36,10 @@ namespace BlackMisc
static const int MaxPartsPerCallsign = 3; //!< How many parts per callsign static const int MaxPartsPerCallsign = 3; //!< How many parts per callsign
//! Situations 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 //! Parts per callsign
typedef QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftPartsList> CPartsPerCallsign; using CPartsPerCallsign = QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftPartsList>;
//! All remote aircraft //! All remote aircraft
//! \threadsafe //! \threadsafe

View File

@@ -43,7 +43,7 @@ namespace BlackMisc
* \ingroup Tuples * \ingroup Tuples
*/ */
#define BLACK_ENABLE_TUPLE_CONVERSION(T) \ #define BLACK_ENABLE_TUPLE_CONVERSION(T) \
public: typedef std::true_type EnabledTupleConversion; \ public: using EnabledTupleConversion = std::true_type; \
private: friend class BlackMisc::TupleConverter<T>; private: friend class BlackMisc::TupleConverter<T>;
/*! /*!

View File

@@ -53,7 +53,7 @@ namespace BlackMisc
template <class T> template <class T>
struct HasEnabledTupleConversion struct HasEnabledTupleConversion
{ {
typedef decltype(hasEnabledTupleConversionHelper(static_cast<T *>(nullptr))) type; using type = decltype(hasEnabledTupleConversionHelper(static_cast<T *>(nullptr)));
static const bool value = type::value; static const bool value = type::value;
}; };
@@ -80,23 +80,23 @@ namespace BlackMisc
struct GenSequenceOnPredicate<P, I, C, true, I2, Is...> struct GenSequenceOnPredicate<P, I, C, true, I2, Is...>
{ {
static const bool test = P::template test<I>::value; 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> template <class P, size_t I, size_t C, size_t I2, size_t... Is>
struct GenSequenceOnPredicate<P, I, C, false, I2, Is...> struct GenSequenceOnPredicate<P, I, C, false, I2, Is...>
{ {
static const bool test = P::template test<I>::value; 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> template <class P, size_t C, size_t I2, size_t... Is>
struct GenSequenceOnPredicate<P, C, C, true, I2, 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> template <class P, size_t C, size_t I2, size_t... Is>
struct GenSequenceOnPredicate<P, C, C, false, I2, Is...> struct GenSequenceOnPredicate<P, C, C, false, I2, Is...>
{ {
typedef index_sequence<Is...> type; using type = index_sequence<Is...>;
}; };
template <class P> template <class P>
using make_index_sequence_if = typename GenSequenceOnPredicate<P, 0, std::tuple_size<typename P::tuple_type>::value>::type; 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> template <qint64 F, class Tu>
struct FlagPresent struct FlagPresent
{ {
typedef Tu tuple_type; using tuple_type = Tu;
template <size_t I> template <size_t I>
struct test : std::integral_constant<bool, bool(std::tuple_element_t<I, Tu>::flags & F)> {}; struct test : std::integral_constant<bool, bool(std::tuple_element_t<I, Tu>::flags & F)> {};
}; };
template <qint64 F, class Tu> template <qint64 F, class Tu>
struct FlagMissing struct FlagMissing
{ {
typedef Tu tuple_type; using tuple_type = Tu;
template <size_t I> template <size_t I>
struct test : std::integral_constant<bool, ! bool(std::tuple_element_t<I, Tu>::flags & F)> {}; 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> template <class T, qint64 Flags = 0>
struct Attribute : public AttributeComparable<Attribute<T, Flags>, bool(Flags & DisabledForComparison), bool(Flags & CaseInsensitiveComparison)> struct Attribute : public AttributeComparable<Attribute<T, Flags>, bool(Flags & DisabledForComparison), bool(Flags & CaseInsensitiveComparison)>
{ {
typedef T type; using type = T;
static const qint64 flags = Flags; static const qint64 flags = Flags;
Attribute(T &obj, QString jsonName = {}) : m_obj(obj), m_jsonName(jsonName) {} Attribute(T &obj, QString jsonName = {}) : m_obj(obj), m_jsonName(jsonName) {}

View File

@@ -42,7 +42,7 @@ namespace BlackMisc
//! \private SFINAE for CValueObject constructor to avoid being selected as a viable copy constructor. //! \private SFINAE for CValueObject constructor to avoid being selected as a viable copy constructor.
template <typename...> struct DecayFirst template <typename...> struct DecayFirst
{ {
typedef void type; using type = void;
}; };
//! \private //! \private
template <typename T, typename... Ts> struct DecayFirst<T, Ts...> template <typename T, typename... Ts> struct DecayFirst<T, Ts...>

View File

@@ -122,7 +122,7 @@ namespace BlackMisc
//! \cond PRIVATE //! \cond PRIVATE
// http://en.wikibooks.org/wiki/More_C++_Idioms/Member_Detector // http://en.wikibooks.org/wiki/More_C++_Idioms/Member_Detector
struct Fallback { int toJson, convertFromJson, setPropertyByIndex, propertyByIndex, propertyByIndexAsString, equalsPropertyByIndex, toIcon; }; 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 {}; template <typename U> struct Derived : public U, public Fallback {};
# define DISABLE_IF_HAS(MEMBER) typename int_t<&Derived<U>::MEMBER>::type # define DISABLE_IF_HAS(MEMBER) typename int_t<&Derived<U>::MEMBER>::type
//! \endcond //! \endcond

View File

@@ -24,7 +24,7 @@ namespace BlackSimPlugin
struct CallbackWrapper struct CallbackWrapper
{ {
//! Typedef to a MemberFunction //! Typedef to a MemberFunction
typedef ReturnType (Object::*MemberFunction)(Argument1, Argument2); using MemberFunction = ReturnType (Object::*)(Argument1, Argument2);
//! Constructor //! Constructor
CallbackWrapper(Object *obj, MemberFunction memberFunction) : CallbackWrapper(Object *obj, MemberFunction memberFunction) :

View File

@@ -87,7 +87,7 @@ namespace BlackSimPlugin
QMutex m_mutexHostList; //!< Host list mutex 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 TCallbackWrapper m_callbackWrapper; //!< Callback wrapper
}; };
} }

View File

@@ -61,7 +61,7 @@ namespace BlackSimPlugin
DPNHANDLE m_applicationHandle = 0; 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_callbackWrapper; //!< Callback wrapper
TCallbackWrapper m_lobbyCallbackWrapper; //!< Callback wrapper TCallbackWrapper m_lobbyCallbackWrapper; //!< Callback wrapper

View File

@@ -89,10 +89,10 @@ namespace XBus
DataRef() : DataRefImpl(DataRefTraits::name()) {} DataRef() : DataRefImpl(DataRefTraits::name()) {}
//! Traits type //! Traits type
typedef DataRefTraits TraitsType; using TraitsType = DataRefTraits;
//! Dataref type //! Dataref type
typedef typename DataRefTraits::type DataRefType; using DataRefType = typename DataRefTraits::type;
//! Set the value of the dataref (if it is writable) //! Set the value of the dataref (if it is writable)
void set(DataRefType d) { DataRefImpl::implSet(d); } void set(DataRefType d) { DataRefImpl::implSet(d); }
@@ -114,10 +114,10 @@ namespace XBus
ArrayDataRef() : ArrayDataRefImpl(DataRefTraits::name(), DataRefTraits::size) {} ArrayDataRef() : ArrayDataRefImpl(DataRefTraits::name(), DataRefTraits::size) {}
//! Traits type //! Traits type
typedef DataRefTraits TraitsType; using TraitsType = DataRefTraits;
//! Dataref type //! Dataref type
typedef typename DataRefTraits::type DataRefType; using DataRefType = typename DataRefTraits::type;
//! Set the value of the whole array (if it is writable) //! Set the value of the whole array (if it is writable)
void setAll(std::vector<DataRefType> const& a) { ArrayDataRefImpl::implSetAll(a); } void setAll(std::vector<DataRefType> const& a) { ArrayDataRefImpl::implSetAll(a); }

View File

@@ -31,7 +31,7 @@ class QTimer;
//! \endcond //! \endcond
//! Typedef needed to use QList<double> as a DBus argument //! 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 //! Typedef needed to use QList<double> as a DBus argument
Q_DECLARE_METATYPE(QDoubleList) Q_DECLARE_METATYPE(QDoubleList)

View File

@@ -172,7 +172,7 @@ namespace BlackCoreTest
// Helper traits class. Given T is a pointer-to-member-of-U, ClassOf<T>::type is U. // Helper traits class. Given T is a pointer-to-member-of-U, ClassOf<T>::type is U.
template <class T> struct ClassOf; 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*. // 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()); } template <class T> typename ClassOf<T>::type *subject() const { return qobject_cast<typename ClassOf<T>::type *>(m_subject.data()); }

View File

@@ -96,16 +96,16 @@ Q_DECLARE_METATYPE(BlackMisc::CNotHashable)
// https://bugreports.qt-project.org/browse/QTBUG-11485 // https://bugreports.qt-project.org/browse/QTBUG-11485
//! Test value object dictionary using ordered container //! 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 //! 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 //! 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 //! 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(CValueObjectDictionary)
Q_DECLARE_METATYPE(CNotHashableDictionary) Q_DECLARE_METATYPE(CNotHashableDictionary)