PhoenixGenerator
2.8.0
Set of tools to generate code
Toggle main menu visibility
Loading...
Searching...
No Matches
simpleClassGenerator.cpp
Go to the documentation of this file.
1
/***************************************
2
Auteur : Thibaut Oprinsen
3
Mail : thibaut.oprinsen@example.com
4
Licence : CeCILL-C
5
****************************************/
6
7
#include "
simpleClassGenerator.h
"
8
#include "phoenix_system.h"
9
11
16
bool
generateClassGeneratorScript
(
const
PVecPath & vecClassConfigFile,
const
PPath & scriptDir,
const
GeneratorMode
& mode){
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
}
43
ProjectType::WRAPPER
@ WRAPPER
Definition
GeneratorMode.h:17
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.
Definition
simpleClassGenerator.cpp:16
simpleClassGenerator.h
GeneratorMode
All the genertor modes.
Definition
GeneratorMode.h:27
GeneratorMode::type
ProjectType::ProjectType type
Type of the project to be generated.
Definition
GeneratorMode.h:58
src
simpleClassGenerator.cpp
Generated by
1.17.0