-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSchemaTypes.hh
128 lines (103 loc) · 2.97 KB
/
SchemaTypes.hh
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef _SCHEMA_TYPES_HH_
#define _SCHEMA_TYPES_HH_
#include "Common.hh"
#include "DbVal.hh"
/*
+---------------------+-------------------------------------+
| Name | Description |
+---------------------+-------------------------------------+
| binary | Any binary data |
| bits | A set of bits or flags |
| boolean | "true" or "false" |
| decimal64 | 64-bit signed decimal number |
| empty | A leaf that does not have any value |
| enumeration | Enumerated strings |
| identityref | A reference to an abstract identity |
| instance-identifier | References a data tree node |
| int8 | 8-bit signed integer |
| int16 | 16-bit signed integer |
| int32 | 32-bit signed integer |
| int64 | 64-bit signed integer |
| leafref | A reference to a leaf instance |
| string | Human-readable string |
| uint8 | 8-bit unsigned integer |
| uint16 | 16-bit unsigned integer |
| uint32 | 32-bit unsigned integer |
| uint64 | 64-bit unsigned integer |
| union | Choice of member types |
+---------------------+-------------------------------------+
*/
class SchemaType
{
public:
virtual const DbVal* create(const std::string& data) {
Common::Error::err(__PRETTY_FUNCTION__, "Wrong type.");
}
private:
};
class SchemaBinary : public SchemaType
{
};
class SchemaBits : public SchemaType
{
};
class SchemaBoolean : public SchemaType
{
};
class SchemaDecimal64 : public SchemaType
{
};
class SchemaEmpty : public SchemaType
{
};
class SchemaEnumeration : public SchemaType
{
};
class SchemaIdentityref : public SchemaType
{
};
class SchemaInstanceIdentifier : public SchemaType
{
};
class SchemaInt8 : public SchemaType
{
};
class SchemaInt16 : public SchemaType
{
};
class SchemaInt32 : public SchemaType
{
};
class SchemaInt64 : public SchemaType
{
};
class SchemaLeafref : public SchemaType
{
};
class SchemaString : public SchemaType
{
public:
const DbVal* create(const std::string& data) { return new String(data); }
};
class SchemaUInt8 : public SchemaType
{
};
class SchemaUInt16 : public SchemaType
{
};
class SchemaUInt32 : public SchemaType
{
};
class SchemaUInt64 : public SchemaType
{
};
class SchemaUnion : public SchemaType
{
};
class DerivedString : public SchemaString
{
};
class DerivedInt64 : public SchemaInt64
{
};
#endif