Variable Class Reference

Accesser (getter and setter) for a value. More...

#include <variable.h>

List of all members.

Public Member Functions

 Variable ()
 Construct an undefined variable.
 Variable (VariableImplementation *implementation, bool modifiable)
 Construct a variable.
void setValue (const Variant &value)
 Set the value of the variable.
Variant value () const
 (Not yet in use) Get the value of the variable
Variable field (const Variant &key, bool modifable=false)
 (Not yet in use) Get field by key
void setField (const Variant &key, const Variable &variable)
 Set field by key.
void setConstant ()
 Set the variable as constant which prevents modification of the value.
bool isDefined () const
 Check if the variable not been constructed by the default constructor.
void inPlaceCopy (bool modifiable=true)
 Transform the varaible into a simple copy of its current value.

Static Public Member Functions

static Variable copy (const Variant &value, bool modifiable=true)
 Construct a variable copying and then owning a value.
static Variable ref (Variant &value, bool modifiable=true)
 Construct a variable referencing a value (modifiable or constant reference)
static Variable constRef (const Variant &value)
 Construct a variable referencing a value (always constant reference)
static Variable nullConstant ()
 Construct a variable referencing the null constant (HMDL's NULL)

Detailed Description

Accesser (getter and setter) for a value.

The variable can also be constant or modifiable. When the variable is constant and the setter is used then the variable will be transformed into a copy of the current value

A variable owns a variable implementation that actually define the getter and setter for the variable. Common implementations can be used via the static constructors: copy, ref, constRef, null and nullConstant.


Constructor & Destructor Documentation

Construct an undefined variable.

Variable::Variable ( VariableImplementation implementation,
bool  modifiable 
)

Construct a variable.

Parameters:
implementationMust be a new created instance of a subclass of variable implementation
modifiable

Member Function Documentation

static Variable Variable::constRef ( const Variant value) [static]

Construct a variable referencing a value (always constant reference)

static Variable Variable::copy ( const Variant value,
bool  modifiable = true 
) [static]

Construct a variable copying and then owning a value.

Variable Variable::field ( const Variant key,
bool  modifable = false 
)

(Not yet in use) Get field by key

Parameters:
key
modifableSet to true if the returned variable will used as left-value
void Variable::inPlaceCopy ( bool  modifiable = true)

Transform the varaible into a simple copy of its current value.

bool Variable::isDefined ( ) const

Check if the variable not been constructed by the default constructor.

static Variable Variable::nullConstant ( ) [static]

Construct a variable referencing the null constant (HMDL's NULL)

static Variable Variable::ref ( Variant value,
bool  modifiable = true 
) [static]

Construct a variable referencing a value (modifiable or constant reference)

Set the variable as constant which prevents modification of the value.

void Variable::setField ( const Variant key,
const Variable variable 
)

Set field by key.

void Variable::setValue ( const Variant value)

Set the value of the variable.

(Not yet in use) Get the value of the variable


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