37 #include <cohtml/Config.h> 39 #if defined(COHERENT_COMPILER_SUPPORTS_IS_ENUM) 40 #include <type_traits> 51 typedef BoolConstant<true> TrueType;
52 typedef BoolConstant<false> FalseType;
54 #if defined(COHERENT_COMPILER_SUPPORTS_IS_ENUM) 56 struct IsExposedByRef : BoolConstant<std::is_enum<T>::value>
61 struct IsExposedByRef : FalseType
67 struct IsExposedByRef<T&> : TrueType
72 struct IsExposedByRef<bool> : TrueType
77 struct IsExposedByRef<signed int> : TrueType
82 struct IsExposedByRef<unsigned int> : TrueType
87 struct IsExposedByRef<signed long> : TrueType
92 struct IsExposedByRef<unsigned long> : TrueType
97 struct IsExposedByRef<signed long long> : TrueType
102 struct IsExposedByRef<unsigned long long> : TrueType
107 struct IsExposedByRef<signed char> : TrueType
112 struct IsExposedByRef<unsigned char> : TrueType
117 struct IsExposedByRef<float> : TrueType
122 struct IsExposedByRef<double> : TrueType
127 struct IsExposedByRef<char*> : TrueType
132 struct IsExposedByRef<wchar_t*> : TrueType
137 struct IsExposedByRef<const bool> : TrueType
142 struct IsExposedByRef<const signed int> : TrueType
147 struct IsExposedByRef<const unsigned int> : TrueType
152 struct IsExposedByRef<const signed long> : TrueType
157 struct IsExposedByRef<const unsigned long> : TrueType
162 struct IsExposedByRef<const signed long long> : TrueType
167 struct IsExposedByRef<const unsigned long long> : TrueType
172 struct IsExposedByRef<const signed char> : TrueType
177 struct IsExposedByRef<const unsigned char> : TrueType
182 struct IsExposedByRef<const float> : TrueType
187 struct IsExposedByRef<const double> : TrueType
192 struct IsExposedByRef<const char*> : TrueType
197 struct IsExposedByRef<const wchar_t*> : TrueType
201 template <
typename T>
202 struct ReturnsByRef : FalseType
206 template <
typename T,
typename C>
207 struct ReturnsByRef<T(C::*)> : TrueType
209 typedef T& ValuePassType;
212 template <
typename T,
typename C>
213 struct ReturnsByRef<T(C::*)()> : IsExposedByRef<T>
215 typedef T ValuePassType;
218 template <
typename T,
typename C>
219 struct ReturnsByRef<T(C::*)() const> : IsExposedByRef<T>
221 typedef T ValuePassType;
224 template <
typename T,
typename C>
225 struct ReturnsByRef<T& (C::*)()> : IsExposedByRef<T&>
227 typedef const T& ValuePassType;
230 template <
typename T,
typename C>
231 struct ReturnsByRef<T& (C::*)()
const> : IsExposedByRef<T&>
233 typedef const T& ValuePassType;
236 template <
typename T>
237 struct RemoveConstRef
242 template <
typename T>
243 struct RemoveConstRef<const T>
248 template <
typename T>
249 struct RemoveConstRef<T &>
254 template <
typename T>
255 struct RemoveConstRef<const T &>
260 template <
typename T>
261 struct PointerTrait : FalseType
263 typedef T StoredType;
265 static void* Deref(T& ptr)
271 template <
typename T>
272 struct UnwrapPointer : PointerTrait<T>
274 static void* Unwrap(T* ptr)
276 if (!ptr || !PointerTrait<T>::Value)
280 typedef typename RemoveConstRef<typename PointerTrait<T>::StoredType>::Type ClearedStoredType;
281 return UnwrapPointer<ClearedStoredType>::Unwrap((ClearedStoredType*)PointerTrait<T>::Deref(*ptr));
285 template <
typename T,
bool v>
286 struct UnwrapPointerType
291 template <
typename T>
292 struct UnwrapPointerType<T, true>
294 typedef typename PointerTrait<T>::StoredType StoredType;
295 typedef typename RemoveConstRef<StoredType>::Type ClearedStoredType;
296 typedef typename UnwrapPointerType<ClearedStoredType, PointerTrait<ClearedStoredType>::Value>::Type Type;
299 template <
typename T>
300 struct PointerTrait<T*> : TrueType
302 typedef T StoredType;
303 static void* Deref(T*& ptr)
309 template <
typename T>
310 struct PointerTrait<const T*> : TrueType
312 typedef T StoredType;
313 static void* Deref(
const T*& ptr)
315 return const_cast<T*&
>(ptr);
319 template <
bool Test,
typename T =
void>
324 template <
typename T>
325 struct EnableIf<true, T>
Contains almost all Coherent namespaces, classes and functions.
Definition: DataStorage.h:38