eet-cxx: add implementation for eet C++.
[platform/upstream/efl.git] / src / bindings / eet_cxx / eet_type.hh
1 #ifndef _EET_TYPE_HH
2 #define _EET_TYPE_HH
3
4 #include <Eet.h>
5 #include <Eina.hh>
6
7 #include <type_traits>
8
9 namespace efl { namespace eet {
10
11 template <typename T>
12 struct _eet_type;
13
14 template <>
15 struct _eet_type<char> : std::integral_constant<int, EET_T_CHAR>
16 {};
17
18 template <>
19 struct _eet_type<short> : std::integral_constant<int, EET_T_SHORT>
20 {};
21
22 template <>
23 struct _eet_type<int> : std::integral_constant<int, EET_T_INT>
24 {};
25
26 template <>
27 struct _eet_type<long long> : std::integral_constant<int, EET_T_LONG_LONG>
28 {};
29
30 template <>
31 struct _eet_type<float> : std::integral_constant<int, EET_T_FLOAT>
32 {};
33
34 template <>
35 struct _eet_type<double> : std::integral_constant<int, EET_T_DOUBLE>
36 {};
37
38 template <>
39 struct _eet_type<unsigned char> : std::integral_constant<int, EET_T_UCHAR>
40 {};
41
42 template <>
43 struct _eet_type<unsigned short> : std::integral_constant<int, EET_T_USHORT>
44 {};
45
46 template <>
47 struct _eet_type<unsigned int> : std::integral_constant<int, EET_T_UINT>
48 {};
49
50 template <>
51 struct _eet_type<unsigned long long> : std::integral_constant<int, EET_T_ULONG_LONG>
52 {};
53
54 template <>
55 struct _eet_type<char*> : std::integral_constant<int, EET_T_STRING>
56 {};
57
58 template <>
59 struct _eet_type<void*> : std::integral_constant<int, EET_T_NULL>
60 {};
61
62 template <>
63 struct _eet_type<eina::value> : std::integral_constant<int, EET_T_VALUE>
64 {};
65
66 template <typename T>
67 struct _void { typedef void type; };
68
69 template <typename T, typename Enabler = void>
70 struct is_eet_primitive : std::false_type {};
71
72 template <typename T>
73 struct is_eet_primitive<T, typename _void<typename _eet_type<T>::type>::type>
74   : std::true_type {};
75
76 } }
77
78 #endif