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

Go to the source code of this file.

Functions

void licenceSave (std::ofstream &fs)
 Saves the policy.
 
PString licenceSaveStr ()
 Get the licence in string.
 
PString makeMultiIncludeDefineMacro (const PString &fileName)
 Create the macro of multi inclusion file name.
 
void saveHeaderFile (const PPath &fileName)
 Fonction qui sauve le fichier header.
 
void saveHeaderSourceFile (const PPath &headerName, const PPath &sourceName)
 Fonction qui sauve le fichier header.
 
void saveSourceFile (const PPath &fileName, const PString &headerName)
 Fonction qui sauve le fichier source.
 

Function Documentation

◆ licenceSave()

void licenceSave ( std::ofstream & fs)

Saves the policy.

Parameters
fs: file in witch to write

Definition at line 26 of file header_generator.cpp.

26 {
27 fs << licenceSaveStr() << std::endl;
28}
PString licenceSaveStr()
Get the licence in string.

References licenceSaveStr().

Referenced by generator_class_cpp_headerFile(), generator_class_cpp_sourceFile(), generator_class_testMain(), project_wrapper_moduleGeneratorMain(), saveHeaderFile(), saveSourceFile(), wrapper_generator_class_headerFile(), and wrapper_generator_class_sourceFile().

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

◆ licenceSaveStr()

PString licenceSaveStr ( )

Get the licence in string.

Returns
licence in string

Definition at line 13 of file header_generator.cpp.

13 {
14 PString body("");
15 body += "/***************************************\n";
16 body += "\tAuteur : Pierre Aubert\n";
17 body += "\tMail : pierre.aubert@lapp.in2p3.fr\n";
18 body += "\tLicence : CeCILL-C\n";
19 body += "****************************************/\n";
20 return body;
21}

Referenced by licenceSave().

+ Here is the caller graph for this function:

◆ makeMultiIncludeDefineMacro()

PString makeMultiIncludeDefineMacro ( const PString & fileName)

Create the macro of multi inclusion file name.

Parameters
fileName: header file name
Returns
macro of multi inclusion file name

Definition at line 34 of file header_generator.cpp.

34 {
35 return "__" + fileName.replace(".", "_").toUpper() + "__";
36}

Referenced by generator_class_cpp_headerFile(), generator_class_cpp_sourceFile(), saveHeaderFile(), and wrapper_generator_class_headerFile().

+ Here is the caller graph for this function:

◆ saveHeaderFile()

void saveHeaderFile ( const PPath & fileName)

Fonction qui sauve le fichier header.

Parameters
fileName: header file name

Definition at line 41 of file header_generator.cpp.

41 {
42 std::ofstream fs;
43 fs.open(fileName.c_str());
44 if(!fs.is_open()){
45 std::cerr << "saveHeaderFile : can't open file '" << fileName << "'" << std::endl;
46 return;
47 }
48 PString defineStr(makeMultiIncludeDefineMacro(fileName));
49 licenceSave(fs);
50 fs << "#ifndef " << defineStr << std::endl;
51 fs << "#define " << defineStr << std::endl;
52 fs << std::endl << std::endl << std::endl << std::endl << std::endl << std::endl;
53 fs << "#endif" << std::endl;
54 fs.close();
55}
PString makeMultiIncludeDefineMacro(const PString &fileName)
Create the macro of multi inclusion file name.
void licenceSave(std::ofstream &fs)
Saves the policy.

References licenceSave(), and makeMultiIncludeDefineMacro().

Referenced by saveHeaderSourceFile().

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

◆ saveHeaderSourceFile()

void saveHeaderSourceFile ( const PPath & headerName,
const PPath & sourceName )

Fonction qui sauve le fichier header.

Parameters
headerName: header file name
sourceName: source file name

Definition at line 77 of file header_generator.cpp.

77 {
78 saveHeaderFile(headerName);
79 saveSourceFile(sourceName, headerName);
80}
void saveSourceFile(const PPath &fileName, const PString &headerName)
Fonction qui sauve le fichier source.
void saveHeaderFile(const PPath &fileName)
Fonction qui sauve le fichier header.

References saveHeaderFile(), and saveSourceFile().

+ Here is the call graph for this function:

◆ saveSourceFile()

void saveSourceFile ( const PPath & fileName,
const PString & headerName )

Fonction qui sauve le fichier source.

Parameters
fileName: source file name
headerName: header file name

Definition at line 61 of file header_generator.cpp.

61 {
62 std::ofstream fs;
63 fs.open(fileName.c_str());
64 if(!fs.is_open()){
65 std::cerr << "saveSourceFile : can't open file '" << fileName << "'" << std::endl;
66 return;
67 }
68 licenceSave(fs);
69 fs << std::endl << "#include \"" << headerName << "\"" << std::endl << std::endl << std::endl << std::endl << std::endl << std::endl;
70 fs.close();
71}

References licenceSave().

Referenced by saveHeaderSourceFile().

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