Zen
A cross-platform functional programming language

CppGen Class Reference

Main class for generating C++ code from an AST. More...

#include <CppGen.hpp>

List of all members.

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.

Detailed Description

Main class for generating C++ code from an AST.


Constructor & Destructor Documentation

CppGen ( const Build::Project project) [inline]

Default constructor.

Parameters:
projectThe project definition

Member Function Documentation

void generate ( const Ast::Unit unit)

Main function to generate all files given the Unit AST node.

Parameters:
unitThe unit node to generate files for.
z::string getHeaderFileName ( ) const [inline]

Returns the full filename of the header file.

Returns:
The file name
z::string getImportFileName ( ) const [inline]

Returns the full filename of the import file.

Returns:
The file name
z::string getSourceFileName ( ) const [inline]

Returns the full filename of the source file.

Returns:
The file name
void open ( const z::fileinfo fi) [inline, private]

Function for opening all files and streams.

Parameters:
fiFileInfo 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.

Parameters:
projectThe project definition
srcThe output stream for the source file to write to
mainCntnThe main continuation
void writePch ( const Build::Project project) [static]

This function is used to generate default pch.cpp and pch.hpp files.

This is used by ProGen and by CppGen

Parameters:
projectThe project definition

Member Data Documentation

The list of all header files generated by this unit.

Todo:
Remove _hdrList.

The list of all sources files generated by this unit.

Todo:
Remove _srcList.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines