PhoenixGenerator  3.4.0
Generate code from template files and projects in C++, Rust, Python and wrapped C++ to Python
Loading...
Searching...
No Matches
generator_class_cpp.cpp File Reference
#include <sstream>
#include "phoenix_color.h"
#include "openFileStream.h"
#include "header_generator.h"
#include "cmakelist_generator.h"
#include "type_utils.h"
#include "generator_class_cpp.h"
Include dependency graph for generator_class_cpp.cpp:

Go to the source code of this file.

Functions

void class_checkClassConfig (bool &hasSource, bool &hasTemplate, const std::vector< PClassConfig > &vecClassConfig)
 Check if the configuration has source or template to determine if the .cpp or _impl.h files have to be generated.
PString class_getAttributeDefaultInit (const PClassAttribute &attr)
 Get the in-class default member initialiser of an attribute (eg "{0}"), or an empty PString if the attribute doesn't need one.
PString class_getClassDeclTempalteDef (const PVecString &listTemplate)
 Get the template definition in the class declaration.
PString class_getClassDefTemplate (const PVecString &listTemplate)
 Get the template call in the class declaration.
bool class_hasPointerAttribute (const PClassConfig &classConfig)
 Check if the given class owns at least one pointer attribute.
void class_savePointerOwnershipSpecialMembersImpl (std::ofstream &fs, const PClassConfig &classConfig, const PString &defTemplate, const PString &templateDeclaration)
 Saves the destructor, copy constructor/assignment and move constructor/assignment of a class owning at least one raw pointer attribute.
bool generator_checkDefaultValueExist (const std::vector< PClassAttribute > &vecAttr)
 Check if the vector of PClassAttribute has default value.
bool generator_class_cpp (const PTraitBackendManager &manager, const std::vector< PClassConfig > &vecClassConfig, const PPath &outputSourceDir, const PPath &baseFileName, const GeneratorMode &mode, const PVecPath &vecInclude)
 Creates header and source files.
void generator_class_cpp_header (const PTraitBackendManager &manager, std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode)
 Create the declaration of the given class.
bool generator_class_cpp_headerFile (const PTraitBackendManager &manager, const PPath &headerFile, const std::vector< PClassConfig > &vecClassConfig, const GeneratorMode &mode, const PVecPath &vecInclude, const PString &includeTemplate)
 Create the declaration of the given class.
void generator_class_cpp_source (const PTraitBackendManager &manager, std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode)
 Create the implementation of the given class.
bool generator_class_cpp_sourceFile (const PTraitBackendManager &manager, const PPath &sourceFile, const PPath &headerFile, const std::vector< PClassConfig > &vecClassConfig, const GeneratorMode &mode, bool isTemplateImpl)
 Create the implementation of the given file.
bool generator_class_cpp_test (const PTraitBackendManager &manager, const PPath &outputTestDir, const std::vector< PClassConfig > &vecClassConfig, const PString &projectName, const PPath &baseFileName, const GeneratorMode &mode)
 Save the unit test of the generated PClassConfig.
bool generator_class_full (const PTraitBackendManager &manager, const ProjectParam &projectParam)
 Generate the full sources and related unit tests from configuration.
bool generator_class_test (const PTraitBackendManager &manager, const PPath &outputTestDir, const PClassConfig &classConfig, const PString &projectName, const PPath &baseFileName, const GeneratorMode &mode)
 Save the unit test of the generated PClassConfig.
bool generator_class_testCMakeLists (const PPath &outputCurrentTestDir, const PClassConfig &classConfig, const PString &projectName, const GeneratorMode &mode)
 Save the CMakeLists to be used to compile the unit test.
bool generator_class_testMain (const PTraitBackendManager &manager, const PPath &outputCurrentTestDir, const PClassConfig &classConfig, const PPath &baseFileName, const GeneratorMode &mode)
 Save the CMakeLists to be used to compile the unit test.
void generator_enum_cpp_header (const PTraitBackendManager &manager, std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode)
 Create the declaration of the given class.

Function Documentation

◆ class_checkClassConfig()

void class_checkClassConfig ( bool & hasSource,
bool & hasTemplate,
const std::vector< PClassConfig > & vecClassConfig )

Check if the configuration has source or template to determine if the .cpp or _impl.h files have to be generated.

Parameters
[out]hasSource: true if the configuration needs .cpp file
[out]hasTemplate: true if the configuration needs _impl.h file
vecClassConfig: class config we want to save

Definition at line 449 of file generator_class_cpp.cpp.

449 {
450 hasSource = false;
451 hasTemplate = false;
452 for(std::vector<PClassConfig>::const_iterator it(vecClassConfig.begin()); it != vecClassConfig.end(); ++it){
453 bool isTemplate = it->getListTemplate().size() != 0LU;
454 hasSource |= !isTemplate;
455 hasTemplate |= isTemplate;
456 }
457}

References class_checkClassConfig().

Referenced by class_checkClassConfig(), and generator_class_cpp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ class_getAttributeDefaultInit()

PString class_getAttributeDefaultInit ( const PClassAttribute & attr)

Get the in-class default member initialiser of an attribute (eg "{0}"), or an empty PString if the attribute doesn't need one.

Parameters
attr: attribute to be checked
Returns
in-class default member initialiser of the attribute, or an empty PString if none is needed

Definition at line 66 of file generator_class_cpp.cpp.

66 {
67 if(attr.getDefaultValue() != ""){return attr.getDefaultValue();}
68 PString varType(attr.getType());
69 if(getIsPointerType(varType)){return "{NULL}";} //raw pointer : not implicitly null-initialised, needs an explicit NSDMI
70 PString defaultValue(getDefaultValueTypeInCpp(varType));
71 if(defaultValue != ""){return "{" + defaultValue + "}";}
72 return "";
73}
const PString & getDefaultValue() const
Gets the defaultValue of the PClassAttribute.
const PString & getType() const
Gets the type of the PClassAttribute.
bool getIsPointerType(const PString &varType)
Say if a given type is a pointer type (i.e. it ends with a '*').
PString getDefaultValueTypeInCpp(const PString &type)
Get the default value of a type in C++.

References class_getAttributeDefaultInit(), PClassAttribute::getDefaultValue(), getDefaultValueTypeInCpp(), getIsPointerType(), and PClassAttribute::getType().

Referenced by class_getAttributeDefaultInit(), and generator_class_cpp_header().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ class_getClassDeclTempalteDef()

PString class_getClassDeclTempalteDef ( const PVecString & listTemplate)

Get the template definition in the class declaration.

Parameters
listTemplate: list of template def
Returns
template definition in the class declaration (template< .... >)

Definition at line 49 of file generator_class_cpp.cpp.

49 {
50 if(listTemplate.size() == 0LU){return "";}
51 PString templateDef("template<");
52 PString comma("");
53 for(PVecString::const_iterator it(listTemplate.begin()); it != listTemplate.end(); ++it){
54 templateDef += comma;
55 templateDef += *it;
56 comma = ", ";
57 }
58 templateDef += ">\n";
59 return templateDef;
60}

References class_getClassDeclTempalteDef().

Referenced by class_getClassDeclTempalteDef(), generator_class_cpp_header(), and generator_class_cpp_source().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ class_getClassDefTemplate()

PString class_getClassDefTemplate ( const PVecString & listTemplate)

Get the template call in the class declaration.

Parameters
listTemplate: list of template def
Returns
template definition in the class declaration (< T, U, .... >)

Definition at line 31 of file generator_class_cpp.cpp.

31 {
32 if(listTemplate.size() == 0LU){return "";}
33 PString defTemplate("<"), comma("");
34 for(PVecString::const_iterator it(listTemplate.begin()); it != listTemplate.end(); ++it){
35 PVecString vecPart = it->split(' ');
36 if(vecPart.size() != 0LU){
37 defTemplate += comma + vecPart.back();
38 comma = ", ";
39 }
40 }
41 defTemplate += ">";
42 return defTemplate;
43}

References class_getClassDefTemplate().

Referenced by class_getClassDefTemplate(), generator_class_cpp_header(), and generator_class_cpp_source().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ class_hasPointerAttribute()

bool class_hasPointerAttribute ( const PClassConfig & classConfig)

Check if the given class owns at least one pointer attribute.

Parameters
classConfig: PClassConfig to be checked
Returns
true if the class has a pointer attribute, false otherwise

Definition at line 19 of file generator_class_cpp.cpp.

19 {
20 const std::vector<PClassAttribute> & listAttr(classConfig.getListAttribute());
21 for(std::vector<PClassAttribute>::const_iterator it(listAttr.begin()); it != listAttr.end(); ++it){
22 if(getIsPointerType(it->getType())){return true;}
23 }
24 return false;
25}
const std::vector< PClassAttribute > & getListAttribute() const
Returns the list of attributes of the class.

References class_hasPointerAttribute(), getIsPointerType(), and PClassConfig::getListAttribute().

Referenced by class_hasPointerAttribute(), class_savePointerOwnershipSpecialMembersImpl(), generator_class_cpp_header(), and generator_class_cpp_sourceFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ class_savePointerOwnershipSpecialMembersImpl()

void class_savePointerOwnershipSpecialMembersImpl ( std::ofstream & fs,
const PClassConfig & classConfig,
const PString & defTemplate,
const PString & templateDeclaration )

Saves the destructor, copy constructor/assignment and move constructor/assignment of a class owning at least one raw pointer attribute.

A class with a raw pointer attribute cannot rely on the compiler-generated (=default) special members : the default copy/move would only copy the pointer value (shallow copy), leading to double-delete once the hand-written destructor frees it. Per the rule of five, all five special members (destructor, copy ctor/assign, move ctor/assign) are generated by hand for these classes.

Parameters
[out]fs: header file name
classConfig: PClassConfig we vant to save
defTemplate: extra template definition for the class name space
templateDeclaration: basic template declaration before each method (template< ... >)

Destructor

Copy constructor

Copy assignment operator

Copy helper, reused by the copy constructor and the copy assignment operator

Move constructor

Move assignment operator

Move helper, reused by the move constructor and the move assignment operator

Definition at line 96 of file generator_class_cpp.cpp.

