MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / generate

Method generate

extern/cloop/src/cloop/Generator.cpp:170–712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170void CppGenerator::generate()
171{
172 string nameSpaceUpper = nameSpace;
173 transform(nameSpaceUpper.begin(), nameSpaceUpper.end(), nameSpaceUpper.begin(), toupper);
174
175 fprintf(out, "// %s\n\n", AUTOGEN_MSG);
176
177 fprintf(out, "#ifndef %s\n", headerGuard.c_str());
178 fprintf(out, "#define %s\n\n", headerGuard.c_str());
179 ///fprintf(out, "#include <stdint.h>\n\n");
180
181 fprintf(out, "#ifndef CLOOP_CARG\n");
182 fprintf(out, "#define CLOOP_CARG\n");
183 fprintf(out, "#endif\n\n");
184
185 fprintf(out, "#ifndef CLOOP_NOEXCEPT\n");
186 fprintf(out, "#if __cplusplus >= 201103L\n");
187 fprintf(out, "#define CLOOP_NOEXCEPT noexcept\n");
188 fprintf(out, "#else\n");
189 fprintf(out, "#define CLOOP_NOEXCEPT throw()\n");
190 fprintf(out, "#endif\n");
191 fprintf(out, "#endif\n\n\n");
192
193 fprintf(out, "#ifndef CLOOP_CONSTEXPR\n");
194 fprintf(out, "#if __cplusplus >= 201103L\n");
195 fprintf(out, "#define CLOOP_CONSTEXPR constexpr\n");
196 fprintf(out, "#else\n");
197 fprintf(out, "#define CLOOP_CONSTEXPR const\n");
198 fprintf(out, "#endif\n");
199 fprintf(out, "#endif\n\n\n");
200
201 fprintf(out, "namespace %s\n", nameSpace.c_str());
202 fprintf(out, "{\n");
203 fprintf(out, "\tclass DoNotInherit\n");
204 fprintf(out, "\t{\n");
205 fprintf(out, "\t};\n");
206 fprintf(out, "\n");
207 fprintf(out, "\ttemplate <typename T>\n");
208 fprintf(out, "\tclass Inherit : public T\n");
209 fprintf(out, "\t{\n");
210 fprintf(out, "\tpublic:\n");
211 fprintf(out, "\t\tInherit(DoNotInherit = DoNotInherit())\n");
212 fprintf(out, "\t\t\t: T(DoNotInherit())\n");
213 fprintf(out, "\t\t{\n");
214 fprintf(out, "\t\t}\n");
215 fprintf(out, "\t};\n");
216 fprintf(out, "\n");
217
218 fprintf(out, "\t// Forward interfaces declarations\n\n");
219
220 for (vector<Interface*>::iterator i = parser->interfaces.begin();
221 i != parser->interfaces.end();
222 ++i)
223 {
224 Interface* interface = *i;
225
226 fprintf(out, "\tclass %s%s;\n", prefix.c_str(), interface->name.c_str());
227 }

Callers

nothing calls this directly

Calls 11

snakeUpperCaseFunction · 0.85
DefActionClass · 0.85
valueIsPointerMethod · 0.80
identifyFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
insertMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected