Zen
A cross-platform functional programming language
Public Member Functions | Private Member Functions | Private Attributes

TypeSpecDefGenerator Class Reference

Class that generates the definitions for types. More...

Inheritance diagram for TypeSpecDefGenerator:
TypeSpec::Visitor

List of all members.

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::streamos (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::streamios (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.

Detailed Description

Class that generates the definitions for types.


Constructor & Destructor Documentation

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.

Parameters:
indThe indentation level
projectThe project definition
fiFileInfo object for input source file. Used to derive all output file names.
impThe import output stream
hdrThe header output stream
srcThe source output stream
hdrListThe header files generated for this unit
srcListThe source files generated for this unit

Member Function Documentation

z::stream& ios ( z::stream os,
const TypeSpecRefWriter::Format::T format 
) [inline, private]

Write indentation to output stream, depending on output format.

Parameters:
osOutput stream
formatOutput format
Returns:
The output stream
z::stream& os ( const Ast::TypeSpec typeSpec) [inline, private]

Returns either header or source stream depending on whether type is public/internal, or private.

Parameters:
typeSpecType to check
Returns:
The output stream
virtual void visit ( const Ast::StructDef type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::EnumDef type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::OwnerTemplate type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::EnumMemberDef type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::OutParam type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::SharedDef type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::TypeDecl type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::TypeDef type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::Unit type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::ListTemplate type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::DictTemplate type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::FunctionDef type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

virtual void visit ( const Ast::Namespace type) [inline, private, virtual]

Abstract visitor function.

Parameters:
typeThe type reference to handle

Implements TypeSpec::Visitor.

void write ( const Ast::TypeSpec typeSpec) [inline]

Visits the specified type.

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

Parameters:
typeUnit type
void writeChildList ( const Ast::TypeSpec typeSpec) [inline, private]

Visits each child of the type.

Parameters:
typeSpecType to visit
void writeGBodyList ( const Ast::Unit type) [inline, private]

Write all the implementation function body in the compilation unit.

Parameters:
typeUnit type
void writeImplList ( const Ast::Unit type) [inline, private]

Write all the implementation declarations in the compilation unit.

Parameters:
typeUnit type
void writeIndentedChildList ( const Ast::TypeSpec typeSpec) [inline, private]

Increases the indentation and visits each child of the type.

Parameters:
typeSpecType to visit
void writePimplStructDecl ( const Ast::TypeSpec type) [inline, private]

Write private impl struct declaration.

Parameters:
typeThe struct to write
void writePimplStructDef ( const z::string name) [inline, private]

Write private impl struct definition.

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

Parameters:
typeThe struct to write
osOutput stream
accessSpecAccess type
implString contains impl definition for structs that require it, else empty string
formatOutput format
void writeTypeHash ( const Ast::TypeSpec typeSpec) [inline, private]

Writes the hash generator for the type.

Parameters:
typeSpecType to visit
void writeUnitHeaderList ( const Ast::Unit typeSpec) const [inline, private]

Write all the headers for a compilation unit.

Parameters:
typeSpecType to visit

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