-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReflection.h
More file actions
83 lines (66 loc) · 2.01 KB
/
Reflection.h
File metadata and controls
83 lines (66 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#pragma once
#include "TypeInfo.h"
#include "PrimitiveType.h"
#include "StdVectorType.h"
#include "ClassType.h"
#include <vector>
namespace CBind
{
//------------------------------------------------------------
// template specialization for bool
template<>
struct TypeInfo <bool>: public PrimitiveType<bool>
{
TypeInfo(): PrimitiveType<bool>("bool") {}
virtual EType getType() const { return EBool; }
};
//------------------------------------------------------------
// template specialization for int
template<>
struct TypeInfo <int>: public PrimitiveType<int>
{
TypeInfo(): PrimitiveType<int>("int") {}
virtual EType getType() const { return EInt; }
};
//------------------------------------------------------------
// template specialization for unsigned
template<>
struct TypeInfo <unsigned>: public PrimitiveType<unsigned>
{
TypeInfo(): PrimitiveType<unsigned>("unsigned") {}
virtual EType getType() const { return EUInt; }
};
//------------------------------------------------------------
// template specialization for float
template<>
struct TypeInfo <float>: public PrimitiveType<float>
{
TypeInfo(): PrimitiveType<float>("float") {}
virtual EType getType() const { return EFloat; }
};
//------------------------------------------------------------
// template specialization for double
template<>
struct TypeInfo <double>: public PrimitiveType<double>
{
TypeInfo(): PrimitiveType<double>("double") {}
virtual EType getType() const { return EDouble; }
};
//------------------------------------------------------------
// template specialization for vector
template<typename TElem>
struct TypeInfo<std::vector<TElem>> : public StdVectorType<std::vector<TElem>>
{
TypeInfo(): StdVectorType<std::vector<TElem>>("std::vector")
{
}
};
//------------------------------------------------------------
// global variables
template<typename T>
TypeInfo<T> PrimitiveType<T>::btype;
template<typename T>
TypeInfo<T> StdVectorType<T>::btype;
template<typename T>
TypeInfo<T> ClassType<T>::btype;
}