96 {
97 if(!class_hasPointerAttribute(classConfig)){return;}
98 PString name(classConfig.getName());
99 const std::vector<PClassAttribute> & listAttr(classConfig.getListAttribute());
100
102 fs << "///Destructor of class " << name << std::endl;
103 fs << templateDeclaration;
104 fs << name << defTemplate << "::~" << name << "(){" << std::endl;
105 for(std::vector<PClassAttribute>::const_iterator it(listAttr.begin()); it != listAttr.end(); ++it){
106 if(getIsPointerType(it->getType())){
107 fs << "\tdelete p_" << it->getName() << ";" << std::endl;
108 }
109 }
110 fs << "}" << std::endl << std::endl;
111
113 fs << "///Copy constructor of class " << name << std::endl;
114 fs << "/**\t@param other : " << name << " we want to copy" << std::endl;
115 fs << "*/" << std::endl;
116 fs << templateDeclaration;
117 fs << name << defTemplate << "::" << name << "(const " << name << defTemplate << " & other)";
118 PString initListComma(" : ");
119 for(std::vector<PClassAttribute>::const_iterator it(listAttr.begin()); it != listAttr.end(); ++it){
120 if(getIsPointerType(it->getType())){
121 fs << initListComma << "p_" << it->getName() << "(NULL)";
122 initListComma = ", ";
123 }
124 }
125 fs << "{" << std::endl;
126 fs << "\tcopy" << name << "(other);" << std::endl;
127 fs << "}" << std::endl << std::endl;
128
130 fs << "///Copy assignment operator of class " << name << std::endl;
131 fs << "/**\t@param other : " << name << " we want to copy" << std::endl;
132 fs << " * \t@return copied class " << name << std::endl;
133 fs << "*/" << std::endl;
134 fs << templateDeclaration;
135 fs << name << defTemplate << " & " << name << defTemplate << "::operator = (const " << name << defTemplate << " & other){" << std::endl;
136 fs << "\tcopy" << name << "(other);" << std::endl;
137 fs << "\treturn *this;" << std::endl;
138 fs << "}" << std::endl << std::endl;
139
141 fs << "///Copy the attributes of class " << name << std::endl;
142 fs << "/**\t@param other : " << name << " we want to copy" << std::endl;
143 fs << "*/" << std::endl;
144 fs << templateDeclaration;
145 fs << "void " << name << defTemplate << "::copy" << name << "(const " << name << defTemplate << " & other){" << std::endl;
146 fs << "\tif(this == &other){return;}" << std::endl;
147 for(std::vector<PClassAttribute>::const_iterator it(listAttr.begin()); it != listAttr.end(); ++it){
148 if(getIsPointerType(it->getType())){
149 PString pointeeType(it->getType().eraseFirstLastChar(" \n\t*"));
150 fs << "\tdelete p_" << it->getName() << ";" << std::endl;
151 fs << "\tp_" << it->getName() << " = other.p_" << it->getName() << " ? new " << pointeeType << "(*other.p_" << it->getName() << ") : NULL;" << std::endl;
152 }else{
153 fs << "\tp_" << it->getName() << " = other.p_" << it->getName() << ";" << std::endl;
154 }
155 }
156 fs << "}" << std::endl << std::endl;
157
159 fs << "///Move constructor of class " << name << std::endl;
160 fs << "/**\t@param other : " << name << " we want to move" << std::endl;
161 fs << "*/" << std::endl;
162 fs << templateDeclaration;
163 fs << name << defTemplate << "::" << name << "(" << name << defTemplate << " && other) noexcept";
164 initListComma = " : ";
165 for(std::vector<PClassAttribute>::const_iterator it(listAttr.begin()); it != listAttr.end(); ++it){
166 if(getIsPointerType(it->getType())){
167 fs << initListComma << "p_" << it->getName() << "(NULL)";
168 initListComma = ", ";
169 }
170 }
171 fs << "{" << std::endl;
172 fs << "\tmove" << name << "(std::move(other));" << std::endl;
173 fs << "}" << std::endl << std::endl;
174
176 fs << "///Move assignment operator of class " << name << std::endl;
177 fs << "/**\t@param other : " << name << " we want to move" << std::endl;
178 fs << " * \t@return moved class " << name << std::endl;
179 fs << "*/" << std::endl;
180 fs << templateDeclaration;
181 fs << name << defTemplate << " & " << name << defTemplate << "::operator = (" << name << defTemplate << " && other) noexcept{" << std::endl;
182 fs << "\tmove" << name << "(std::move(other));" << std::endl;
183 fs << "\treturn *this;" << std::endl;
184 fs << "}" << std::endl << std::endl;
185
187 fs << "///Move the attributes of class " << name << std::endl;
188 fs << "/**\t@param other : " << name << " we want to move" << std::endl;
189 fs << "*/" << std::endl;
190 fs << templateDeclaration;
191 fs << "void " << name << defTemplate << "::move" << name << "(" << name << defTemplate << " && other){" << std::endl;
192 fs << "\tif(this == &other){return;}" << std::endl;
193 for(std::vector<PClassAttribute>::const_iterator it(listAttr.begin()); it != listAttr.end(); ++it){
194 if(getIsPointerType(it->getType())){
195 fs << "\tdelete p_" << it->getName() << ";" << std::endl;
196 fs << "\tp_" << it->getName() << " = other.p_" << it->getName() << ";" << std::endl;
197 fs << "\tother.p_" << it->getName() << " = NULL;" << std::endl;
198 }else{
199 fs << "\tp_" << it->getName() << " = std::move(other.p_" << it->getName() << ");" << std::endl;
200 }
201 }
202 fs << "}" << std::endl << std::endl;
203}
const PString & getName() const
Returns the class name.
bool class_hasPointerAttribute(const PClassConfig &classConfig)
Check if the given class owns at least one pointer attribute.

References class_hasPointerAttribute(), class_savePointerOwnershipSpecialMembersImpl(), getIsPointerType(), PClassConfig::getListAttribute(), and PClassConfig::getName().

Referenced by class_savePointerOwnershipSpecialMembersImpl(), and generator_class_cpp_source().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_checkDefaultValueExist()

bool generator_checkDefaultValueExist ( const std::vector< PClassAttribute > & vecAttr)

Check if the vector of PClassAttribute has default value.

Parameters
vecAttr: vector of attribute to be checked
Returns
true if there is at least one default value, false if there is none

Definition at line 79 of file generator_class_cpp.cpp.

79 {
80 bool hasDefaultValue = false;
81 for(std::vector<PClassAttribute>::const_iterator it(vecAttr.begin()); it != vecAttr.end() && !hasDefaultValue; ++it){
82 hasDefaultValue |= it->getDefaultValue() != "";
83 }
84 return hasDefaultValue;
85}

References generator_checkDefaultValueExist().

Referenced by generator_checkDefaultValueExist(), and generator_enum_cpp_header().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_class_cpp()

bool generator_class_cpp ( const PTraitBackendManager & manager,
const std::vector< PClassConfig > & vecClassConfig,
const PPath & outputSourceDir,
const PPath & baseFileName,
const GeneratorMode & mode,
const PVecPath & vecInclude )

Creates header and source files.

Parameters
manager: PTraitBackendManager which handles all trait backend
vecClassConfig: vector of class config we want to save
baseFileName: base file name for header or source file
outputSourceDir: output directory where to save sources
mode: all modes of the generator (data/check/type/config stream)
Returns
true on success, false otherwise

Definition at line 467 of file generator_class_cpp.cpp.

467 {
468 if(baseFileName == ""){
469 std::cerr << termRed() << "generator_class_cpp : baseFileName is empty" << termDefault() << std::endl;
470 return false;
471 }
472 bool hasSource(false), hasTemplate(false);
473 class_checkClassConfig(hasSource, hasTemplate, vecClassConfig);
474 PString includeTemplate("");
475 if(hasTemplate){
476 includeTemplate = PString(baseFileName.getFileName() + "_impl.h");
477 }
478 PPath headerFile = outputSourceDir / PPath(baseFileName + ".h");
479 if(!generator_class_cpp_headerFile(manager, headerFile, vecClassConfig, mode, vecInclude, includeTemplate)){
480 std::cerr << termRed() << "generator_class_cpp : cannot generate header file '"<<headerFile<<"'" << termDefault() << std::endl;
481 return false;
482 }
483 if(hasSource){
484 PPath sourceFile = outputSourceDir / PPath(baseFileName + PString(".cpp"));
485 if(!generator_class_cpp_sourceFile(manager, sourceFile, PPath(baseFileName + PString(".h")), vecClassConfig, mode, false)){
486 std::cerr << termRed() << "generator_class_cpp : cannot generate source file '"<<sourceFile<<"'" << termDefault() << std::endl;
487 return false;
488 }
489 }
490 if(hasTemplate){
491 PPath implFile = outputSourceDir / PPath(baseFileName + PString("_impl.h"));
492 if(!generator_class_cpp_sourceFile(manager, implFile, PPath(baseFileName + PString(".h")), vecClassConfig, mode, true)){
493 std::cerr << termRed() << "generator_class_cpp : cannot generate impl file '"<<implFile<<"'" << termDefault() << std::endl;
494 return false;
495 }
496 }
497 return true;
498}
bool generator_class_cpp_sourceFile(const PTraitBackendManager &manager, const PPath &sourceFile, const PPath &headerFile, const std::vector< PClassConfig > &vecClassConfig, const GeneratorMode &mode, bool isTemplateImpl)
Create the implementation of the given file.
void class_checkClassConfig(bool &hasSource, bool &hasTemplate, const std::vector< PClassConfig > &vecClassConfig)
Check if the configuration has source or template to determine if the .cpp or _impl....
bool generator_class_cpp_headerFile(const PTraitBackendManager &manager, const PPath &headerFile, const std::vector< PClassConfig > &vecClassConfig, const GeneratorMode &mode, const PVecPath &vecInclude, const PString &includeTemplate)
Create the declaration of the given class.

References class_checkClassConfig(), generator_class_cpp(), generator_class_cpp_headerFile(), and generator_class_cpp_sourceFile().

Referenced by generator_class_cpp(), and generator_class_full().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_class_cpp_header()

void generator_class_cpp_header ( const PTraitBackendManager & manager,
std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode )

Create the declaration of the given class.

Parameters
manager: PTraitBackendManager which handles all trait backend
[out]fs: file to be completed
classConfig: configuration of the class to be used
mode: mode of the generator

Definition at line 245 of file generator_class_cpp.cpp.

