![]() |
|
PhoenixGenerator
2.0.4
Set of tools to generate code
|
#include "phoenix_color.h"#include "openFileStream.h"#include "header_generator.h"#include "cmakelist_generator.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_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_getIsPointer (const PString &varType) |
| Check if the given type is a pointer or not. | |
| void | class_saveClassConstructorImpl (std::ofstream &fs, const PClassConfig &classConfig, const PString &defTemplate, const PString &templateDeclaration) |
| Saves constructor of the class. | |
| void | class_saveClassDestructorImpl (std::ofstream &fs, const PClassConfig &classConfig, const PString &defTemplate, const PString &templateDeclaration) |
| Saves destructor of the class. | |
| void | class_saveClassInitialisationFunctionImpl (std::ofstream &fs, const PClassConfig &classConfig, const PString &defTemplate, const PString &templateDeclaration) |
| Saves the copy function of a class. | |
| 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. | |
| 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.
| [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 343 of file generator_class_cpp.cpp.
Referenced by generator_class_cpp().
Here is the caller graph for this function:| PString class_getClassDeclTempalteDef | ( | const PVecString & | listTemplate | ) |
Get the template definition in the class declaration.
| listTemplate | : list of template def |
Definition at line 44 of file generator_class_cpp.cpp.
Referenced by generator_class_cpp_header(), and generator_class_cpp_source().
Here is the caller graph for this function:| PString class_getClassDefTemplate | ( | const PVecString & | listTemplate | ) |
Get the template call in the class declaration.
| listTemplate | : list of template def |
Definition at line 26 of file generator_class_cpp.cpp.
Referenced by generator_class_cpp_header(), and generator_class_cpp_source().
Here is the caller graph for this function:| bool class_getIsPointer | ( | const PString & | varType | ) |
Check if the given type is a pointer or not.
| varType | : type to be checked |
Definition at line 17 of file generator_class_cpp.cpp.
Referenced by class_saveClassInitialisationFunctionImpl().
Here is the caller graph for this function:| void class_saveClassConstructorImpl | ( | std::ofstream & | fs, |
| const PClassConfig & | classConfig, | ||
| const PString & | defTemplate, | ||
| const PString & | templateDeclaration ) |
Saves constructor of the class.
| [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< ... >) |
Definition at line 63 of file generator_class_cpp.cpp.
References PClassConfig::getListParentClass(), and PClassConfig::getName().
Referenced by generator_class_cpp_source().
Here is the call graph for this function:
Here is the caller graph for this function:| void class_saveClassDestructorImpl | ( | std::ofstream & | fs, |
| const PClassConfig & | classConfig, | ||
| const PString & | defTemplate, | ||
| const PString & | templateDeclaration ) |
Saves destructor of the class.
| [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< ... >) |
Definition at line 91 of file generator_class_cpp.cpp.
References PClassConfig::getName().
Referenced by generator_class_cpp_source().
Here is the call graph for this function:
Here is the caller graph for this function:| void class_saveClassInitialisationFunctionImpl | ( | std::ofstream & | fs, |
| const PClassConfig & | classConfig, | ||
| const PString & | defTemplate, | ||
| const PString & | templateDeclaration ) |
Saves the copy function of a class.
| [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< ... >) |
Definition at line 106 of file generator_class_cpp.cpp.
References class_getIsPointer(), getDefaultValueTypeInCpp(), getIsSimpleType(), PClassConfig::getListAttribute(), and PClassConfig::getName().
Referenced by generator_class_cpp_source().
Here is the call graph for this function:
Here is the caller graph for this function:| bool generator_checkDefaultValueExist | ( | const std::vector< PClassAttribute > & | vecAttr | ) |
Check if the vector of PClassAttribute has default value.
| vecAttr | : vector of attribute to be checked |
Definition at line 138 of file generator_class_cpp.cpp.
Referenced by generator_enum_cpp_header().
Here is the caller graph for this function:| 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.
| 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) |
Definition at line 361 of file generator_class_cpp.cpp.
References class_checkClassConfig(), generator_class_cpp_headerFile(), and generator_class_cpp_sourceFile().
Referenced by generator_class_full().
Here is the call graph for this function:
Here is the caller graph for this function:| void generator_class_cpp_header | ( | const PTraitBackendManager & | manager, |
| std::ofstream & | fs, | ||
| const PClassConfig & | classConfig, | ||
| const GeneratorMode & | mode ) |
Create the declaration of the given class.
| 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 186 of file generator_class_cpp.cpp.
References class_getClassDeclTempalteDef(), class_getClassDefTemplate(), PTraitBackendManager::classExtraFunctionDeclaration(), GeneratorMode::defTemplate, PClassConfig::getClassDocumentation(), PClassConfig::getListAttribute(), PClassConfig::getListParentClass(), PClassConfig::getListTemplate(), PClassConfig::getName(), PTraitBackendManager::privateMethodDeclaration(), PTraitBackendManager::protectedMethodDeclaration(), PTraitBackendManager::publicMethodDeclaration(), and GeneratorMode::templateDeclaration.
Referenced by generator_class_cpp_headerFile().
Here is the call graph for this function:
Here is the caller graph for this function:| 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.
| 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 |
Definition at line 240 of file generator_class_cpp.cpp.
References generator_class_cpp_header(), generator_enum_cpp_header(), PTraitBackendManager::headerExtraInclude(), licenceSave(), and makeMultiIncludeDefineMacro().
Referenced by generator_class_cpp().
Here is the call graph for this function:
Here is the caller graph for this function:| void generator_class_cpp_source | ( | const PTraitBackendManager & | manager, |
| std::ofstream & | fs, | ||
| const PClassConfig & | classConfig, | ||
| const GeneratorMode & | mode ) |
Create the implementation of the given class.
| 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 283 of file generator_class_cpp.cpp.
References class_getClassDeclTempalteDef(), class_getClassDefTemplate(), class_saveClassConstructorImpl(), class_saveClassDestructorImpl(), class_saveClassInitialisationFunctionImpl(), PTraitBackendManager::classExtraFunctionImplementation(), GeneratorMode::defTemplate, PClassConfig::getIsEnum(), PClassConfig::getListTemplate(), PTraitBackendManager::privateMethodImplementation(), PTraitBackendManager::protectedMethodImplementation(), PTraitBackendManager::publicMethodImplementation(), and GeneratorMode::templateDeclaration.
Referenced by generator_class_cpp_sourceFile().
Here is the call graph for this function:
Here is the caller graph for this function:| 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.
| 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 |
Definition at line 312 of file generator_class_cpp.cpp.
References generator_class_cpp_source(), licenceSave(), and makeMultiIncludeDefineMacro().
Referenced by generator_class_cpp().
Here is the call graph for this function:
Here is the caller graph for this function:| 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.
| 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) |
Definition at line 471 of file generator_class_cpp.cpp.
References generator_class_test(), and getCMakeListsHeader().
Referenced by generator_class_full().
Here is the call graph for this function:
Here is the caller graph for this function:| bool generator_class_full | ( | const PTraitBackendManager & | manager, |
| const ProjectParam & | projectParam ) |
Generate the full sources and related unit tests from configuration.
| manager | : PTraitBackendManager which handles all trait backend |
| projectParam | : description of classes and how and where to generate sources and test |
Definition at line 491 of file generator_class_cpp.cpp.
References generator_class_cpp(), generator_class_cpp_test(), getCMakeListsHeader(), ProjectParam::mode, ProjectParam::name, ProjectParam::outputSourceDir, ProjectParam::outputTestDir, and ProjectParam::vecDataConfig.
Referenced by simple_project_generate_source().
Here is the call graph for this function:
Here is the caller graph for this function:| 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.
| 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) |
Definition at line 451 of file generator_class_cpp.cpp.
References generator_class_testCMakeLists(), generator_class_testMain(), and PClassConfig::getName().
Referenced by generator_class_cpp_test().
Here is the call graph for this function:
Here is the caller graph for this function:| 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.
| 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) |
Definition at line 429 of file generator_class_cpp.cpp.
References getCMakeListsHeader(), and PClassConfig::getName().
Referenced by generator_class_test().
Here is the call graph for this function:
Here is the caller graph for this function:| 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.
| 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) |
Definition at line 403 of file generator_class_cpp.cpp.
References GeneratorMode::assertInclude, licenceSave(), PTraitBackendManager::testCallFunction(), and PTraitBackendManager::testFunction().
Referenced by generator_class_test().
Here is the call graph for this function:
Here is the caller graph for this function:| void generator_enum_cpp_header | ( | const PTraitBackendManager & | manager, |
| std::ofstream & | fs, | ||
| const PClassConfig & | classConfig, | ||
| const GeneratorMode & | mode ) |
Create the declaration of the given class.
| 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 152 of file generator_class_cpp.cpp.
References PTraitBackendManager::classExtraFunctionDeclaration(), generator_checkDefaultValueExist(), PClassConfig::getClassDocumentation(), PClassConfig::getListAttribute(), and PClassConfig::getName().
Referenced by generator_class_cpp_headerFile().
Here is the call graph for this function:
Here is the caller graph for this function: