#include <veLogic.h>
Public Member Functions | |
Condition (BasePtr condvalue, BasePtr truevalue, BasePtr falsevalue) | |
Basic constructor. | |
Condition (Condition const &other) | |
Copy constructor, will not work with any class except another Condition object. | |
virtual | ~Condition () |
Base * | copy (void) const |
virtual Variant | GetValue () const |
virtual tString | GetString (Base const *other=0) const |
virtual int | GetInt (void) const |
virtual float | GetFloat (void) const |
bool | operator== (Base const &other) const |
compares two values | |
bool | operator!= (Base const &other) const |
compares two values | |
bool | operator>= (Base const &other) const |
compares two values | |
bool | operator<= (Base const &other) const |
compares two values | |
bool | operator> (Base const &other) const |
compares two values | |
bool | operator< (Base const &other) const |
compares two values | |
Protected Member Functions | |
Base const & | GetExpr () const |
Performs the comparison. | |
Private Attributes | |
BasePtr | m_condvalue |
The conditional value. | |
BasePtr | m_truevalue |
The value that is used if the condition is true. | |
BasePtr | m_falsevalue |
The value that is used if the condition is false. |
Definition at line 41 of file veLogic.h.
vValue::Expr::Logic::Condition::Condition | ( | BasePtr | condvalue, | |
BasePtr | truevalue, | |||
BasePtr | falsevalue | |||
) |
Basic constructor.
Constructs a new Condition object with the given parameters
condvalue | the value to be used as the condition | |
truevalue | the value to be used if the condition is true | |
falsevalue | the value to be used if the condition is false |
Definition at line 47 of file veLogic.cpp.
Referenced by copy().
00047 : 00048 m_condvalue (condvalue ), 00049 m_truevalue (truevalue ), 00050 m_falsevalue(falsevalue) 00051 { 00052 }
vValue::Expr::Logic::Condition::Condition | ( | Condition const & | other | ) |
Copy constructor, will not work with any class except another Condition object.
Initializes the Condition object using the information from another one
other | another Condition object |
Definition at line 56 of file veLogic.cpp.
00056 : 00057 Base (other ), 00058 m_condvalue (other.m_condvalue ->copy()), 00059 m_truevalue (other.m_truevalue ->copy()), 00060 m_falsevalue(other.m_falsevalue->copy()) 00061 { }
virtual vValue::Expr::Logic::Condition::~Condition | ( | ) | [inline, virtual] |
Base const & vValue::Expr::Logic::Condition::GetExpr | ( | ) | const [protected] |
Performs the comparison.
Uses a specific type (usually int or float) to perform the comparison
fun | the return value of this function is used for the comparison |
Definition at line 72 of file veLogic.cpp.
References m_condvalue, m_falsevalue, and m_truevalue.
Referenced by GetFloat(), GetInt(), GetString(), GetValue(), operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().
00072 { 00073 bool truth = false; 00074 // In the future, we might want to define some kind of rules for truth 00075 try { 00076 truth = boost::lexical_cast<bool>(m_condvalue->GetValue()); 00077 } 00078 catch(boost::bad_lexical_cast &) { } 00079 return truth ? *m_truevalue : *m_falsevalue; 00080 }
Base * vValue::Expr::Logic::Condition::copy | ( | void | ) | const [virtual] |
Overwritten copy function
Reimplemented from vValue::Expr::Core::Base.
Definition at line 65 of file veLogic.cpp.
References Condition().
00065 { 00066 return new Condition(*this); 00067 }
Variant vValue::Expr::Logic::Condition::GetValue | ( | void | ) | const [virtual] |
Performs the comparison and returns the resulting value
Reimplemented from vValue::Expr::Core::Base.
Definition at line 84 of file veLogic.cpp.
References GetExpr(), and vValue::Expr::Core::Base::GetValue().
00084 { 00085 return GetExpr().GetValue(); 00086 }
tString vValue::Expr::Logic::Condition::GetString | ( | Expr::Base const * | other = 0 |
) | const [virtual] |
Performs the comparison and returns the resulting value
Reimplemented from vValue::Expr::Core::Base.
Definition at line 102 of file veLogic.cpp.
References GetExpr(), and vValue::Expr::Core::Base::GetString().
00102 { 00103 return GetExpr().GetString(other); 00104 }
int vValue::Expr::Logic::Condition::GetInt | ( | void | ) | const [virtual] |
Performs the comparison and returns the resulting value
Reimplemented from vValue::Expr::Core::Base.
Definition at line 90 of file veLogic.cpp.
References GetExpr(), and vValue::Expr::Core::Base::GetInt().
00090 { 00091 return GetExpr().GetInt(); 00092 }
float vValue::Expr::Logic::Condition::GetFloat | ( | void | ) | const [virtual] |
Performs the comparison and returns the resulting value
Reimplemented from vValue::Expr::Core::Base.
Definition at line 96 of file veLogic.cpp.
References GetExpr(), and vValue::Expr::Core::Base::GetFloat().
00096 { 00097 return GetExpr().GetFloat(); 00098 }
bool vValue::Expr::Logic::Condition::operator== | ( | Base const & | other | ) | const [virtual] |
compares two values
Reimplemented from vValue::Expr::Core::Base.
Definition at line 106 of file veLogic.cpp.
References GetExpr().
00106 { return GetExpr() == other; }
bool vValue::Expr::Logic::Condition::operator!= | ( | Base const & | other | ) | const [virtual] |
compares two values
Reimplemented from vValue::Expr::Core::Base.
Definition at line 107 of file veLogic.cpp.
References GetExpr().
00107 { return GetExpr() != other; }
bool vValue::Expr::Logic::Condition::operator>= | ( | Base const & | other | ) | const [virtual] |
compares two values
Reimplemented from vValue::Expr::Core::Base.
Definition at line 108 of file veLogic.cpp.
References GetExpr().
00108 { return GetExpr() >= other; }
bool vValue::Expr::Logic::Condition::operator<= | ( | Base const & | other | ) | const [virtual] |
compares two values
Reimplemented from vValue::Expr::Core::Base.
Definition at line 109 of file veLogic.cpp.
References GetExpr().
00109 { return GetExpr() <= other; }
bool vValue::Expr::Logic::Condition::operator> | ( | Base const & | other | ) | const [virtual] |
compares two values
Reimplemented from vValue::Expr::Core::Base.
Definition at line 110 of file veLogic.cpp.
References GetExpr().
00110 { return GetExpr() > other; }
bool vValue::Expr::Logic::Condition::operator< | ( | Base const & | other | ) | const [virtual] |
compares two values
Reimplemented from vValue::Expr::Core::Base.
Definition at line 111 of file veLogic.cpp.
References GetExpr().
00111 { return GetExpr() < other; }
BasePtr vValue::Expr::Logic::Condition::m_condvalue [private] |
BasePtr vValue::Expr::Logic::Condition::m_truevalue [private] |
BasePtr vValue::Expr::Logic::Condition::m_falsevalue [private] |