Zen
A cross-platform functional programming language

SwitchStatement Class Reference

AST Node representing a switch statement. More...

#include <Ast.hpp>

Inheritance diagram for SwitchStatement:
Statement Node

List of all members.

Public Member Functions

 SwitchStatement (const Ast::Expr &expr, const Ast::SwitchLabelList &list)
 Default constructor.
const Ast::ExprgetExpr () const
 Returns a reference to the switch expression.
const Ast::SwitchLabelListgetList () const
 Returns a reference to the list of case labels in this select statement.

Private Member Functions

virtual void visit (Statement::Visitor &visitor) const
 Abstract visitor function.

Private Attributes

const Ast::Expr_expr
 The switch expression.
const Ast::SwitchLabelList_list
 The case label list.

Detailed Description

AST Node representing a switch statement.

A switch statement is a multiple condition statement that can have only integral constant values as case labels For example:

        switch (a) {
          case 10: {
          }
          case 15: {
          }
        }

Here, the case labels are compile-time integral constants.


Constructor & Destructor Documentation

SwitchStatement ( const Ast::Expr expr,
const Ast::SwitchLabelList list 
) [inline]

Default constructor.

Parameters:
exprThe expression to switch by.
listThe list of case labels for this statement

Member Function Documentation

const Ast::Expr& getExpr ( ) const [inline]

Returns a reference to the switch expression.

Returns:
The switch expression.
const Ast::SwitchLabelList& getList ( ) const [inline]

Returns a reference to the list of case labels in this select statement.

Returns:
Case label list.
void visit ( Statement::Visitor visitor) const [private, virtual]

Abstract visitor function.

Parameters:
visitorThe visitor object.

Implements Statement.


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