ContRap-Core
Public Types | Public Member Functions | Protected Attributes

crp::Conditional Class Reference

Class Conditional represents conditional branches. More...

#include <conditional.h>

Inheritance diagram for crp::Conditional:
crp::Command crp::Object

Public Types

enum  ConditionalType { IF, WHILE, FOR }
 

Enumerates possible block types.

More...

Public Member Functions

 Conditional (ConditionalType type, const DPtr &condition, const DPtr &body, const DPtr &alternative=DPtr::null)
 Constructs a new conditional loop command.
 Conditional (const DPtr &init, const DPtr &condition, const DPtr &increment, const DPtr &body)
 Constructs a new for command.
virtual ~Conditional ()
 Virtual destructor.
ConditionalType get_conditional_type () const
 Returns the type of the conditional statement.
const DPtrget_init () const
 Returns the init code.
const DPtrget_condition () const
 Returns the condition code.
const DPtrget_increment () const
 Returns the increment code.
const DPtrget_body () const
 Returns the body code.
const DPtrget_alternative () const
 Returns the alternative code.
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

ConditionalType type
 Type of the conditional statement.
DPtr init
 List of commands.
DPtr condition
DPtr increment
DPtr body
DPtr alternative

Detailed Description

Class Conditional represents conditional branches.

Conditional branches are if-, while-, and for-statements.


Member Enumeration Documentation

Enumerates possible block types.

Enumerator:
IF 
WHILE 
FOR 

Constructor & Destructor Documentation

crp::Conditional::Conditional ( ConditionalType  type,
const DPtr condition,
const DPtr body,
const DPtr alternative = DPtr::null 
)

Constructs a new conditional loop command.

Parameters:
typeType of the block
crp::Conditional::Conditional ( const DPtr init,
const DPtr condition,
const DPtr increment,
const DPtr body 
)

Constructs a new for command.

Parameters:
typeType of the block
virtual crp::Conditional::~Conditional ( ) [inline, virtual]

Virtual destructor.


Member Function Documentation

const DPtr& crp::Conditional::get_alternative ( ) const [inline]

Returns the alternative code.

Returns:
Alternative code
const DPtr& crp::Conditional::get_body ( ) const [inline]

Returns the body code.

Returns:
Body code
virtual CommandType crp::Conditional::get_command_type ( ) const [inline, virtual]

Returns the enumerated type of the command.

Returns:
Type of the object

Implements crp::Command.

const DPtr& crp::Conditional::get_condition ( ) const [inline]

Returns the condition code.

Returns:
Condition code
ConditionalType crp::Conditional::get_conditional_type ( ) const [inline]

Returns the type of the conditional statement.

Returns:
Type of the statement
const DPtr& crp::Conditional::get_increment ( ) const [inline]

Returns the increment code.

Returns:
Increment code
const DPtr& crp::Conditional::get_init ( ) const [inline]

Returns the init code.

Returns:
Init code
virtual std::string crp::Conditional::to_string ( ) const [virtual]

Converts the object to a non-formatted string.

This method is thought to be used for debugging purposes only.

Returns:
String representation of the object

Reimplemented from crp::Command.


Field Documentation

List of commands.

Type of the conditional statement.


The documentation for this class was generated from the following file: