#include <condition.hh>
Inheritance diagram for lestes::lang::cplus::lex::condition:

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< condition > | create_empty (void) |
| Returns empty condition. | |
| static ptr< condition > | create (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 ©) | |
| Hides copy constructor. | |
| condition & | operator= (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. | |
Represents conditional preprocessor directive for use within condition_stack. Contains location in the source, type and state of processing.
Definition at line 56 of file condition.hh.
Types of conditions.
| 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. |
Definition at line 59 of file condition.hh.
00059 { 00060 //! Empty, bottom stack entry. 00061 COND_EMPTY = 0, 00062 //! Directive #if. 00063 COND_IF = 1, 00064 //! Directive #ifdef. 00065 COND_IFDEF = 2, 00066 //! Directive #ifndef. 00067 COND_IFNDEF = 3, 00068 //! Directive #elif. 00069 COND_ELIF = 4, 00070 //! Directive #else. 00071 COND_ELSE = 5 00072 } type_type;
| 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.
active == true
Definition at line 70 of file condition.cc.
Referenced by create(), and create_empty().
00070 : 00071 type(COND_EMPTY), 00072 waiting(false), 00073 active(true), 00074 location(NULL) 00075 { 00076 }
| 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.
a_condition != COND_EMPTY
| 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. |
Definition at line 55 of file condition.cc.
00055 : 00056 type((lassert(a_type != COND_EMPTY),a_type)), 00057 waiting(a_waiting), 00058 active(a_active), 00059 location(checked(a_location)) 00060 { 00061 }
| lestes::lang::cplus::lex::condition::condition | ( | const condition & | copy | ) | [private] |
Hides copy constructor.
| ptr< source_location > lestes::lang::cplus::lex::condition::location_get | ( | void | ) | const |
Returns location.
Returns the location of usage.
Definition at line 92 of file condition.cc.
References COND_EMPTY, lassert, location, and type.
Referenced by equals().
00093 { 00094 lassert(type != COND_EMPTY); 00095 return location; 00096 }
| condition::type_type lestes::lang::cplus::lex::condition::type_get | ( | void | ) | const |
| bool lestes::lang::cplus::lex::condition::waiting_get | ( | void | ) | const |
Return whether waiting for true branch.
Returns waiting flag.
Definition at line 103 of file condition.cc.
References COND_EMPTY, lassert, type, and waiting.
Referenced by equals().
00104 { 00105 lassert(type != COND_EMPTY); 00106 return waiting; 00107 }
| bool lestes::lang::cplus::lex::condition::active_get | ( | void | ) | const |
Return whether the output was active.
Returns output activity flag.
Definition at line 113 of file condition.cc.
References active.
Referenced by equals().
00114 { 00115 return active; 00116 }
| lstring lestes::lang::cplus::lex::condition::name_get | ( | void | ) | const |
Returns printable name.
Returns printable name of the condition.
Definition at line 123 of file condition.cc.
References COND_EMPTY, condition_name, lassert, and type.
00124 { 00125 lassert(type != COND_EMPTY); 00126 return condition_name[type]; 00127 }
| bool lestes::lang::cplus::lex::condition::equals | ( | const ptr< condition > & | other | ) | const |
Tests equality.
Tests equality to other condition.
| other | The condition to compare with. |
Definition at line 134 of file condition.cc.
References active_get(), COND_EMPTY, lestes::is_equal(), location_get(), type_get(), and waiting_get().
00135 { 00136 type_type t = other->type_get(); 00137 00138 // empty conditions do not have other fields 00139 if (t == COND_EMPTY) return is_equal(type_get(),COND_EMPTY); 00140 00141 return is_equal(type_get(),other->type_get()) && 00142 is_equal(waiting_get(),other->waiting_get()) && 00143 is_equal(active_get(),other->active_get()) && 00144 is_equal(location_get(),other->location_get()); 00145 }
| ptr< condition > lestes::lang::cplus::lex::condition::create_empty | ( | void | ) | [static] |
Returns empty condition.
Returns empty condition, special value to simplify processing.
Definition at line 160 of file condition.cc.
References condition().
Referenced by lestes::lang::cplus::lex::condition_stack::condition_stack().
00161 { 00162 return new condition(); 00163 }
| 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.
| 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. |
Definition at line 173 of file condition.cc.
References condition().
Referenced by lestes::lang::cplus::lex::condition_stack::process().
00174 { 00175 return new condition(a_type,a_waiting,a_active,a_location); 00176 }
| void lestes::lang::cplus::lex::condition::gc_mark | ( | void | ) | [protected, virtual] |
Marks the object.
Marks the object.
Reimplemented from lestes::std::mem::keystone.
Definition at line 150 of file condition.cc.
References lestes::std::mem::keystone::gc_mark(), and location.
00151 { 00152 location.gc_mark(); 00153 ::lestes::std::object::gc_mark(); 00154 }
Hides assignment operator.
Type of the condition.
Definition at line 98 of file condition.hh.
Referenced by location_get(), name_get(), type_get(), and waiting_get().
bool lestes::lang::cplus::lex::condition::waiting [private] |
Waiting for the true branch of conditional.
Definition at line 100 of file condition.hh.
Referenced by waiting_get().
bool lestes::lang::cplus::lex::condition::active [private] |
Output is active after leaving the conditional on this level.
Definition at line 102 of file condition.hh.
Referenced by active_get().
srp<source_location> lestes::lang::cplus::lex::condition::location [private] |
Location of usage.
Definition at line 104 of file condition.hh.
Referenced by gc_mark(), and location_get().
lstring lestes::lang::cplus::lex::condition::condition_name [static, private] |
Initial value:
{
"","#if","#ifdef","#ifndef","#elif","#else"
}
Printable names of the conditions for error reporting.
Definition at line 106 of file condition.hh.
Referenced by name_get().
1.5.1-20070107