-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMetaTable.h
More file actions
83 lines (61 loc) · 2.13 KB
/
Copy pathMetaTable.h
File metadata and controls
83 lines (61 loc) · 2.13 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 <Util\Span.h>
X_NAMESPACE_BEGIN(net)
static int32_t MAX_ARRAY_ELEMENTS = 128;
X_DECLARE_ENUM(CompPropType)
(
Int,
Int64,
Float,
Vector,
VectorXY,
String,
Array,
DataTable,
Quaternion);
X_DECLARE_FLAGS(CompPropFlag)(
NormalVec,
Unsigned);
typedef Flags<CompPropFlag> CompPropFlags;
class CompProp
{
public:
CompProp(const char* pName, CompPropType::Enum type, int32_t fieldOffset, int32_t sizeOfVar, int32_t numBits,
CompPropFlags flags);
CompProp(const char* pName, CompPropType::Enum type, int32_t fieldOffset, int32_t sizeOfVar, int32_t numBits, int32_t numElemets);
X_INLINE CompPropType::Enum getType(void) const;
X_INLINE CompPropFlags getFlags(void) const;
X_INLINE int32_t getFieldOffset(void) const;
X_INLINE int32_t getNumBits(void) const;
X_INLINE int32_t getSizeOfVar(void) const;
X_INLINE int32_t getNumElements(void) const;
private:
const char* pName_;
CompPropType::Enum type_;
CompPropFlags flags_;
int32_t fieldOffset_;
int32_t numBits_;
int32_t sizeOfVar_;
int32_t numElements_; // Array
float fltLowValue_;
float fltHighValue_;
};
class CompTable
{
public:
CompTable();
CompTable(core::span<CompProp> props, const char* pTableName);
void set(core::span<CompProp> props, const char* pTableName);
X_INLINE size_t numProps(void) const;
X_INLINE const CompProp& getProp(size_t idx) const;
X_INLINE const char* getTableName(void) const;
private:
core::span<CompProp> props_;
const char* pTableName_;
};
CompProp CompPropInt(const char* pName, int32_t offset, int32_t sizeOfVar, int32_t numBits = -1, CompPropFlags flags = CompPropFlags());
CompProp CompPropQuat(const char* pName, int32_t offset, int32_t sizeOfVar, int32_t numBits = 32, CompPropFlags flag = CompPropFlags());
CompProp CompPropVec(const char* pName, int32_t offset, int32_t sizeOfVar, int32_t numBits = 32, CompPropFlags flags = CompPropFlags());
CompProp CompPropArray(const char* pName, int32_t offset, int32_t sizeOfVar, int32_t numElemets, int32_t elementSize);
X_NAMESPACE_END
#include "MetaTable.inl"