-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpp.hint
More file actions
146 lines (129 loc) · 4.49 KB
/
cpp.hint
File metadata and controls
146 lines (129 loc) · 4.49 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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Pliki wskazówek ułatwiają interpretowanie identyfikatorów programu Visual C++ w środowisku Visual Studio IDE
// takich jak nazwy funkcji i makr.
// Aby uzyskać więcej informacji, zobacz https://go.microsoft.com/fwlink/?linkid=865984
#define CloneFunctionStart(className, baseClassName) protected: virtual className* Clone() const override { className* cloned = new className(); CloneTo(cloned); return cloned; } void CloneTo(className* cloned) const { baseClassName::CloneTo(cloned);
#define CloneField(fieldName)
#define CloneFunctionEnd() }
#define PARENS ()
#define NEXT_ELEM ,
#define RESCAN(...) RESCAN1(RESCAN1(RESCAN1(RESCAN1(__VA_ARGS__))))
#define RESCAN1(...) RESCAN2(RESCAN2(RESCAN2(RESCAN2(__VA_ARGS__))))
#define RESCAN2(...) RESCAN3(RESCAN3(RESCAN3(RESCAN3(__VA_ARGS__))))
#define RESCAN3(...) RESCAN4(RESCAN4(RESCAN4(RESCAN4(__VA_ARGS__))))
#define RESCAN4(...) __VA_ARGS__
#define DO_FOR_EACH(func, ...)\
__VA_OPT__(RESCAN(DO_FOR_EACH_HELPER(func, __VA_ARGS__)))
#define DO_FOR_EACH_HELPER(func, a1, ...)\
func(a1)\
__VA_OPT__(DO_FOR_EACH_AGAIN PARENS (func, __VA_ARGS__))
#define DO_FOR_EACH_AGAIN() DO_FOR_EACH_HELPER
#define LIST_DO_FOR_EACH(func, ...)\
__VA_OPT__(RESCAN(LIST_DO_FOR_EACH_HELPER(func, __VA_ARGS__)))
#define LIST_DO_FOR_EACH_HELPER(func, a1, ...)\
func(a1)\
__VA_OPT__(COMMA LIST_DO_FOR_EACH_AGAIN PARENS (func, __VA_ARGS__))
#define LIST_DO_FOR_EACH_AGAIN() LIST_DO_FOR_EACH_HELPER
#define DO_FOR_EACH_PAIR(func, a1, ...)\
__VA_OPT__(RESCAN(DO_FOR_EACH_PAIR_HELPER(func, a1, __VA_ARGS__)))
#define DO_FOR_EACH_PAIR_HELPER(func, a1, a2, ...)\
func(a1, a2)\
__VA_OPT__(DO_FOR_EACH_PAIR_AGAIN PARENS (func, __VA_ARGS__))
#define DO_FOR_EACH_PAIR_AGAIN() DO_FOR_EACH_PAIR_HELPER
#define LIST_DO_FOR_EACH_PAIR(func, a1, ...)\
__VA_OPT__(RESCAN(LIST_DO_FOR_EACH_PAIR_HELPER(func, a1, __VA_ARGS__)))
#define LIST_DO_FOR_EACH_PAIR_HELPER(func, a1, a2, ...)\
func(a1, a2)\
__VA_OPT__(COMMA LIST_DO_FOR_EACH_PAIR_AGAIN PARENS (func, __VA_ARGS__))
#define LIST_DO_FOR_EACH_PAIR_AGAIN() LIST_DO_FOR_EACH_PAIR_HELPER
// STANDARD ENUMS
#define ENUM_ELEMENT(name) name
#define ENUM_CASE(name) case name: return #name;
#define ENUM(name, ...)\
enum name { LIST_DO_FOR_EACH(ENUM_ELEMENT, __VA_ARGS__) };\
static std::string to_string(name value) {\
using enum name;\
switch(value) {\
DO_FOR_EACH(ENUM_CASE, __VA_ARGS__)\
default:\
return "UNKONWN";\
}\
}
#define ENUM_CLASS(name, ...)\
enum class name { LIST_DO_FOR_EACH(ENUM_ELEMENT, __VA_ARGS__) };\
static std::string to_string(name value) {\
using enum name;\
switch(value) {\
DO_FOR_EACH(ENUM_CASE, __VA_ARGS__)\
default:\
return "UNKNOWN";\
}\
}
// ENUMS WITH VALUES
#define ENUM_ELEMENT_VALUE(name, value) name = value
#define ENUM_CASE_VALUE(name, value) case name: return #name;
#define ENUM_VALUE(name, ...)\
enum name { LIST_DO_FOR_EACH_PAIR(ENUM_ELEMENT_VALUE, __VA_ARGS__) };\
static std::string to_string(name value) {\
using enum name;\
switch(value) {\
DO_FOR_EACH_PAIR(ENUM_CASE_VALUE, __VA_ARGS__)\
default:\
return "UNKONWN";\
}\
}
#define ENUM_CLASS_VALUE(name, ...)\
enum class name { LIST_DO_FOR_EACH_PAIR(ENUM_ELEMENT_VALUE, __VA_ARGS__) };\
static std::string to_string(name value) {\
using enum name;\
switch(value) {\
DO_FOR_EACH_PAIR(ENUM_CASE_VALUE, __VA_ARGS__)\
default:\
return "UNKONWN";\
}\
}
#define CloneBaseFunc(className, baseClassName, ...)\
virtual className* Clone() const override\
{\
className* cloned = new className();\
CloneTo(cloned);\
return cloned;\
}\
void CloneTo(className* cloned) const\
{\
baseClassName::CloneTo(cloned);\
DO_FOR_EACH(CloneField, __VA_ARGS__)\
}
#define CloneFunc(className, ...)\
protected:\
virtual className* Clone() const override\
{\
className* cloned = new className();\
CloneTo(cloned);\
return cloned;\
}\
void CloneTo(className* cloned) const\
{\
DO_FOR_EACH(CloneField, __VA_ARGS__)\
}
#define DecisionFunc(_Entity, _Type, valueName, body)\
[&](_Entity valueName) -> _Type {\
body\
}
#define DecisionResult(value, node) \
{\
value,\
node\
}
#define DecisionResults(...)\
{\
LIST_DO_FOR_EACH_PAIR(DecisionResult, __VA_ARGS__)\
}
#define DecisionTreeDecisionMaker(_Entity, _Type, decision, results) \
new DecisionTreeDecisionMaker<_Entity, _Type>(\
decision,\
results\
)
#define DecisionTreeLeaf(_Entity, dataName, body) \
new DecisionTreeLeaf<_Entity>([&](_Entity dataName) -> void {\
body\
})