PhoenixGenerator  2.0.4
Set of tools to generate code
Loading...
Searching...
No Matches
simpleClassGenerator.cpp File Reference
#include "simpleClassGenerator.h"
#include "phoenix_system.h"
+ Include dependency graph for simpleClassGenerator.cpp:

Go to the source code of this file.

Functions

bool generateClassGeneratorScript (const PVecPath &vecClassConfigFile, const PPath &scriptDir, const GeneratorMode &mode)
 Generate a bash script to re generate all the classes from their pdata configuration files.
 

Function Documentation

◆ generateClassGeneratorScript()

bool generateClassGeneratorScript ( const PVecPath & vecClassConfigFile,
const PPath & scriptDir,
const GeneratorMode & mode )

Generate a bash script to re generate all the classes from their pdata configuration files.

Parameters
vecClassConfigFile: vector of class configuration files (.pdata files)
scriptDir: directory where to save the script
mode: mode of the generator
Returns
true on success, false otherwise

Definition at line 16 of file simpleClassGenerator.cpp.

16 {
17 PString scriptContent;
18 scriptContent += "#!/bin/bash\n\n";
19 scriptContent += "echo \"Regenerating classes from pdata configuration files...\"\n\n";
20 for(const PPath & classConfigFile : vecClassConfigFile){
21 PString fileName = classConfigFile.getFileName();
22 PString className = classConfigFile.getFileName().eraseExtension();
23 PPath pdataFileInProject = scriptDir / classConfigFile.getFileName();
24 scriptContent += "echo \"Generating class " + className + " from " + pdataFileInProject + "\"\n";
25 //TODO : update the given option by repect to the future options defined in PhoenixFileGenerator
26 scriptContent += "phoenix_filegenerator class -c " + fileName + " -o ../src -u -d ../";
27 if(mode.type == ProjectType::WRAPPER){
28 scriptContent += " --wrapper";
29 }
30 scriptContent += "\n\n";
31 }
32 scriptContent += "echo \"Class regeneration completed.\"\n";
33
34 PPath scriptPath = scriptDir / PPath("generate_class.sh");
35 scriptPath.saveFileContent(scriptContent);
36 // Make the script executable
37 if(!phoenix_popen(PPath("project_path_test.log"), PString("chmod +x " + scriptPath), true)){
38 std::cerr << "generateClassGeneratorScript : cannot make script executable '"<<scriptPath<<"'" << std::endl;
39 return false;
40 }
41 return true;
42}
ProjectType::ProjectType type
Type of the project to be generated.

References GeneratorMode::type, and ProjectType::WRAPPER.

Referenced by simple_project_generator().

+ Here is the caller graph for this function: