sqrat  0.9
sqrat
 All Classes Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
Sqrat::ArrayBase Class Reference

The base class for Array that implements almost all of its functionality. More...

#include <sqratArray.h>

Inheritance diagram for Sqrat::ArrayBase:
Sqrat::Object Sqrat::Array

Public Member Functions

 ArrayBase (HSQUIRRELVM v=DefaultVM::Get())
 
 ArrayBase (const Object &obj)
 
 ArrayBase (HSQOBJECT o, HSQUIRRELVM v=DefaultVM::Get())
 
void Bind (const SQInteger index, Object &obj)
 
ArrayBaseSquirrelFunc (const SQInteger index, SQFUNCTION func)
 
template<class V >
ArrayBaseSetValue (const SQInteger index, const V &val)
 
template<class V >
ArrayBaseSetInstance (const SQInteger index, V *val)
 
template<class F >
ArrayBaseFunc (const SQInteger index, F method)
 
template<typename T >
SharedPtr< T > GetValue (int index)
 
Function GetFunction (const SQInteger index)
 
template<typename T >
void GetArray (T *array, int size)
 
template<class V >
ArrayBaseAppend (const V &val)
 
template<class V >
ArrayBaseAppend (V *val)
 
template<class V >
ArrayBaseInsert (const SQInteger destpos, const V &val)
 
template<class V >
ArrayBaseInsert (const SQInteger destpos, V *val)
 
Object Pop ()
 
ArrayBaseRemove (const SQInteger itemidx)
 
ArrayBaseResize (const SQInteger newsize)
 
ArrayBaseReverse ()
 
SQInteger Length () const
 
- Public Member Functions inherited from Sqrat::Object
 Object ()
 
 Object (const Object &so)
 
 Object (HSQOBJECT o, HSQUIRRELVM v=DefaultVM::Get())
 
template<class T >
 Object (T *instance, HSQUIRRELVM v=DefaultVM::Get())
 
virtual ~Object ()
 
Objectoperator= (const Object &so)
 
HSQUIRRELVM & GetVM ()
 
HSQUIRRELVM GetVM () const
 
SQObjectType GetType () const
 
bool IsNull () const
 
virtual HSQOBJECT GetObject () const
 
virtual HSQOBJECT & GetObject ()
 
 operator HSQOBJECT & ()
 
void Release ()
 
Object GetSlot (const SQChar *slot) const
 
Object GetSlot (SQInteger index) const
 
template<class T >
Cast () const
 
template<class T >
Object operator[] (T slot)
 
SQInteger GetSize () const
 
bool Next (iterator &iter) const
 

Detailed Description

The base class for Array that implements almost all of its functionality.

Constructor & Destructor Documentation

Sqrat::ArrayBase::ArrayBase ( HSQUIRRELVM  v = DefaultVM::Get())
inline

Default constructor (null)

Parameters
vVM that the array will exist in
Sqrat::ArrayBase::ArrayBase ( const Object obj)
inline

Construct the ArrayBase from an Object that already exists

Parameters
objAn Object that should already represent a Squirrel array
Sqrat::ArrayBase::ArrayBase ( HSQOBJECT  o,
HSQUIRRELVM  v = DefaultVM::Get() 
)
inline

Construct the ArrayBase from a HSQOBJECT and HSQUIRRELVM that already exist

Parameters
oSquirrel object that should already represent a Squirrel array
vSquirrel VM that contains the Squirrel object given

Member Function Documentation

template<class V >
ArrayBase& Sqrat::ArrayBase::Append ( const V &  val)
inline

Appends a value to the end of the Array

Parameters
valValue that is being placed in the Array
Template Parameters
VType of value (usually doesnt need to be defined explicitly)
Returns
The Array itself so the call can be chained
template<class V >
ArrayBase& Sqrat::ArrayBase::Append ( V *  val)
inline

Appends an instance to the end of the Array (like a reference)

Parameters
valPointer to the instance that is being placed in the Array
Template Parameters
VType of instance (usually doesnt need to be defined explicitly)
Returns
The Array itself so the call can be chained
void Sqrat::ArrayBase::Bind ( const SQInteger  index,
Object obj 
)
inline

Binds a Table or Class to the Array (can be used to facilitate namespaces)

Parameters
indexThe index in the array being assigned a Table or Class
objTable or Class that is being placed in the Array
Remarks
Bind cannot be called "inline" like other functions because it introduces order-of-initialization bugs.
template<class F >
ArrayBase& Sqrat::ArrayBase::Func ( const SQInteger  index,
method 
)
inline

Sets an index in the Array to a specific function

Parameters
indexThe index in the array being assigned a value
methodFunction that is being placed in the Array
Template Parameters
FType of function (only define this if you need to choose a certain template specialization or overload)
Returns
The Array itself so the call can be chained
template<typename T >
void Sqrat::ArrayBase::GetArray ( T *  array,
int  size 
)
inline

Fills a C array with the elements of the Array

Parameters
arrayC array to be filled
sizeThe amount of elements to fill the C array with
Template Parameters
TType of elements (fails if any elements in Array are not of this type)
Remarks
This function MUST have its Error handled if it occurred.
Function Sqrat::ArrayBase::GetFunction ( const SQInteger  index)
inline

Gets a Function from an index in the Array

Parameters
indexThe index in the array that contains the Function
Returns
Function found in the Array (null if failed)
template<typename T >
SharedPtr<T> Sqrat::ArrayBase::GetValue ( int  index)
inline

Returns the element at a given index

Parameters
indexIndex of the element
Template Parameters
TType of element (fails if element is not of this type)
Returns
SharedPtr containing the element (or null if failed)
Remarks
This function MUST have its Error handled if it occurred.
template<class V >
ArrayBase& Sqrat::ArrayBase::Insert ( const SQInteger  destpos,
const V &  val 
)
inline

Inserts a value in a position in the Array

Parameters
destposIndex to put the new value in
valValue that is being placed in the Array
Template Parameters
VType of value (usually doesnt need to be defined explicitly)
Returns
The Array itself so the call can be chained
template<class V >
ArrayBase& Sqrat::ArrayBase::Insert ( const SQInteger  destpos,
V *  val 
)
inline

Inserts an instance in a position in the Array (like a reference)

Parameters
destposIndex to put the new value in
valPointer to the instance that is being placed in the Array
Template Parameters
VType of instance (usually doesnt need to be defined explicitly)
Returns
The Array itself so the call can be chained
SQInteger Sqrat::ArrayBase::Length ( ) const
inline

Returns the length of the Array

Returns
Length in number of elements
Object Sqrat::ArrayBase::Pop ( )
inline

Removes the last element from the Array

Returns
Object for the element that was removed (null if failed)
ArrayBase& Sqrat::ArrayBase::Remove ( const SQInteger  itemidx)
inline

Removes an element at a specific index from the Array

Parameters
itemidxIndex of the element being removed
Returns
The Array itself so the call can be chained
ArrayBase& Sqrat::ArrayBase::Resize ( const SQInteger  newsize)
inline

Resizes the Array

Parameters
newsizeDesired size of the Array in number of elements
Returns
The Array itself so the call can be chained
ArrayBase& Sqrat::ArrayBase::Reverse ( )
inline

Reverses the elements of the array in place

Returns
The Array itself so the call can be chained
template<class V >
ArrayBase& Sqrat::ArrayBase::SetInstance ( const SQInteger  index,
V *  val 
)
inline

Sets an index in the Array to a specific instance (like a reference)

Parameters
indexThe index in the array being assigned a value
valPointer to the instance that is being placed in the Array
Template Parameters
VType of instance (usually doesnt need to be defined explicitly)
Returns
The Array itself so the call can be chained
template<class V >
ArrayBase& Sqrat::ArrayBase::SetValue ( const SQInteger  index,
const V &  val 
)
inline

Sets an index in the Array to a specific value

Parameters
indexThe index in the array being assigned a value
valValue that is being placed in the Array
Template Parameters
VType of value (usually doesnt need to be defined explicitly)
Returns
The Array itself so the call can be chained
ArrayBase& Sqrat::ArrayBase::SquirrelFunc ( const SQInteger  index,
SQFUNCTION  func 
)
inline

Binds a raw Squirrel closure to the Array

Parameters
indexThe index in the array being assigned a function
funcSquirrel function that is being placed in the Array
Returns
The Array itself so the call can be chained

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