![]() |
Zen
A cross-platform functional programming language
|
Main class for generating C++ code from an AST. More...
#include <CppGen.hpp>
Classes | |
| class | OutFile |
| Class encapsulating output file stream. More... | |
Public Member Functions | |
| CppGen (const Build::Project &project) | |
| Default constructor. | |
| z::string | getImportFileName () const |
| Returns the full filename of the import file. | |
| z::string | getHeaderFileName () const |
| Returns the full filename of the header file. | |
| z::string | getSourceFileName () const |
| Returns the full filename of the source file. | |
| void | generate (const Ast::Unit &unit) |
| Main function to generate all files given the Unit AST node. | |
Static Public Member Functions | |
| static void | writeMain (const Build::Project &project, z::stream &src, const Ast::ContinuationImplItem *mainCntn) |
| This function is used to generate the main() function. | |
| static void | writePch (const Build::Project &project) |
| This function is used to generate default pch.cpp and pch.hpp files. | |
Private Member Functions | |
| void | open (const z::fileinfo &fi) |
| Function for opening all files and streams. | |
| void | close () |
| Function for closing all files and streams. | |
Private Attributes | |
| const Build::Project & | _project |
| The project definition. | |
| OutFile | _imp |
| The import file. | |
| OutFile | _hdr |
| The header file. | |
| OutFile | _src |
| The source file. | |
| z::stringlist | _hdrList |
| The list of all header files generated by this unit. | |
| z::stringlist | _srcList |
| The list of all sources files generated by this unit. | |
Main class for generating C++ code from an AST.
| CppGen | ( | const Build::Project & | project | ) | [inline] |
Default constructor.
| project | The project definition |
| void generate | ( | const Ast::Unit & | unit | ) |
Main function to generate all files given the Unit AST node.
| unit | The unit node to generate files for. |
| z::string getHeaderFileName | ( | ) | const [inline] |
Returns the full filename of the header file.
| z::string getImportFileName | ( | ) | const [inline] |
Returns the full filename of the import file.
| z::string getSourceFileName | ( | ) | const [inline] |
Returns the full filename of the source file.
| void open | ( | const z::fileinfo & | fi | ) | [inline, private] |
Function for opening all files and streams.
| fi | FileInfo object for input source file. Used to derive all output file names. |
| void writeMain | ( | const Build::Project & | project, |
| z::stream & | src, | ||
| const Ast::ContinuationImplItem * | mainCntn | ||
| ) | [static] |
This function is used to generate the main() function.
This is used by ProGen to generate _main.cpp and by CppGen to generate main() fn in .cpp file when a .zpp file has a main() function.
| project | The project definition |
| src | The output stream for the source file to write to |
| mainCntn | The main continuation |
| void writePch | ( | const Build::Project & | project | ) | [static] |
z::stringlist _hdrList [private] |
The list of all header files generated by this unit.
z::stringlist _srcList [private] |
The list of all sources files generated by this unit.