Zen
A cross-platform functional programming language
|
Class that generates the definitions for types. More...
Public Member Functions | |
TypeSpecDefGenerator (Indent &ind, const Build::Project &project, z::fileinfo &fi, z::stream &imp, z::stream &hdr, z::stream &src, z::stringlist &hdrList, z::stringlist &srcList) | |
Default constructor. | |
void | write (const Ast::TypeSpec &typeSpec) |
Visits the specified type. | |
Private Member Functions | |
z::stream & | os (const Ast::TypeSpec &typeSpec) |
Returns either header or source stream depending on whether type is public/internal, or private. | |
void | writeTypeHash (const Ast::TypeSpec &typeSpec) |
Writes the hash generator for the type. | |
void | writeChildList (const Ast::TypeSpec &typeSpec) |
Visits each child of the type. | |
void | writeIndentedChildList (const Ast::TypeSpec &typeSpec) |
Increases the indentation and visits each child of the type. | |
void | writeUnitHeaderList (const Ast::Unit &typeSpec) const |
Write all the headers for a compilation unit. | |
void | writeImplList (const Ast::Unit &type) |
Write all the implementation declarations in the compilation unit. | |
void | writeBodyList (const Ast::Unit &type) |
Write all the implementation definitions in the compilation unit. | |
void | writeGBodyList (const Ast::Unit &type) |
Write all the implementation function body in the compilation unit. | |
z::stream & | ios (z::stream &os, const TypeSpecRefWriter::Format::T &format) |
Write indentation to output stream, depending on output format. | |
void | writeStruct (const Ast::StructDef &type, z::stream &os, const z::string &accessSpec, const z::string &impl, const TypeSpecRefWriter::Format::T &format) |
Write struct definition. | |
void | writePimplStructDecl (const Ast::TypeSpec &type) |
Write private impl struct declaration. | |
void | writePimplStructDef (const z::string &name) |
Write private impl struct definition. | |
virtual void | visit (const Ast::Unit &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::Namespace &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::StructDef &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::EnumDef &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::EnumMemberDef &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::OutParam &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::SharedDef &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::TypeDecl &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::TypeDef &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::OwnerTemplate &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::ListTemplate &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::DictTemplate &type) |
Abstract visitor function. | |
virtual void | visit (const Ast::FunctionDef &type) |
Abstract visitor function. | |
Private Attributes | |
Indenter | _ind |
Current indentation level. | |
const Build::Project & | _project |
Project definition. | |
z::fileinfo & | _fi |
Fileinfo for input source file. | |
z::stream & | _imp |
Import stream. | |
z::stream & | _hdr |
Header stream. | |
z::stream & | _src |
Source stream. | |
z::stringlist & | _hdrList |
Header list. | |
z::stringlist & | _srcList |
Source list. |
Class that generates the definitions for types.
TypeSpecDefGenerator | ( | Indent & | ind, |
const Build::Project & | project, | ||
z::fileinfo & | fi, | ||
z::stream & | imp, | ||
z::stream & | hdr, | ||
z::stream & | src, | ||
z::stringlist & | hdrList, | ||
z::stringlist & | srcList | ||
) | [inline] |
Default constructor.
ind | The indentation level |
project | The project definition |
fi | FileInfo object for input source file. Used to derive all output file names. |
imp | The import output stream |
hdr | The header output stream |
src | The source output stream |
hdrList | The header files generated for this unit |
srcList | The source files generated for this unit |
z::stream& ios | ( | z::stream & | os, |
const TypeSpecRefWriter::Format::T & | format | ||
) | [inline, private] |
Write indentation to output stream, depending on output format.
os | Output stream |
format | Output format |
z::stream& os | ( | const Ast::TypeSpec & | typeSpec | ) | [inline, private] |
Returns either header or source stream depending on whether type is public/internal, or private.
typeSpec | Type to check |
virtual void visit | ( | const Ast::StructDef & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::EnumDef & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::OwnerTemplate & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::EnumMemberDef & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::OutParam & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::SharedDef & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::TypeDecl & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::TypeDef & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::Unit & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::ListTemplate & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::DictTemplate & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::FunctionDef & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
virtual void visit | ( | const Ast::Namespace & | type | ) | [inline, private, virtual] |
Abstract visitor function.
type | The type reference to handle |
Implements TypeSpec::Visitor.
void write | ( | const Ast::TypeSpec & | typeSpec | ) | [inline] |
Visits the specified type.
typeSpec | Type to visit |
assert(zbl::Project::RunMode::Compile == _project.getRunMode());
void writeBodyList | ( | const Ast::Unit & | type | ) | [inline, private] |
Write all the implementation definitions in the compilation unit.
type | Unit type |
void writeChildList | ( | const Ast::TypeSpec & | typeSpec | ) | [inline, private] |
Visits each child of the type.
typeSpec | Type to visit |
void writeGBodyList | ( | const Ast::Unit & | type | ) | [inline, private] |
Write all the implementation function body in the compilation unit.
type | Unit type |
void writeImplList | ( | const Ast::Unit & | type | ) | [inline, private] |
Write all the implementation declarations in the compilation unit.
type | Unit type |
void writeIndentedChildList | ( | const Ast::TypeSpec & | typeSpec | ) | [inline, private] |
Increases the indentation and visits each child of the type.
typeSpec | Type to visit |
void writePimplStructDecl | ( | const Ast::TypeSpec & | type | ) | [inline, private] |
Write private impl struct declaration.
type | The struct to write |
void writePimplStructDef | ( | const z::string & | name | ) | [inline, private] |
Write private impl struct definition.
name | Name of the struct to write |
void writeStruct | ( | const Ast::StructDef & | type, |
z::stream & | os, | ||
const z::string & | accessSpec, | ||
const z::string & | impl, | ||
const TypeSpecRefWriter::Format::T & | format | ||
) | [inline, private] |
Write struct definition.
type | The struct to write |
os | Output stream |
accessSpec | Access type |
impl | String contains impl definition for structs that require it, else empty string |
format | Output format |
void writeTypeHash | ( | const Ast::TypeSpec & | typeSpec | ) | [inline, private] |
Writes the hash generator for the type.
typeSpec | Type to visit |
void writeUnitHeaderList | ( | const Ast::Unit & | typeSpec | ) | const [inline, private] |
Write all the headers for a compilation unit.
typeSpec | Type to visit |