lestes::lang::cplus::lex::condition Class Reference

Conditional directive. More...

#include <condition.hh>

Inheritance diagram for lestes::lang::cplus::lex::condition:

Inheritance graph
[legend]
List of all members.

Public Types

enum  type_type {
  COND_EMPTY = 0, COND_IF = 1, COND_IFDEF = 2, COND_IFNDEF = 3,
  COND_ELIF = 4, COND_ELSE = 5
}
 Types of conditions. More...

Public Member Functions

ptr< source_location > location_get (void) const
 Returns location.
type_type type_get (void) const
 Returns type.
bool waiting_get (void) const
 Return whether waiting for true branch.
bool active_get (void) const
 Return whether the output was active.
lstring name_get (void) const
 Returns printable name.
bool equals (const ptr< condition > &other) const
 Tests equality.

Static Public Member Functions

static ptr< conditioncreate_empty (void)
 Returns empty condition.
static ptr< conditioncreate (type_type a_cond, bool a_waitning, bool a_active, const ptr< source_location > &a_location)
 Returns condition.

Protected Member Functions

 condition (void)
 Creates empty condition.
 condition (type_type a_cond, bool a_waitning, bool a_active, const ptr< source_location > &a_location)
 Creates new condition.
virtual void gc_mark (void)
 Marks the object.

Private Member Functions

 condition (const condition &copy)
 Hides copy constructor.
conditionoperator= (const condition &rhs)
 Hides assignment operator.

Private Attributes

type_type type
 Type of the condition.
bool waiting
 Waiting for the true branch of conditional.
bool active
 Output is active after leaving the conditional on this level.
srp< source_location > location
 Location of usage.

Static Private Attributes

static lstring condition_name []
 Names of the conditions.

Detailed Description

Conditional directive.

Represents conditional preprocessor directive for use within condition_stack. Contains location in the source, type and state of processing.


Member Enumeration Documentation

enum lestes::lang::cplus::lex::condition::type_type

Types of conditions.

Enumerator:
COND_EMPTY  Empty, bottom stack entry.
COND_IF  Directive if.
COND_IFDEF  Directive ifdef.
COND_IFNDEF  Directive ifndef.
COND_ELIF  Directive elif.
COND_ELSE  Directive else.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::condition::condition ( void   )  [protected]

Creates empty condition.

Creates empty condition, special value to simplify processing. Properties do not have any meaning for this value.

Postcondition:
type_get() == condition::COND_EMPTY

active == true

Returns:
New empty condition.

lestes::lang::cplus::lex::condition::condition ( type_type  a_type,
bool  a_waiting,
bool  a_active,
const ptr< source_location > &  a_location 
) [protected]

Creates new condition.

Creates new condition, initializes with type and properties.

Precondition:
a_location != NULL

a_condition != COND_EMPTY

Parameters:
a_location The location of usage.
a_type The condition type.
a_waiting Flag set when waiting for the true branch.
a_active Flag set when the output was active in the level before this condition.
Returns:
New condition with given properties.

lestes::lang::cplus::lex::condition::condition ( const condition copy  )  [private]

Hides copy constructor.


Member Function Documentation

ptr< source_location > lestes::lang::cplus::lex::condition::location_get ( void   )  const

Returns location.

Returns the location of usage.

Precondition:
type != COND_EMPTY
Returns:
The usage source_location.

condition::type_type lestes::lang::cplus::lex::condition::type_get ( void   )  const

Returns type.

Returns type of the condition.

Returns:
The type of the condition.

bool lestes::lang::cplus::lex::condition::waiting_get ( void   )  const

Return whether waiting for true branch.

Returns waiting flag.

Precondition:
type != COND_EMPTY
Returns:
true If waiting for true branch of the condition.

bool lestes::lang::cplus::lex::condition::active_get ( void   )  const

Return whether the output was active.

Returns output activity flag.

Returns:
true If output is active in the previous level of conditionals.

lstring lestes::lang::cplus::lex::condition::name_get ( void   )  const

Returns printable name.

Returns printable name of the condition.

Precondition:
type != COND_EMPTY
Returns:
The name to be used in error messages.

bool lestes::lang::cplus::lex::condition::equals ( const ptr< condition > &  other  )  const

Tests equality.

Tests equality to other condition.

Parameters:
other The condition to compare with.
Returns:
true If both objects represent the same condition.

ptr< condition > lestes::lang::cplus::lex::condition::create_empty ( void   )  [static]

Returns empty condition.

Returns empty condition, special value to simplify processing.

Returns:
New empty condition.

ptr< condition > lestes::lang::cplus::lex::condition::create ( type_type  a_type,
bool  a_waiting,
bool  a_active,
const ptr< source_location > &  a_location 
) [static]

Returns condition.

Returns new condition, initializes with type and properties.

Parameters:
a_type The condition type.
a_waiting Flag set when waiting for the true branch.
a_active Flag set when the output was active in the level before this condition.
a_location The location of usage.
Returns:
New condition with given properties.

void lestes::lang::cplus::lex::condition::gc_mark ( void   )  [protected, virtual]

Marks the object.

Marks the object.

Reimplemented from lestes::std::mem::keystone.

condition& lestes::lang::cplus::lex::condition::operator= ( const condition rhs  )  [private]

Hides assignment operator.


Member Data Documentation

type_type lestes::lang::cplus::lex::condition::type [private]

Type of the condition.

bool lestes::lang::cplus::lex::condition::waiting [private]

Waiting for the true branch of conditional.

bool lestes::lang::cplus::lex::condition::active [private]

Output is active after leaving the conditional on this level.

srp<source_location> lestes::lang::cplus::lex::condition::location [private]

Location of usage.

lstring lestes::lang::cplus::lex::condition::condition_name [static, private]

Initial value:

 {
        "","#if","#ifdef","#ifndef","#elif","#else"
}
Names of the conditions.

Printable names of the conditions for error reporting.


The documentation for this class was generated from the following files:
Generated on Mon Feb 12 18:43:38 2007 for lestes by doxygen 1.5.1-20070107