Zen
A cross-platform functional programming language

StructDef Class Reference

Concrete AST Node representing a user-defined struct. More...

#include <Ast.hpp>

Inheritance diagram for StructDef:
UserDefinedTypeSpec ChildTypeSpec TypeSpec Node

List of all members.

Public Member Functions

 StructDef (const AccessType::T &accessType, const z::string &name, const NativeType &ntype)
 Default constructor.
void setDefList (const VariableDefMap &defList)
 Sets the list of member variables for this struct.
bool hasDefList () const
 Checks whether the member list has been set.
const VariableDefMapgetDefList () const
 Returns a reference to the VariableDef list.
void setSubTypeList (const StructDefList &subTypeList)
 Sets the list of subtypes for this struct.
bool hasSubTypeList () const
 Checks whether the subtype list has been set.
const StructDefListgetSubTypeList () const
 Returns a reference to the subtype list.

Private Member Functions

virtual void visit (TypeSpec::Visitor &visitor) const
 Visitor pattern implementation.
virtual const Ast::VariableDefhasMember (const z::string &name) const
 Checks if struct member exists.

Private Attributes

const VariableDefMap_defList
 struct member list
const StructDefList_subTypeList
 struct subtype list

Detailed Description

Concrete AST Node representing a user-defined struct.

Todo:
Subtypes is an experimental feature, to use struct's, union's and states to simulate base classes. WIP.

Constructor & Destructor Documentation

StructDef ( const AccessType::T accessType,
const z::string name,
const NativeType ntype 
) [inline]

Default constructor.

Parameters:
accessTypeThe AccessType for this UDT.
nameName of the UDT
ntypeThe NativeType of this UDT.

Member Function Documentation

const VariableDefMap& getDefList ( ) const [inline]

Returns a reference to the VariableDef list.

Returns:
Reference to the VariableDef list.
const StructDefList& getSubTypeList ( ) const [inline]

Returns a reference to the subtype list.

Returns:
Reference to the subtype list.
bool hasDefList ( ) const [inline]

Checks whether the member list has been set.

Returns:
True if it has been set, else false
const Ast::VariableDef * hasMember ( const z::string name) const [private, virtual]

Checks if struct member exists.

Parameters:
nameName of member to be checked
Returns:
Pointer to VariableDef of member if it exists, else 0

Reimplemented from TypeSpec.

bool hasSubTypeList ( ) const [inline]

Checks whether the subtype list has been set.

Returns:
True if it has been set, else false
void setDefList ( const VariableDefMap defList) [inline]

Sets the list of member variables for this struct.

This is a one-time operation, the list cannot be set more than once.

Parameters:
defListThe member list
void setSubTypeList ( const StructDefList subTypeList) [inline]

Sets the list of subtypes for this struct.

This is a one-time operation, the list cannot be set more than once.

Parameters:
subTypeListThe subtype list
void visit ( TypeSpec::Visitor visitor) const [private, virtual]

Visitor pattern implementation.

Parameters:
visitorThe visitor object.

Implements TypeSpec.


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