TorqueScript  0.2
Public Member Functions | List of all members
TorqueScript::StoredValue Class Reference

Storage class used to keep variable values in-memory of arbitrary data types. The data types supported as integers, floats and strings (via string ID table references). More...

#include <storedvalue.hpp>

Public Member Functions

 StoredValue (void *memoryLocation, const MemoryReferenceType type)
 
 StoredValue (const int value)
 
 StoredValue (const float value)
 
 StoredValue (const std::size_t value, const StoredValueType type)
 
 StoredValue (std::shared_ptr< ConsoleObject > object, const std::size_t field)
 
StoredValue getReferencedValueCopy (std::shared_ptr< ExecutionState > state)
 
bool isInteger (std::shared_ptr< ExecutionState > state)
 
bool setValue (StoredValue newValue, std::shared_ptr< ExecutionState > state)
 Sets the value of this object. Only has an effect if this object is a reference to a local or global variable. More...
 
std::string getRepresentation ()
 
Value Retrieval

These functions are used to retrieve the data stored in this object.

int toInteger (std::shared_ptr< ExecutionState > state)
 
float toFloat (std::shared_ptr< ExecutionState > state)
 Converts the value in question to a native floating point type. More...
 
std::string toString (std::shared_ptr< ExecutionState > state)
 Converts the value in question to a native sting type. More...
 
bool toBoolean (std::shared_ptr< ExecutionState > state)
 
std::shared_ptr< ConsoleObjecttoConsoleObject (std::shared_ptr< ExecutionState > state)
 

Detailed Description

Storage class used to keep variable values in-memory of arbitrary data types. The data types supported as integers, floats and strings (via string ID table references).

Member Function Documentation

◆ setValue()

bool TorqueScript::StoredValue::setValue ( StoredValue  newValue,
std::shared_ptr< ExecutionState state 
)

Sets the value of this object. Only has an effect if this object is a reference to a local or global variable.

Parameters
newValueThe new value to set.
stateThe execution state this assignment is taking place in.
Returns
True if an assignment has taken place. False otherwise.

◆ toFloat()

float TorqueScript::StoredValue::toFloat ( std::shared_ptr< ExecutionState state)

Converts the value in question to a native floating point type.

Parameters
scopeThe execution scope within which this conversion is occurring.
Returns
A floating point representation of this value.

◆ toString()

std::string TorqueScript::StoredValue::toString ( std::shared_ptr< ExecutionState state)

Converts the value in question to a native sting type.

Parameters
scopeThe execution scope within which this conversion is occurring.
Returns
A string representation of this value.

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