ContRap-Core
|
Class Block represents blocks in the control flow structure. More...
#include <block.h>
Public Types | |
enum | BlockType { PURE, SEQUENCE, QUOTE, CLASS } |
Enumerates possible block types. More... | |
Public Member Functions | |
Block (BlockType type=PURE) | |
Constructs an empty block with the given type. | |
Block (BlockType type, const SPtr< List > &commands) | |
Constructs a block with the given commands. | |
virtual | ~Block () |
Virtual destructor. | |
BlockType | get_block_type () const |
Returns the block type. | |
void | add_command (const DPtr &command) |
Adds a command to the end of the block. | |
SPtr< List > & | get_commands () |
Returns the block commands. | |
const SPtr< List > & | get_commands () const |
Returns the block commands. | |
virtual CommandType | get_command_type () const |
Returns the enumerated type of the command. | |
virtual std::string | to_string () const |
Converts the object to a non-formatted string. | |
Protected Attributes | |
BlockType | type |
Sequence flag. | |
SPtr< List > | commands |
List of commands. |
Class Block represents blocks in the control flow structure.
Blocks differ in their evaluation behavior. For pure blocks a new scope is created for the evaluation. Sequences and quotes are not evaluated in a new scope.
crp::Block::Block | ( | BlockType | type = PURE | ) |
Constructs an empty block with the given type.
type | Type of the block |
Constructs a block with the given commands.
type | Type of the block |
commands | Commands of the block |
virtual crp::Block::~Block | ( | ) | [inline, virtual] |
Virtual destructor.
void crp::Block::add_command | ( | const DPtr & | command | ) | [inline] |
Adds a command to the end of the block.
command | Command to add |
BlockType crp::Block::get_block_type | ( | ) | const [inline] |
Returns the block type.
virtual CommandType crp::Block::get_command_type | ( | ) | const [inline, virtual] |
Returns the block commands.
Returns the block commands.
virtual std::string crp::Block::to_string | ( | ) | const [virtual] |
Converts the object to a non-formatted string.
This method is thought to be used for debugging purposes only.
Reimplemented from crp::Command.
SPtr<List> crp::Block::commands [protected] |
List of commands.
BlockType crp::Block::type [protected] |
Sequence flag.