-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtexttemplates.py
More file actions
166 lines (127 loc) · 2.69 KB
/
texttemplates.py
File metadata and controls
166 lines (127 loc) · 2.69 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
'''
String template used for the GMock mock file output
{0} = Mock Namespace Header Guard
{1} = ICWrappers.h include directory
{2} = Generated Mock Classes
'''
GMOCK_FILE_TEMPLATE = \
'''/** @file
GENERATED by CFunctionWrapperGenerator
DO NOT MODIFY
*/
#pragma once
#ifndef {0}_CWRAPPERS_H
#define {0}_CWRAPPERS_H
#include <gmock/gmock.h>
#include <{1}/ICWrappers.h>
{2}
#endif // {0}_CWRAPPERS_H
'''
'''
String template used for the Component file output
{0} = Namespace header guard
{1} = Necessary headers (include real C function prototypes)
{2} = ICWrappers.h include directory
{3} = Namespace hierarchy with class declarations
{4} = Component Classes
'''
COMPONENT_FILE_TEMPLATE = \
'''/** @file
GENERATED by CFunctionWrapperGenerator
DO NOT MODIFY
*/
#pragma once
#ifndef {0}_CWRAPPERS_H
#define {0}_CWRAPPERS_H
{1}
#include <{2}/ICWrappers.h>
{3}
{4}
#endif
'''
'''
String template used for the interface file
{0} = Namespace Header Guard
{1} = List of include directives
{2} = Namespace Hierarchy
{3} = Interface Class Defintions
'''
INTERFACE_FILE_TEMPLATE = \
'''/** @file
GENERATED by CFunctionWrapperGenerator
DO NOT MODIFY
*/
#pragma once
#ifndef {0}_ICWRAPPERS_H
#define {0}_ICWRAPPERS_H
{1}
{2}
{3}
#endif // {0}_ICWRAPPERS_H
'''
'''
String template used for generating individual classes
which implement an interface
{0} = Fully qualified class name
{1} = List of fully qualified inherited class names
{2} = Functions
{3} = Class Name
'''
INHERITING_CLASS_TEMPLATE = \
'''class {0} : public {1}
{{
public:
virtual ~{3}() {{}}
{2}
}};
'''
'''
String template used for generating individual
interface classes
{0} = Fully qualified interface name
{1} = Functions
{2} = Class Name
'''
INTERFACE_CLASS_TEMPLATE = \
'''class {0}
{{
public:
virtual ~{2}() {{}}
{1}
}};
'''
'''
String template used for generating individual
interface function prototypes
{0} = Return Type
{1} = Wrapper function prefix
{2} = Wrapped function name
{3} = Function Argument type and names list
{4} = Function Qualifier (optional)
'''
INTERFACE_FUNCTION_TEMPLATE = 'virtual {0} {1}{2} ({3}) {4} = 0;'
'''
String template used for generating individual wrapper
function implementations
{0} = Return type
{1} = Wrapper function prefix
{2} = Wrapped function name
{3} = Function Argument type and names list
{4} = Function Qualifier (optional)
{5} = Function Argument names list
'''
COMPONENT_FUNCTION_TEMPLATE = \
'''{0}
{1}{2} ({3}) {4}
{{
return {2}({5});
}}
'''
'''
{0} = GMock MOCK_METHOD* or MOCK_CONST_METHOD* name
{1} = Mocked function name
{2} = Return type
{3} = Function argument type and names list
'''
GMOCK_DECLARATION_TEMPLATE = '''{0}({1}, {2}({3}));
'''