| Puma Reference Manual | Puma: Puma::CConstant Class Reference |
#include <Puma/CConstant.h>

Public Member Functions | |
| CConstant (LONG_LONG v, CTypeInfo *t) | |
| Constructor. | |
| CConstant (U_LONG_LONG v, CTypeInfo *t) | |
| Constructor. | |
| CConstant (long double v, CTypeInfo *t) | |
| Constructor. | |
| virtual | ~CConstant () |
| Destructor. | |
| CConstant * | cast_to (CTypeInfo *t) const |
| Cast the value to the given type. | |
| CConstant * | compute (int oper) const |
| Compute the resulting value when applying the given unary operator to the value. | |
| CConstant * | compute (int oper, const CConstant *v) const |
| Compute the resulting value when applying the given binary operator to this and the given value. | |
| LONG_LONG | convert_to_int () const |
| Convert the value to a signed integer. | |
| U_LONG_LONG | convert_to_uint () const |
| Convert the value to an unsiged integer. | |
| long double | convert_to_float () const |
| Convert the value to floating point. | |
| CConstant * | Constant () const |
| Get this. | |
| CConstant * | duplicate () const |
| Duplicate this. | |
| bool | operator== (const CConstant &c) const |
| Compare the value of this and the given constant. | |
| bool | operator!= (const CConstant &c) const |
| Compare the value of this and the given constant. | |
| bool | isNull () const |
| Check if the constant value is 0, regardless of the type. | |
| bool | isPositive () const |
| Check if the value is positive (>= 0). | |
| bool | isNegative () const |
| Check if the value is negative (< 0). | |
| bool | isSigned () const |
| Check if the value is signed. | |
| bool | isUnsigned () const |
| Check if the value is unsigned. | |
| bool | isFloat () const |
| Check is the value is a floating point value. | |
| virtual void | print (ostream &out) const |
| Print the value on the given output stream. | |
Classes | |
| union | Value |
Constructor.
| v | The value. | |
| t | The type of the value. |
| Puma::CConstant::CConstant | ( | U_LONG_LONG | v, | |
| CTypeInfo * | t | |||
| ) | [inline] |
Constructor.
| v | The value. | |
| t | The type of the value. |
| Puma::CConstant::CConstant | ( | long double | v, | |
| CTypeInfo * | t | |||
| ) | [inline] |
Constructor.
| v | The value. | |
| t | The type of the value. |
| virtual Puma::CConstant::~CConstant | ( | ) | [inline, virtual] |
Destructor.
Cast the value to the given type.
| t | The type to which to cast. |
| CConstant* Puma::CConstant::compute | ( | int | oper | ) | const |
Compute the resulting value when applying the given unary operator to the value.
| oper | The operator to apply to the value (token type). |
Compute the resulting value when applying the given binary operator to this and the given value.
| oper | The operator to apply to the values (token type). | |
| v | The other operand to the operator. |
| LONG_LONG Puma::CConstant::convert_to_int | ( | ) | const |
Convert the value to a signed integer.
| U_LONG_LONG Puma::CConstant::convert_to_uint | ( | ) | const |
Convert the value to an unsiged integer.
| long double Puma::CConstant::convert_to_float | ( | ) | const |
Convert the value to floating point.
| CConstant* Puma::CConstant::Constant | ( | ) | const [inline, virtual] |
| CConstant* Puma::CConstant::duplicate | ( | ) | const |
Duplicate this.
| bool Puma::CConstant::operator== | ( | const CConstant & | c | ) | const |
Compare the value of this and the given constant.
Does not compare the types.
| c | The value to compare to. |
| bool Puma::CConstant::operator!= | ( | const CConstant & | c | ) | const |
Compare the value of this and the given constant.
Does not compare the types.
| c | The value to compare to. |
| bool Puma::CConstant::isNull | ( | ) | const |
Check if the constant value is 0, regardless of the type.
| bool Puma::CConstant::isPositive | ( | ) | const |
Check if the value is positive (>= 0).
| bool Puma::CConstant::isNegative | ( | ) | const |
Check if the value is negative (< 0).
| bool Puma::CConstant::isSigned | ( | ) | const [inline] |
Check if the value is signed.
| bool Puma::CConstant::isUnsigned | ( | ) | const [inline] |
Check if the value is unsigned.
| bool Puma::CConstant::isFloat | ( | ) | const [inline] |
Check is the value is a floating point value.
| virtual void Puma::CConstant::print | ( | ostream & | out | ) | const [virtual] |
Print the value on the given output stream.
| out | The output stream. |
Implements Puma::CExprValue.