-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathcl_generator.h
More file actions
61 lines (48 loc) · 1.37 KB
/
cl_generator.h
File metadata and controls
61 lines (48 loc) · 1.37 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
#include <primitives/emitter.h>
struct EnumValue
{
String name;
};
struct Flag
{
String name;
String flag;
String ns; // c++ namespace
String type;
String default_value;
String function;
String function_current;
String struct_;
StringSet properties;
int order = 0;
StringMap<EnumValue> enum_vals;
bool disabled = false;
String getTypeWithNs() const;
void printDecl(primitives::CppEmitter &) const;
void printEnum(primitives::CppEmitter &) const;
void printStruct(primitives::CppEmitter &) const;
void printStructFunction(primitives::CppEmitter &) const;
void printCommandLine(primitives::CppEmitter &) const;
};
using Flags = std::map<String, Flag>;
struct Type
{
String name;
String parent;
Flags flags;
mutable bool printed = false;
void print(primitives::CppEmitter &h, primitives::CppEmitter &cpp) const;
private:
void printH(primitives::CppEmitter &) const;
void printCpp(primitives::CppEmitter &) const;
std::vector<const Flag *> sortFlags() const;
};
using Types = std::map<String, Type>;
struct File
{
Flags flags;
Types types;
void print(primitives::CppEmitter &h, primitives::CppEmitter &cpp) const;
private:
void print_type(const Type &t, primitives::CppEmitter &h, primitives::CppEmitter &cpp) const;
};