245 {
246 if(classConfig.getClassDocumentation() != "") fs << classConfig.getClassDocumentation() << std::endl;
247 PString name(classConfig.getName());
248 PString namespaceName(classConfig.getNamespace());
249 GeneratorMode classMode(mode);
250 const PVecString & listTemplate = classConfig.getListTemplate();
251 PString defTemplate(class_getClassDefTemplate(listTemplate));
252 PString templateDeclaration(class_getClassDeclTempalteDef(listTemplate));
253 classMode.defTemplate = defTemplate;
254 classMode.templateDeclaration = templateDeclaration;
255
256 fs << classMode.templateDeclaration;
257 fs << "class ";
258 if(namespaceName != ""){
259 fs << namespaceName << "::";
260 }
261 fs << name;
262 if(classConfig.getListParentClass().size() != 0LU){
263 PVecString::const_iterator it(classConfig.getListParentClass().begin());
264 fs << " : public " << *it;
265 if(classConfig.getListParentClass().size() > 1lu){
266 while(it != classConfig.getListParentClass().end()){
267 fs << ", " << *it;
268 ++it;
269 }
270 }
271 }
272 bool hasPointerAttribute(class_hasPointerAttribute(classConfig));
273 fs << "{" << std::endl;
274 fs << "\tpublic:" << std::endl;
275 fs << "\t\t" << name << "() = default;" << std::endl;
276 if(hasPointerAttribute){
277 //A raw pointer attribute cannot be safely copied/moved by the compiler-generated special members (shallow copy/move would double-delete) :
278 //DataStream has no shared_ptr/unique_ptr specialisation, so ownership is a raw pointer and all five special members must be hand-written (rule of five).
279 fs << "\t\tvirtual ~" << name << "();" << std::endl;
280 fs << "\t\t" << name << "(const " << name << " &);" << std::endl;
281 fs << "\t\t" << name << " & operator = (const " << name << " &);" << std::endl;
282 fs << "\t\t" << name << "(" << name << " &&) noexcept;" << std::endl;
283 fs << "\t\t" << name << " & operator = (" << name << " &&) noexcept;" << std::endl;
284 }else{
285 fs << "\t\tvirtual ~" << name << "() = default;" << std::endl;
286 //A user-declared destructor suppresses the implicitly-declared copy/move constructor and assignment : redeclare all four as defaulted.
287 fs << "\t\t" << name << "(const " << name << " &) = default;" << std::endl;
288 fs << "\t\t" << name << " & operator = (const " << name << " &) = default;" << std::endl;
289 fs << "\t\t" << name << "(" << name << " &&) = default;" << std::endl;
290 fs << "\t\t" << name << " & operator = (" << name << " &&) = default;" << std::endl;
291 }
292
293 manager.publicMethodDeclaration(fs, classConfig, classMode);
294
295 //Trait backends write to an std::ofstream& : capture their output into a string buffer first (via a buffer swap, no actual file involved)
296 //so the "protected:" label is only emitted when there is something to put under it, instead of leaving an empty access-specifier section.
297 std::ostringstream protectedContentBuf;
298 std::ofstream protectedCapture;
299 //basic_ofstream declares its own 0-arg rdbuf() (returning the internal filebuf), which hides the inherited basic_ios::rdbuf(streambuf*) setter :
300 //go through the std::ostream base to reach the setter and redirect writes into a string buffer without opening any file.
301 static_cast<std::ostream &>(protectedCapture).rdbuf(protectedContentBuf.rdbuf());
302 manager.protectedMethodDeclaration(protectedCapture, classConfig, classMode);
303 PString protectedContent(protectedContentBuf.str());
304 if(hasPointerAttribute || protectedContent != ""){
305 fs << "\tprotected:" << std::endl;
306 if(hasPointerAttribute){
307 fs << "\t\tvoid copy" << name << "(const " << name << " & other);" << std::endl;
308 fs << "\t\tvoid move" << name << "(" << name << " && other);" << std::endl;
309 }
310 fs << protectedContent;
311 }
312
313 fs << "\tprivate:" << std::endl;
314 manager.privateMethodDeclaration(fs, classConfig, classMode);
315 const std::vector<PClassAttribute> & listAttr(classConfig.getListAttribute());
316 for(std::vector<PClassAttribute>::const_iterator it(listAttr.begin()); it != listAttr.end(); ++it){
317 if(it->getDocumentation() != "") fs << "\t\t" << it->getDocumentation() << std::endl;
318 PString defaultInit(class_getAttributeDefaultInit(*it));
319 fs << "\t\t" << it->getType() << " p_" << it->getName() << defaultInit << ";" << std::endl;
320 }
321 fs << "};" << std::endl << std::endl;
322 manager.classExtraFunctionDeclaration(fs, classConfig, classMode);
323 fs << std::endl << std::endl;
324}
const PString & getClassDocumentation() const
Returns the class documentation.
const PVecString & getListTemplate() const
Returns the list of the template of the class.
const PVecString & getListParentClass() const
Returns the list of the parents of the class.
const PString & getNamespace() const
Returns the namespace of the class.
void protectedMethodDeclaration(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Declaration of protected methods.
void classExtraFunctionDeclaration(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Declaration of extra functions.
void privateMethodDeclaration(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Declaration of private methods.
void publicMethodDeclaration(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Declaration of public methods.
PString class_getClassDefTemplate(const PVecString &listTemplate)
Get the template call in the class declaration.
PString class_getAttributeDefaultInit(const PClassAttribute &attr)
Get the in-class default member initialiser of an attribute (eg "{0}"), or an empty PString if the at...
PString class_getClassDeclTempalteDef(const PVecString &listTemplate)
Get the template definition in the class declaration.
All the genertor modes.

References class_getAttributeDefaultInit(), class_getClassDeclTempalteDef(), class_getClassDefTemplate(), class_hasPointerAttribute(), PTraitBackendManager::classExtraFunctionDeclaration(), GeneratorMode::defTemplate, generator_class_cpp_header(), PClassConfig::getClassDocumentation(), PClassConfig::getListAttribute(), PClassConfig::getListParentClass(), PClassConfig::getListTemplate(), PClassConfig::getName(), PClassConfig::getNamespace(), PTraitBackendManager::privateMethodDeclaration(), PTraitBackendManager::protectedMethodDeclaration(), PTraitBackendManager::publicMethodDeclaration(), and GeneratorMode::templateDeclaration.

Referenced by generator_class_cpp_header(), and generator_class_cpp_headerFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_class_cpp_headerFile()

bool generator_class_cpp_headerFile ( const PTraitBackendManager & manager,
const PPath & headerFile,
const std::vector< PClassConfig > & vecClassConfig,
const GeneratorMode & mode,
const PVecPath & vecInclude,
const PString & includeTemplate )

Create the declaration of the given class.

Parameters
manager: PTraitBackendManager which handles all trait backend
headerFile: file to be saved
vecClassConfig: configuration of the class to be used
mode: mode of the generator
vecInclude: vector of include files to be added into the header
includeTemplate: extra include for the template implementation
Returns
true on success, false otherwise

Definition at line 335 of file generator_class_cpp.cpp.

337{
338 if(headerFile == "") return false;
339 std::ofstream fs;
340 if(!openFileStream(fs, headerFile)){return false;}
341 licenceSave(fs);
342 PString macroDef(makeMultiIncludeDefineMacro(headerFile.getFileName()));
343 fs << "#ifndef " << macroDef << std::endl;
344 fs << "#define " << macroDef << std::endl << std::endl;
345 fs << "#include <string>" << std::endl;
346 if(vecInclude.size() != 0LU){
347 for(PVecPath::const_iterator it(vecInclude.begin()); it != vecInclude.end(); ++it){
348 fs << "#include " << *it << std::endl;
349 }
350 fs << std::endl;
351 }
352 manager.headerExtraInclude(fs, mode);
353 fs << std::endl;
354 for(std::vector<PClassConfig>::const_iterator it(vecClassConfig.begin()); it != vecClassConfig.end(); ++it){
355 if(it->getIsEnum()){
356 generator_enum_cpp_header(manager, fs, *it, mode);
357// saveEnumDecl(fs, *it, mode);
358 }else{
359 generator_class_cpp_header(manager, fs, *it, mode);
360 }
361 }
362
363 if(includeTemplate != ""){
364 fs << "#include \""<<includeTemplate<<"\"" << std::endl << std::endl;
365 }
366
367 fs << std::endl << std::endl << "#endif" << std::endl << std::endl;
368 fs.close();
369 return true;
370}
void headerExtraInclude(std::ofstream &fs, const GeneratorMode &mode) const
Add extra include on the header.
void generator_class_cpp_header(const PTraitBackendManager &manager, std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode)
Create the declaration of the given class.
void generator_enum_cpp_header(const PTraitBackendManager &manager, std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode)
Create the declaration of the given class.
PString makeMultiIncludeDefineMacro(const PString &fileName)
Create the macro of multi inclusion file name.
void licenceSave(std::ofstream &fs)
Saves the policy.

References generator_class_cpp_header(), generator_class_cpp_headerFile(), generator_enum_cpp_header(), PTraitBackendManager::headerExtraInclude(), licenceSave(), and makeMultiIncludeDefineMacro().

Referenced by generator_class_cpp(), and generator_class_cpp_headerFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_class_cpp_source()

void generator_class_cpp_source ( const PTraitBackendManager & manager,
std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode )

Create the implementation of the given class.

Parameters
manager: PTraitBackendManager which handles all trait backend
[out]fs: file to be completed
classConfig: configuration of the class to be used
mode: mode of the generator

Definition at line 378 of file generator_class_cpp.cpp.

378 {
379 manager.classExtraFunctionImplementation(fs, classConfig, mode);
380 GeneratorMode classMode(mode);
381 const PVecString & listTemplate = classConfig.getListTemplate();
382 PString defTemplate(class_getClassDefTemplate(listTemplate));
383 PString templateDeclaration(class_getClassDeclTempalteDef(listTemplate));
384 classMode.defTemplate = defTemplate;
385 classMode.templateDeclaration = templateDeclaration;
386 if(!classConfig.getIsEnum()){
387 class_savePointerOwnershipSpecialMembersImpl(fs, classConfig, defTemplate, templateDeclaration);
388 }
389 manager.publicMethodImplementation(fs, classConfig, classMode);
390 manager.protectedMethodImplementation(fs, classConfig, classMode);
391 manager.privateMethodImplementation(fs, classConfig, classMode);
392}
bool getIsEnum() const
Say if the current PClassConfig is an enum.
void classExtraFunctionImplementation(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Implementation of extra functions.
void protectedMethodImplementation(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Implementation of protected methods.
void privateMethodImplementation(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Implementation of private methods.
void publicMethodImplementation(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Implementation of public methods.
void class_savePointerOwnershipSpecialMembersImpl(std::ofstream &fs, const PClassConfig &classConfig, const PString &defTemplate, const PString &templateDeclaration)
Saves the destructor, copy constructor/assignment and move constructor/assignment of a class owning a...

References class_getClassDeclTempalteDef(), class_getClassDefTemplate(), class_savePointerOwnershipSpecialMembersImpl(), PTraitBackendManager::classExtraFunctionImplementation(), GeneratorMode::defTemplate, generator_class_cpp_source(), PClassConfig::getIsEnum(), PClassConfig::getListTemplate(), PTraitBackendManager::privateMethodImplementation(), PTraitBackendManager::protectedMethodImplementation(), PTraitBackendManager::publicMethodImplementation(), and GeneratorMode::templateDeclaration.

Referenced by generator_class_cpp_source(), and generator_class_cpp_sourceFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_class_cpp_sourceFile()

bool generator_class_cpp_sourceFile ( const PTraitBackendManager & manager,
const PPath & sourceFile,
const PPath & headerFile,
const std::vector< PClassConfig > & vecClassConfig,
const GeneratorMode & mode,
bool isTemplateImpl )

Create the implementation of the given file.

Parameters
manager: PTraitBackendManager which handles all trait backend
sourceFile: source file to be saved
headerFile: header to be used with this source file
vecClassConfig: vector of configuration of the classes to be used
mode: mode of the generator
isTemplateImpl: true to activate
Returns
true on success, false otherwise

Definition at line 403 of file generator_class_cpp.cpp.

405{
406 if(sourceFile == "" || headerFile == "") return false;
407 std::ofstream fs;
408 if(!openFileStream(fs, sourceFile)){return false;}
409 licenceSave(fs);
410 if(isTemplateImpl){
411 PString macroDef(makeMultiIncludeDefineMacro(headerFile.getFileName() + "_IMPL"));
412 fs << "#ifndef " << macroDef << std::endl;
413 fs << "#define " << macroDef << std::endl << std::endl;
414 }
415 fs << std::endl << "#include \"" << headerFile.getFileName() << "\"" << std::endl;
416 bool hasPointerAttribute(false);
417 for(std::vector<PClassConfig>::const_iterator it(vecClassConfig.begin()); it != vecClassConfig.end() && !hasPointerAttribute; ++it){
418 hasPointerAttribute = class_hasPointerAttribute(*it);
419 }
420 if(hasPointerAttribute){
421 fs << "#include <utility>" << std::endl; //std::move used by the hand-written move constructor/assignment
422 }
423 fs << std::endl;
424 bool hasNamespace(false);
425 for(std::vector<PClassConfig>::const_iterator it(vecClassConfig.begin()); it != vecClassConfig.end(); ++it){
426 if(it->getNamespace() != "" && !hasNamespace){
427 fs << "using namespace " << it->getNamespace() << ";" << std::endl << std::endl;
428 hasNamespace = true;
429 }
430 }
431 for(std::vector<PClassConfig>::const_iterator it(vecClassConfig.begin()); it != vecClassConfig.end(); ++it){
432 generator_class_cpp_source(manager, fs, *it, mode);
433 }
434 if(isTemplateImpl){
435 fs << "#endif" << std::endl << std::endl;
436 }
437 fs.close();
438
439 return true;
440}
void generator_class_cpp_source(const PTraitBackendManager &manager, std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode)
Create the implementation of the given class.

References class_hasPointerAttribute(), generator_class_cpp_source(), generator_class_cpp_sourceFile(), licenceSave(), and makeMultiIncludeDefineMacro().

Referenced by generator_class_cpp(), and generator_class_cpp_sourceFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_class_cpp_test()

bool generator_class_cpp_test ( const PTraitBackendManager & manager,
const PPath & outputTestDir,
const std::vector< PClassConfig > & vecClassConfig,
const PString & projectName,
const PPath & baseFileName,
const GeneratorMode & mode )

Save the unit test of the generated PClassConfig.

Parameters
manager: PTraitBackendManager which handles all trait backend
outputTestDir: output directory where to put the generated test (typically ../TESTS if the program is called from ./src)
vecClassConfig: vector of class configuration to be used
projectName: configuration of the project
baseFileName: base of output file name of the generated sources
mode: all modes of the generator (data/check/type/config stream)
Returns
true on success, false oterhwise

Definition at line 578 of file generator_class_cpp.cpp.

578 {
579 PString cmakeListBody;
580 cmakeListBody += getCMakeListsHeader();
581 bool b(true);
582 cmakeListBody += "#Generating tests for " + PString::toString(vecClassConfig.size()) + "\n";
583 for(std::vector<PClassConfig>::const_iterator it(vecClassConfig.begin()); it != vecClassConfig.end(); ++it){
584 cmakeListBody += "add_subdirectory(TEST_" + it->getName().toUpper() + ")\n";
585 b &= generator_class_test(manager, outputTestDir, *it, projectName, baseFileName, mode);
586 }
587 cmakeListBody += "\n\n";
588 PPath cmakelist(outputTestDir / PPath("CMakeLists.txt"));
589 b &= cmakelist.saveFileContent(cmakeListBody);
590 return b;
591}
PString getCMakeListsHeader()
Get the CMakeLists.txt header.
bool generator_class_test(const PTraitBackendManager &manager, const PPath &outputTestDir, const PClassConfig &classConfig, const PString &projectName, const PPath &baseFileName, const GeneratorMode &mode)
Save the unit test of the generated PClassConfig.

References generator_class_cpp_test(), generator_class_test(), and getCMakeListsHeader().

Referenced by generator_class_cpp_test(), and generator_class_full().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_class_full()

bool generator_class_full ( const PTraitBackendManager & manager,
const ProjectParam & projectParam )

Generate the full sources and related unit tests from configuration.

Parameters
manager: PTraitBackendManager which handles all trait backend
projectParam: description of classes and how and where to generate sources and test
Returns
true on success, false otherwise

Definition at line 598 of file generator_class_cpp.cpp.

598 {
599 bool b(true);
600 b &= projectParam.outputSourceDir.createDirectory();
601 b &= projectParam.outputTestDir.createDirectory();
602 PString cmakeListBody;
603 cmakeListBody += getCMakeListsHeader();
604 const PVecDataConfig & vecDataConfig = projectParam.vecDataConfig;
605 for(const PDataConfig & config : vecDataConfig){
606 PPath baseFileName = config.getFileName().getFileName().eraseExtension();
607 if(!generator_class_cpp(manager, config.getVecClassConfig(), projectParam.outputSourceDir, baseFileName, projectParam.mode, config.getVecInclude())){
608 std::cerr << termRed() << "generator_class_full : cannot generate C++ sources at '"<<projectParam.outputSourceDir<<"'" << termDefault() << std::endl;
609 b = false; //best effort strategy
610 }
611 PPath outputCurrentTestDir = projectParam.outputTestDir / PPath("TEST_" + config.getFileName().getFileName().eraseExtension().toUpper());
612 cmakeListBody += "add_subdirectory(" + outputCurrentTestDir.getFileName() + ")\n";
613 if(!generator_class_cpp_test(manager, outputCurrentTestDir, config.getVecClassConfig(), projectParam.name, baseFileName, projectParam.mode)){
614 std::cerr << termRed() << "generator_class_full : cannot generate C++ tests at '"<<projectParam.outputTestDir<<"'" << termDefault() << std::endl;
615 b = false; //best effort strategy
616 }
617 }
618 cmakeListBody += "\n\n";
619 PPath cmakelist(projectParam.outputTestDir / PPath("CMakeLists.txt"));
620 b &= cmakelist.saveFileContent(cmakeListBody);
621 return b;
622}
std::vector< PDataConfig > PVecDataConfig
Definition PDataConfig.h:48
Class to describe a basic class.
Definition PDataConfig.h:17
bool generator_class_cpp(const PTraitBackendManager &manager, const std::vector< PClassConfig > &vecClassConfig, const PPath &outputSourceDir, const PPath &baseFileName, const GeneratorMode &mode, const PVecPath &vecInclude)
Creates header and source files.
bool generator_class_cpp_test(const PTraitBackendManager &manager, const PPath &outputTestDir, const std::vector< PClassConfig > &vecClassConfig, const PString &projectName, const PPath &baseFileName, const GeneratorMode &mode)
Save the unit test of the generated PClassConfig.
GeneratorMode mode
Mode to be used to generate the project.
PPath outputTestDir
Output path of the unit tests.
PVecDataConfig vecDataConfig
Configuration of classes to be generated.
PString name
Name of the project.
PPath outputSourceDir
Output path of the sources.

References generator_class_cpp(), generator_class_cpp_test(), generator_class_full(), getCMakeListsHeader(), ProjectParam::mode, ProjectParam::name, ProjectParam::outputSourceDir, ProjectParam::outputTestDir, and ProjectParam::vecDataConfig.

Referenced by generateCppClassesFull(), and generator_class_full().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_class_test()

bool generator_class_test ( const PTraitBackendManager & manager,
const PPath & outputTestDir,
const PClassConfig & classConfig,
const PString & projectName,
const PPath & baseFileName,
const GeneratorMode & mode )

Save the unit test of the generated PClassConfig.

Parameters
manager: PTraitBackendManager which handles all trait backend
outputTestDir: output directory where to put the genreated test (typically ../TESTS if the program is called from ./src)
classConfig: class configuration to be used
projectName: configuration of the project
baseFileName: base of output file name of the generated sources
mode: all modes of the generator (data/check/type/config stream)
Returns
true on success, false oterhwise

Definition at line 558 of file generator_class_cpp.cpp.

558 {
559 PString name(classConfig.getName());
560 PPath outputCurrentTestDir(outputTestDir + PString("/TEST_") + name.toUpper());
561 if(!outputCurrentTestDir.createDirectory()){std::cerr << "generator_class_test : cannot create TEST directory '"<<outputCurrentTestDir<<"'" << std::endl;return false;}
562
563 bool b(true);
564 b &= generator_class_testCMakeLists(outputCurrentTestDir, classConfig, projectName, mode);
565 b &= generator_class_testMain(manager, outputCurrentTestDir, classConfig, baseFileName, mode);
566 return b;
567}
bool generator_class_testMain(const PTraitBackendManager &manager, const PPath &outputCurrentTestDir, const PClassConfig &classConfig, const PPath &baseFileName, const GeneratorMode &mode)
Save the CMakeLists to be used to compile the unit test.
bool generator_class_testCMakeLists(const PPath &outputCurrentTestDir, const PClassConfig &classConfig, const PString &projectName, const GeneratorMode &mode)
Save the CMakeLists to be used to compile the unit test.

References generator_class_test(), generator_class_testCMakeLists(), generator_class_testMain(), and PClassConfig::getName().

Referenced by generator_class_cpp_test(), and generator_class_test().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_class_testCMakeLists()

bool generator_class_testCMakeLists ( const PPath & outputCurrentTestDir,
const PClassConfig & classConfig,
const PString & projectName,
const GeneratorMode & mode )

Save the CMakeLists to be used to compile the unit test.

Parameters
outputCurrentTestDir: current test directory in which to create the CMakeLists.txt
classConfig: class configuration to be used
projectName: configuration of the project
mode: all modes of the generator (data/check/type/config stream)
Returns
true on success, false oterhwise

Definition at line 536 of file generator_class_cpp.cpp.

536 {
537 PString body(""), testName("test_class_" + classConfig.getName().toLowerUnderscore());
538 body += getCMakeListsHeader();
539 body += "add_executable("+testName+" main.cpp)\n";
540 body += "target_link_libraries("+testName+" ${"+projectName.toUpper()+"_TEST_DEPENDENCIES})\n";
541 body += "\n";
542 body += "add_test(NAME "+testName.firstToUpper()+"\n";
543 body += "\tCOMMAND ${CMAKE_CURRENT_BINARY_DIR}/"+testName+"\n";
544 body += "\tWORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}\n";
545 body += ")\n\n\n";
546 return PPath(outputCurrentTestDir + PString("/CMakeLists.txt")).saveFileContent(body);
547}

References generator_class_testCMakeLists(), getCMakeListsHeader(), and PClassConfig::getName().

Referenced by generator_class_test(), and generator_class_testCMakeLists().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_class_testMain()

bool generator_class_testMain ( const PTraitBackendManager & manager,
const PPath & outputCurrentTestDir,
const PClassConfig & classConfig,
const PPath & baseFileName,
const GeneratorMode & mode )

Save the CMakeLists to be used to compile the unit test.

Parameters
manager: PTraitBackendManager which handles all trait backend
outputCurrentTestDir: current test directoru in which to create the CMakeLists.txt
classConfig: class configuration to be used
baseFileName: base of output file name of the generated sources
mode: all modes of the generator (data/check/type/config stream)
Returns
true on success, false oterhwise

Definition at line 509 of file generator_class_cpp.cpp.

509 {
510 std::ofstream fs;
511 if(!openFileStream(fs, PPath(outputCurrentTestDir + PString("/main.cpp")))){return false;}
512 licenceSave(fs);
513// body += licenceSaveStr() + "\n";
514 if(mode.assertInclude != ""){
515 fs << "#include \"" + mode.assertInclude + "\"\n\n";
516 }
517 fs << "#include \"" + baseFileName + ".h\"\n\n";
518 if(classConfig.getNamespace() != ""){fs << "using namespace " << classConfig.getNamespace() << ";\n\n";}
519 manager.testFunction(fs, classConfig, mode);
520 fs << "int main(int argc, char ** argv){\n";
521 //Do other test if the enableDataStream is true
522 manager.testCallFunction(fs, classConfig, mode);
523 fs << "\treturn 0;\n";
524 fs << "}\n";
525 fs.close();
526 return true;
527}
void testCallFunction(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Call of the test function.
void testFunction(std::ofstream &fs, const PClassConfig &classConfig, const GeneratorMode &mode) const
Implementation of test function.
PString assertInclude
Include of the assert to be used.

References GeneratorMode::assertInclude, generator_class_testMain(), PClassConfig::getNamespace(), licenceSave(), PTraitBackendManager::testCallFunction(), and PTraitBackendManager::testFunction().

Referenced by generator_class_test(), and generator_class_testMain().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator_enum_cpp_header()

void generator_enum_cpp_header ( const PTraitBackendManager & manager,
std::ofstream & fs,
const PClassConfig & classConfig,
const GeneratorMode & mode )

Create the declaration of the given class.

Parameters
manager: PTraitBackendManager which handles all trait backend
[out]fs: file to be completed
classConfig: configuration of the class to be used
mode: mode of the generator

Definition at line 211 of file generator_class_cpp.cpp.

211 {
212 if(classConfig.getClassDocumentation() != "") fs << classConfig.getClassDocumentation() << std::endl;
213 PString name(classConfig.getName());
214 fs << "namespace " << name << " {\n";
215 if(classConfig.getClassDocumentation() != ""){fs << "\t"<< classConfig.getClassDocumentation() << std::endl;}
216 fs << "\tenum " << name << " {\n\t\t";
217 const std::vector<PClassAttribute> & vecAttr(classConfig.getListAttribute());
218 bool isDefaultCounterActivated = !generator_checkDefaultValueExist(vecAttr);
219 PString comma("");
220 size_t i(0LU);
221 for(std::vector<PClassAttribute>::const_iterator it(vecAttr.begin()); it != vecAttr.end(); ++it){
222 if(it->getDocumentation() != "") fs << "\t\t" << it->getDocumentation() << std::endl;
223 fs << comma << it->getName();
224 if(isDefaultCounterActivated){
225 fs << " = " << i;
226 }else if(it->getDefaultValue() != ""){
227 fs << " = " << it->getDefaultValue();
228 }
229 comma = ",\n\t\t";
230 ++i;
231 }
232 fs << "\n\t};" << std::endl;
233 fs << "}" << std::endl << std::endl;
234 manager.classExtraFunctionDeclaration(fs, classConfig, mode);
235 fs << std::endl << std::endl;
236}
bool generator_checkDefaultValueExist(const std::vector< PClassAttribute > &vecAttr)
Check if the vector of PClassAttribute has default value.

References PTraitBackendManager::classExtraFunctionDeclaration(), generator_checkDefaultValueExist(), generator_enum_cpp_header(), PClassConfig::getClassDocumentation(), PClassConfig::getListAttribute(), and PClassConfig::getName().

Referenced by generator_class_cpp_headerFile(), and generator_enum_cpp_header().

Here is the call graph for this function:
Here is the caller graph for this function: