diff --git a/src/blackmisc/compare.h b/src/blackmisc/compare.h index 1e1fee68e..af0b820df 100644 --- a/src/blackmisc/compare.h +++ b/src/blackmisc/compare.h @@ -56,7 +56,7 @@ namespace BlackMisc static bool equals(const Derived &a, const Derived &b) { auto meta = introspect().without(MetaFlags()); - bool result = baseEquals(static_cast *>(&a), static_cast *>(&b)); + bool result = baseEquals(static_cast *>(&a), static_cast *>(&b)); meta.forEachMemberPair(a, b, [ & ](auto &&... args) { result = result && EqualsByMetaClass::membersEqual(std::forward(args)...); }); return result; } @@ -120,8 +120,8 @@ namespace BlackMisc static bool less(const Derived &a, const Derived &b) { auto meta = introspect().without(MetaFlags()); - bool result = baseLess(static_cast *>(&a), static_cast *>(&b)); - bool gt = baseLess(static_cast *>(&b), static_cast *>(&a)); + bool result = baseLess(static_cast *>(&a), static_cast *>(&b)); + bool gt = baseLess(static_cast *>(&b), static_cast *>(&a)); meta.forEachMemberPair(a, b, [ & ](auto &&... args) { result = result || LessThanByMetaClass::membersLess(gt, std::forward(args)...); }); return result; } @@ -157,7 +157,7 @@ namespace BlackMisc static int compareImpl(const Derived &a, const Derived &b) { auto meta = introspect().without(MetaFlags()); - int result = baseCompare(static_cast *>(&a), static_cast *>(&b)); + int result = baseCompare(static_cast *>(&a), static_cast *>(&b)); meta.forEachMemberPair(a, b, [ & ](auto &&... args) { result = result ? result : CompareByMetaClass::membersCompare(std::forward(args)...); }); return result; } @@ -169,7 +169,7 @@ namespace BlackMisc static int membersCompare(const T &a, const T &b, Flags) { using CaseInsensitive = std::integral_constant(Flags::value & CaseInsensitiveComparison)>; - return membersCompare(a, b, CaseInsensitive(), HasCompare()); + return membersCompare(a, b, CaseInsensitive(), THasCompare()); } template static int membersCompare(const T &a, const T &b, std::true_type, U) { return a.compare(b, Qt::CaseInsensitive); } diff --git a/src/blackmisc/dbus.h b/src/blackmisc/dbus.h index 4d4c953af..a67476113 100644 --- a/src/blackmisc/dbus.h +++ b/src/blackmisc/dbus.h @@ -63,7 +63,7 @@ namespace BlackMisc //! Marshall without begin/endStructure, for when composed within another object void marshallToDbus(QDBusArgument &arg) const { - baseMarshall(static_cast *>(derived()), arg); + baseMarshall(static_cast *>(derived()), arg); auto meta = introspect().without(MetaFlags()); meta.forEachMember(*derived(), [ & ](const auto &member) { arg << member; }); } @@ -71,7 +71,7 @@ namespace BlackMisc //! Unmarshall without begin/endStructure, for when composed within another object void unmarshallFromDbus(const QDBusArgument &arg) { - baseUnmarshall(static_cast *>(derived()), arg); + baseUnmarshall(static_cast *>(derived()), arg); auto meta = introspect().without(MetaFlags()); meta.forEachMember(*derived(), [ & ](auto &member) { arg >> member; }); } diff --git a/src/blackmisc/dictionary.h b/src/blackmisc/dictionary.h index d1473c9cb..deb9130f6 100644 --- a/src/blackmisc/dictionary.h +++ b/src/blackmisc/dictionary.h @@ -53,19 +53,19 @@ namespace BlackMisc { //! \cond PRIVATE template - struct AssociativityTraits + struct TAssociativityTraits { template using DefaultType = QHash; }; template <> - struct AssociativityTraits + struct TAssociativityTraits { template using DefaultType = QMap; }; template <> - struct AssociativityTraits + struct TAssociativityTraits { template struct DefaultType { static_assert(std::is_void::value, "Key does not support either QHash or QMap"); }; @@ -87,12 +87,12 @@ namespace BlackMisc * Trait to select the appropriate default associative container type depending on what the key type supports. */ template - using DefaultAssociativeType = typename Private::AssociativityTraits::value, ModelsQMapKey::value>::template DefaultType; + using TDefaultAssociativeType = typename Private::TAssociativityTraits::value, TModelsQMapKey::value>::template DefaultType; /*! * Associative container with value semantics, chooses a sensible default implementation container type. */ - template class Impl = DefaultAssociativeType> + template class Impl = TDefaultAssociativeType> class CDictionary : public Mixin::DBusOperators>, public Mixin::JsonOperators>, @@ -485,7 +485,7 @@ namespace BlackMisc private: static uint hashImpl(const Derived &value) { - uint hash = baseHash(static_cast *>(&value)); + uint hash = baseHash(static_cast *>(&value)); auto meta = introspect().without(MetaFlags()); meta.forEachMember(value, Private::Hasher { hash }); return hash; diff --git a/src/blackmisc/inheritancetraits.h b/src/blackmisc/inheritancetraits.h index e8eff4867..56682f28e 100644 --- a/src/blackmisc/inheritancetraits.h +++ b/src/blackmisc/inheritancetraits.h @@ -24,13 +24,13 @@ namespace BlackMisc * If T has a member typedef base_type, this trait will obtain it, otherwise void. */ template > - struct BaseOf + struct TBaseOf { using type = void; //!< void }; //! \cond template - struct BaseOf> + struct TBaseOf> { using type = typename T::base_type; //!< T::base_type }; @@ -40,45 +40,45 @@ namespace BlackMisc * It T has a member typedef base_type which is a registered metatype, this trait will obtain it, otherwise void. */ template - struct MetaBaseOf + struct TMetaBaseOf { //! Type of T::base_type, or void if not declared. - using type = std::conditional_t::type>::Defined, typename BaseOf::type, void>; + using type = std::conditional_t::type>::Defined, typename TBaseOf::type, void>; }; /*! * If T has a member typedef base_type which has a member propertyByIndex, this trait will obtain it, otherwise void. */ template > - struct IndexBaseOf + struct TIndexBaseOf { using type = void; //!< void }; //! \cond template - struct IndexBaseOf().propertyByIndex(std::declval()))>> + struct TIndexBaseOf().propertyByIndex(std::declval()))>> { using type = typename T::base_type; //!< T::base_type }; //! \endcond /*! - * Alias for typename BaseOf::type. + * Alias for typename TBaseOf::type. */ template - using BaseOfT = typename BaseOf::type; + using TBaseOfT = typename TBaseOf::type; /*! - * Alias for typename MetaBaseOf::type. + * Alias for typename TMetaBaseOf::type. */ template - using MetaBaseOfT = typename MetaBaseOf::type; + using TMetaBaseOfT = typename TMetaBaseOf::type; /*! - * Alias for typename IndexBaseOf::type. + * Alias for typename TIndexBaseOf::type. */ template - using IndexBaseOfT = typename IndexBaseOf::type; + using TIndexBaseOfT = typename TIndexBaseOf::type; } #endif diff --git a/src/blackmisc/iterator.h b/src/blackmisc/iterator.h index 7ee8b2d6f..aa7a46fac 100644 --- a/src/blackmisc/iterator.h +++ b/src/blackmisc/iterator.h @@ -91,7 +91,7 @@ namespace BlackMisc */ template auto makeInsertIterator(T &container) { - return Private::makeInsertIterator(container, HasPushBack()); + return Private::makeInsertIterator(container, THasPushBack()); } /*! diff --git a/src/blackmisc/json.h b/src/blackmisc/json.h index ad4df9348..34557e46e 100644 --- a/src/blackmisc/json.h +++ b/src/blackmisc/json.h @@ -288,7 +288,7 @@ namespace BlackMisc { json << std::pair &>(name, member); // std::make_pair causes an ambiguous operator<< }); - return Json::appendJsonObject(json, baseToJson(static_cast *>(derived()))); + return Json::appendJsonObject(json, baseToJson(static_cast *>(derived()))); } //! Convenience function JSON as string @@ -301,7 +301,7 @@ namespace BlackMisc //! Assign from JSON object void convertFromJson(const QJsonObject &json) { - baseConvertFromJson(static_cast *>(derived()), json); + baseConvertFromJson(static_cast *>(derived()), json); auto meta = introspect().without(MetaFlags()); meta.forEachMemberName(*derived(), [ & ](auto & member, const QString & name) { diff --git a/src/blackmisc/logcategorylist.h b/src/blackmisc/logcategorylist.h index a80df7c2e..a67748f47 100644 --- a/src/blackmisc/logcategorylist.h +++ b/src/blackmisc/logcategorylist.h @@ -111,7 +111,7 @@ namespace BlackMisc static QThreadStorage list; if (! list.hasLocalData()) { - list.localData().appendCategoriesFromMemberFunction(tag(), HasGetLogCategories()); + list.localData().appendCategoriesFromMemberFunction(tag(), THasGetLogCategories()); list.localData().appendCategoriesFromMetaType(tag(), std::integral_constant::Defined>()); list.localData().appendCategoriesFromMetaObject(tag(), std::is_base_of()); if (list.localData().isEmpty()) { list.localData().push_back(CLogCategory::uncategorized()); } diff --git a/src/blackmisc/propertyindex.h b/src/blackmisc/propertyindex.h index 9117571aa..f3108f445 100644 --- a/src/blackmisc/propertyindex.h +++ b/src/blackmisc/propertyindex.h @@ -210,7 +210,7 @@ namespace BlackMisc return [index = *this](const auto &a, const auto &b) { using T = std::decay_t; - return Private::compareByProperty(a, b, index, HasCompareByPropertyIndex(), HasPropertyByIndex()); + return Private::compareByProperty(a, b, index, THasCompareByPropertyIndex(), THasPropertyByIndex()); }; } diff --git a/src/blackmisc/propertyindexvariantmap.h b/src/blackmisc/propertyindexvariantmap.h index da1f1e633..bc09b4543 100644 --- a/src/blackmisc/propertyindexvariantmap.h +++ b/src/blackmisc/propertyindexvariantmap.h @@ -243,7 +243,7 @@ namespace BlackMisc } else { - baseSetPropertyByIndex(static_cast *>(derived()), variant, index); + baseSetPropertyByIndex(static_cast *>(derived()), variant, index); } } template @@ -263,7 +263,7 @@ namespace BlackMisc case IndexString: return CVariant(derived()->toQString()); default: - return basePropertyByIndex(static_cast *>(derived()), index); + return basePropertyByIndex(static_cast *>(derived()), index); } } template diff --git a/src/blackmisc/range.h b/src/blackmisc/range.h index 589258d1e..4574e63ae 100644 --- a/src/blackmisc/range.h +++ b/src/blackmisc/range.h @@ -145,9 +145,9 @@ namespace BlackMisc protected: //! Efficiently compare addresses of two objects. Return false if types are not compatible. //! @{ - template ::value, int> = 0> + template ::value, int> = 0> static bool equalPointers(const T *a, const U *b) { return a == b; } - template ::value, int> = 0> + template ::value, int> = 0> static bool equalPointers(const T *, const U *) { return false; } //! @} diff --git a/src/blackmisc/statusmessage.h b/src/blackmisc/statusmessage.h index 67982c8f3..b11615d82 100644 --- a/src/blackmisc/statusmessage.h +++ b/src/blackmisc/statusmessage.h @@ -102,7 +102,7 @@ namespace BlackMisc Derived &operator <<(QChar v) { return arg(v); } Derived &operator <<(char v) { return arg(QChar(v)); } Derived &operator <<(double v) { return arg(QString::number(v)); } - template ::value>> + template ::value>> Derived &operator <<(const T &v) { return arg(v.toQString()); } //! @} diff --git a/src/blackmisc/typetraits.h b/src/blackmisc/typetraits.h index de670c903..e92e78982 100644 --- a/src/blackmisc/typetraits.h +++ b/src/blackmisc/typetraits.h @@ -42,16 +42,16 @@ namespace BlackMisc * Trait to detect whether T contains a member function toQString. */ template > - struct HasToQString : public std::false_type {}; + struct THasToQString : public std::false_type {}; //! \cond template - struct HasToQString().toQString())>> : public std::true_type {}; + struct THasToQString().toQString())>> : public std::true_type {}; //! \endcond #ifdef Q_CC_MSVC // work around what seems to be an expression SFINAE bug in MSVC namespace Private { - struct HasPushBackHelper + struct THasPushBackHelper { struct Base { int push_back; }; template struct Derived : public T, public Base {}; @@ -61,23 +61,23 @@ namespace BlackMisc }; } template - using HasPushBack = decltype(Private::HasPushBackHelper::test(nullptr)); + using THasPushBack = decltype(Private::THasPushBackHelper::test(nullptr)); #else /*! * Trait which is true if the expression a.push_back(v) is valid when a and v are instances of T and T::value_type. */ template > - struct HasPushBack : public std::false_type {}; + struct THasPushBack : public std::false_type {}; //! \cond template - struct HasPushBack().push_back(std::declval()))>> : public std::true_type {}; + struct THasPushBack().push_back(std::declval()))>> : public std::true_type {}; //! \endcond #endif #ifdef Q_CC_MSVC namespace Private { - struct HasGetLogCategoriesHelper + struct THasGetLogCategoriesHelper { struct Base { int getLogCategories; }; template struct Derived : public T, public Base {}; @@ -87,16 +87,16 @@ namespace BlackMisc }; } template - using HasGetLogCategories = decltype(Private::HasGetLogCategoriesHelper::test(nullptr)); + using THasGetLogCategories = decltype(Private::THasGetLogCategoriesHelper::test(nullptr)); #else /*! * Trait to detect whether a class T has a static member function named getLogCategories. */ template > - struct HasGetLogCategories : public std::false_type {}; + struct THasGetLogCategories : public std::false_type {}; //! \cond template - struct HasGetLogCategories> : public std::true_type {}; + struct THasGetLogCategories> : public std::true_type {}; //! \endcond #endif @@ -104,30 +104,30 @@ namespace BlackMisc * Trait to detect whether a class T can be used as a key in a QHash. */ template > - struct ModelsQHashKey : public std::false_type {}; + struct TModelsQHashKey : public std::false_type {}; //! \cond template - struct ModelsQHashKey() == std::declval(), qHash(std::declval()))>> : public std::true_type {}; + struct TModelsQHashKey() == std::declval(), qHash(std::declval()))>> : public std::true_type {}; //! \endcond /*! * Trait to detect whether a class T can be used as a key in a QMap. */ template > - struct ModelsQMapKey : public std::false_type {}; + struct TModelsQMapKey : public std::false_type {}; //! \cond template - struct ModelsQMapKey() < std::declval())>> : public std::true_type {}; + struct TModelsQMapKey() < std::declval())>> : public std::true_type {}; //! \endcond /*! * Trait which is true if the expression compare(a, b) is valid when a and b are instances of T and U. */ template > - struct HasCompare : public std::false_type {}; + struct THasCompare : public std::false_type {}; //! \cond template - struct HasCompare(), std::declval()))>> : public std::true_type {}; + struct THasCompare(), std::declval()))>> : public std::true_type {}; //! \endcond /*! @@ -135,10 +135,10 @@ namespace BlackMisc * and i is an instance of CPropertyIndex. */ template > - struct HasCompareByPropertyIndex : public std::false_type {}; + struct THasCompareByPropertyIndex : public std::false_type {}; //! \cond template - struct HasCompareByPropertyIndex().compareByPropertyIndex(std::declval(), std::declval()))>> : public std::true_type {}; + struct THasCompareByPropertyIndex().compareByPropertyIndex(std::declval(), std::declval()))>> : public std::true_type {}; //! \endcond /*! @@ -146,20 +146,20 @@ namespace BlackMisc * instance of CPropertyIndex. */ template > - struct HasPropertyByIndex : public std::false_type {}; + struct THasPropertyByIndex : public std::false_type {}; //! \cond template - struct HasPropertyByIndex().propertyByIndex(std::declval()))>> : public std::true_type {}; + struct THasPropertyByIndex().propertyByIndex(std::declval()))>> : public std::true_type {}; //! \endcond /*! * Trait which is true if the expression a == b is valid when a and b are instances of T and U. */ template > - struct IsEqualityComparable : public std::false_type {}; + struct TIsEqualityComparable : public std::false_type {}; //! \cond template - struct IsEqualityComparable() == std::declval())>> : public std::true_type {}; + struct TIsEqualityComparable() == std::declval())>> : public std::true_type {}; //! \endcond } diff --git a/src/blackmisc/valuecache.h b/src/blackmisc/valuecache.h index 07419d831..4fe782342 100644 --- a/src/blackmisc/valuecache.h +++ b/src/blackmisc/valuecache.h @@ -334,7 +334,7 @@ namespace BlackMisc //! Type of pointer to non-const member function of U taking no arguments and returning void, //! for slot parameter of CCached constructor. template - using NotifySlot = Private::NonDeduced; + using NotifySlot = Private::TNonDeduced; //! Constructor. //! \param cache The CValueCache object which manages the value. diff --git a/src/blackmisc/valuecacheprivate.h b/src/blackmisc/valuecacheprivate.h index 5f24e8cc8..7ff676b16 100644 --- a/src/blackmisc/valuecacheprivate.h +++ b/src/blackmisc/valuecacheprivate.h @@ -31,7 +31,7 @@ namespace BlackMisc * \private Identity type trait. */ template - struct Identity + struct TIdentity { using type = T; }; @@ -40,7 +40,7 @@ namespace BlackMisc * \private Trick to force a non-deduced context during template argument type deduction. */ template - using NonDeduced = typename Identity::type; + using TNonDeduced = typename TIdentity::type; /*! * \private QObject subclass used by CCached class template for signal/slot communication with CValueCache. diff --git a/src/blackmisc/variant.h b/src/blackmisc/variant.h index d7d1cc445..637c3abec 100644 --- a/src/blackmisc/variant.h +++ b/src/blackmisc/variant.h @@ -73,7 +73,7 @@ namespace BlackMisc { if (metaTypeId == QMetaType::UnknownType) { return false; } if (metaTypeId == getMetaTypeId()) { return true; } - return baseIsA(static_cast *>(derived()), metaTypeId); + return baseIsA(static_cast *>(derived()), metaTypeId); } private: diff --git a/src/blackmisc/variantprivate.h b/src/blackmisc/variantprivate.h index 1b406fe86..4494be829 100644 --- a/src/blackmisc/variantprivate.h +++ b/src/blackmisc/variantprivate.h @@ -176,8 +176,8 @@ namespace BlackMisc } virtual const void *upCastTo(const void *object, int metaTypeId) const override { - const auto base = static_cast(static_cast *>(&cast(object))); - return metaTypeId == getMetaTypeId() ? object : CValueObjectMetaInfo> {} .upCastTo(base, metaTypeId); + const auto base = static_cast(static_cast *>(&cast(object))); + return metaTypeId == getMetaTypeId() ? object : CValueObjectMetaInfo> {} .upCastTo(base, metaTypeId); } virtual int compareImpl(const void *lhs, const void *rhs) const override {