6 #ifndef SWIFT_MISC_TYPETRAITS_H
7 #define SWIFT_MISC_TYPETRAITS_H
17 class CPropertyIndexRef;
22 template <
typename T,
bool = std::is_
class_v<T>>
23 struct SyntheticDerived :
public T
27 struct SyntheticDerived<T, false>
49 (
sizeof(T) <= 16 && std::is_trivially_copy_constructible_v<T> && std::is_trivially_destructible_v<T>) ?
50 ParameterPassBy::Value :
51 ParameterPassBy::ConstRef;
57 template <
typename T,
typename = std::
void_t<>>
62 struct THasToQString<T, std::void_t<decltype(std::declval<T>().toQString())>> :
public std::true_type
69 template <
typename T,
typename = std::
void_t<>>
74 struct THasPushBack<T, std::void_t<decltype(std::declval<T>().push_back(std::declval<typename T::value_type>()))>> :
82 template <
typename T,
typename = std::
void_t<>>
87 struct THasGetLogCategories<T, std::void_t<decltype(T::getLogCategories())>> :
public std::true_type
94 template <
typename T,
typename = std::
void_t<>>
99 struct TModelsQHashKey<T, std::void_t<decltype(std::declval<T>() == std::declval<T>(), qHash(std::declval<T>()))>> :
100 public std::true_type
107 template <
typename T,
typename = std::
void_t<>>
111 template <
typename T>
112 struct TModelsQMapKey<T, std::void_t<decltype(std::declval<T>() < std::declval<T>())>> :
public std::true_type
119 template <
typename T,
typename U,
typename = std::
void_t<>>
123 template <
typename T,
typename U>
124 struct THasCompare<T, U, std::void_t<decltype(compare(std::declval<T>(), std::declval<U>()))>> :
125 public std::true_type
133 template <
typename T,
typename = std::
void_t<>>
137 template <
typename T>
139 std::declval<CPropertyIndexRef>(), std::declval<const T &>()))>> :
140 public std::true_type
148 template <
typename T,
typename = std::
void_t<>>
152 template <
typename T>
154 T, std::void_t<decltype(std::declval<T>().propertyByIndex(std::declval<CPropertyIndexRef>()))>> :
155 public std::true_type
162 template <
typename T,
typename U,
typename = std::
void_t<>>
166 template <
typename T,
typename U>
168 public std::true_type
175 template <
typename T,
typename = std::
void_t<>>
179 template <
typename T>
181 T, std::void_t<decltype(std::declval<const T &>().marshallToDbus(std::declval<QDBusArgument &>()),
182 std::declval<T &>().unmarshallFromDbus(std::declval<const QDBusArgument &>()))>> :
183 public std::true_type
190 template <
typename T,
typename = std::
void_t<>>
194 template <
typename T>
195 struct TIsQPrivateSignal<T, std::void_t<typename private_ns::SyntheticDerived<T>::QPrivateSignal>> :
196 public std::is_same<T, typename private_ns::SyntheticDerived<T>::QPrivateSignal>
Free functions in swift::misc.
ParameterPassBy
Whether an input parameter type should be passed by value or by const reference.
Trait which is true if the expression compare(a, b) is valid when a and b are instances of T and U.
Trait which is true if the expression a.compareByPropertyIndex(b, i) is valid when a and b are instan...
Trait to detect whether a class T has a static member function named getLogCategories.
Trait which is true if T has methods marshallToDbus and unmarshallFromDbus.
Trait which is true if the expression a.propertyByIndex(i) is valid with a is an instance of T and i ...
Trait which is true if the expression a.push_back(v) is valid when a and v are instances of T and T::...
Trait to detect whether T contains a member function toQString.
Trait which is true if the expression a == b is valid when a and b are instances of T and U.
Trait that detects if a type is QPrivateSignal.
Trait to detect whether a class T can be used as a key in a QHash.
Trait to detect whether a class T can be used as a key in a QMap.
Trait to detect properties of function parameter types.
static constexpr ParameterPassBy passBy
Whether the input parameter type T should be passed by value or by const reference.