Semantic information object for arithmetic constants.
More...
#include <Puma/CConstant.h>
List of all members.
Detailed Description
Semantic information object for arithmetic constants.
Constructor & Destructor Documentation
Constructor.
- Parameters:
-
v | The value. |
t | The type of the value. |
Constructor.
- Parameters:
-
v | The value. |
t | The type of the value. |
Puma::CConstant::CConstant |
( |
long double |
v, |
|
|
CTypeInfo * |
t |
|
) |
| [inline] |
Constructor.
- Parameters:
-
v | The value. |
t | The type of the value. |
virtual Puma::CConstant::~CConstant |
( |
| ) |
[inline, virtual] |
Member Function Documentation
Cast the value to the given type.
- Parameters:
-
t | The type to which to cast. |
- Returns:
- A new object with the casted value. Has to be destroyed by the caller.
CConstant* Puma::CConstant::compute |
( |
int |
oper | ) |
const |
Compute the resulting value when applying the given unary operator to the value.
- Parameters:
-
oper | The operator to apply to the value (token type). |
- Returns:
- A new object with the computed value. Has to be destroyed by the caller.
Compute the resulting value when applying the given binary operator to this and the given value.
- Parameters:
-
oper | The operator to apply to the values (token type). |
v | The other operand to the operator. |
- Returns:
- A new object with the computed value. Has to be destroyed by the caller.
CConstant* Puma::CConstant::Constant |
( |
| ) |
const [inline, virtual] |
long double Puma::CConstant::convert_to_float |
( |
| ) |
const |
Convert the value to floating point.
LONG_LONG Puma::CConstant::convert_to_int |
( |
| ) |
const |
Convert the value to a signed integer.
Convert the value to an unsiged integer.
CConstant* Puma::CConstant::duplicate |
( |
| ) |
const |
Duplicate this.
- Returns:
- A newly allocated duplicate of this. Has to be destroyed by the caller.
bool Puma::CConstant::isFloat |
( |
| ) |
const [inline] |
Check is the value is a floating point value.
bool Puma::CConstant::isNegative |
( |
| ) |
const |
Check if the value is negative (< 0).
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::isSigned |
( |
| ) |
const [inline] |
Check if the value is signed.
bool Puma::CConstant::isUnsigned |
( |
| ) |
const [inline] |
Check if the value is unsigned.
bool Puma::CConstant::operator!= |
( |
const CConstant & |
c | ) |
const |
Compare the value of this and the given constant.
Does not compare the types.
- Parameters:
-
c | The value to compare to. |
- Returns:
- True if the values are not equal.
bool Puma::CConstant::operator== |
( |
const CConstant & |
c | ) |
const |
Compare the value of this and the given constant.
Does not compare the types.
- Parameters:
-
c | The value to compare to. |
- Returns:
- True if the values are equal.
virtual void Puma::CConstant::print |
( |
ostream & |
out | ) |
const [virtual] |
Print the value on the given output stream.
- Parameters:
-
Implements Puma::CExprValue.