V-Gears 0
Free Final Fantasy VII engine.
Value Class Referenceabstract

Class representing a value (stack entry, parameter, etc.) More...

#include <Value.h>

Inheritance diagram for Value:
Collaboration diagram for Value:

Public Member Functions

virtual ~Value ()
 Destructor. More...
 
virtual bool IsInteger ()
 Return whether or not the Value is an integer. More...
 
virtual bool IsAddress ()
 Return whether or not the Value is an address. More...
 
virtual bool IsSignedValue ()
 Returns whether or not any stored integer value is signed. More...
 
virtual int32 GetSigned ()
 Retrieves a signed integer representing the value, if possible. More...
 
virtual uint32 GetUnsigned ()
 Retrieves an unsigned integer representing the value, if possible. More...
 
virtual std::ostream & Print (std::ostream &output) const =0
 Print the value to a stream. More...
 
virtual std::string GetString () const
 Retrieves the string representation of the value. More...
 
virtual ValuePtr Dup (std::ostream &output)
 Duplicates a value. More...
 
virtual ValuePtr Negate ()
 Negates a value. More...
 
virtual int GetPrecedence () const
 Operator precedence for this value. More...
 

Friends

std::ostream & operator<< (std::ostream &output, Value *value)
 Output a value to a stream. More...
 

Additional Inherited Members

- Protected Member Functions inherited from RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 

Detailed Description

Class representing a value (stack entry, parameter, etc.)

Constructor & Destructor Documentation

◆ ~Value()

Value::~Value ( )
virtual

Destructor.

Member Function Documentation

◆ Dup()

ValuePtr Value::Dup ( std::ostream &  output)
virtual

Duplicates a value.

Parameters
[out]outputThe stream to output any necessary assignment.
Returns
A Value corresponding to a duplicate of this entry.

Reimplemented in IntValue, AddressValue, RelAddressValue, and DupValue.

◆ GetPrecedence()

int Value::GetPrecedence ( ) const
virtual

Operator precedence for this value.

Lower values bind stronger, i.e. they are resolved earlier. If an operand has a higher precedence value than the operator, parentheses are not required for that operand.

Returns
The order of precedence.

Reimplemented in BinaryOpValue, and UnaryOpValue.

◆ GetSigned()

int32 Value::GetSigned ( )
virtual

Retrieves a signed integer representing the value, if possible.

Returns
A signed integer representing the value, if possible.
Exceptions
WrongTypeExceptionif the value is not an integer.

Reimplemented in IntValue, and AddressValue.

◆ GetString()

std::string Value::GetString ( ) const
virtual

Retrieves the string representation of the value.

Returns
The string representation of the value.

◆ GetUnsigned()

uint32 Value::GetUnsigned ( )
virtual

Retrieves an unsigned integer representing the value, if possible.

Returns
An unsigned integer representing the value, if possible.
Exceptions
WrongTypeExceptionif the value is not an integer.

Reimplemented in IntValue, and RelAddressValue.

◆ IsAddress()

bool Value::IsAddress ( )
virtual

Return whether or not the Value is an address.

Returns
True if the Value is an address, otherwise false.

Reimplemented in AddressValue, and RelAddressValue.

◆ IsInteger()

bool Value::IsInteger ( )
virtual

Return whether or not the Value is an integer.

Returns
True if the Value is an integer, otherwise false.

Reimplemented in IntValue.

◆ IsSignedValue()

bool Value::IsSignedValue ( )
virtual

Returns whether or not any stored integer value is signed.

Returns
True if the integer value is signed, false if it is not.
Exceptions
WrongTypeExceptionif the value is not an integer.

Reimplemented in IntValue.

◆ Negate()

ValuePtr Value::Negate ( )
virtual

Negates a value.

Returns
The current Value, negated.
Exceptions
WrongTypeExceptionif negation is not possible.

Reimplemented in BinaryOpValue, and NegatedValue.

◆ Print()

virtual std::ostream & Value::Print ( std::ostream &  output) const
pure virtual

Print the value to a stream.

Parameters
[out]outputThe stream to write to.
Returns
The stream used for output.

Implemented in IntValue, AddressValue, RelAddressValue, DupValue, StringValue, UnquotedStringValue, VarValue, ArrayValue, BinaryOpValue, UnaryOpValue, and CallValue.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  output,
Value value 
)
friend

Output a value to a stream.

Parameters
[out]outputThe stream to output to.
[in]valueReference counted pointer to the value to output.
Returns
The stream used for output.

The documentation for this class was generated from the following files: