QtDataSync  4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qtdatasync_helpertypes.h
1 #ifndef QTDATASYNC_HELPERTYPES_H
2 #define QTDATASYNC_HELPERTYPES_H
3 
4 #include <type_traits>
5 
6 #include <QtCore/qobject.h>
7 
8 #include "QtDataSync/qtdatasync_global.h"
9 
10 namespace QtDataSync {
11 namespace __helpertypes {
12 
13 template <class T, class Enable = void>
14 struct is_gadget : public std::false_type {};
15 
16 template <class T>
17 struct is_gadget<T, typename T::QtGadgetHelper> : public std::true_type {};
18 
19 template <class T>
20 struct is_object : public std::false_type {};
21 
22 template <class T>
23 struct is_object<T*> : public std::is_base_of<QObject, T> {};
24 
25 template <typename T>
26 struct is_storable : public is_gadget<T> {};
27 
28 template <typename T>
29 struct is_storable<T*> : public std::is_base_of<QObject, T> {};
30 
31 }
32 }
33 
34 #define QTDATASYNC_STORE_ASSERT(T) static_assert(__helpertypes::is_storable<T>::value, "Only Q_GADGETS or pointers to QObject extending classes can be stored")
35 
36 #endif // QTDATASYNC_HELPERTYPES_H
The primary namespace of the QtDataSync library.