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

#include <sqratObject.h>

Inheritance diagram for Sqrat::Object:
Sqrat::ArrayBase Sqrat::Class< C, A > Sqrat::Enumeration Sqrat::Script Sqrat::TableBase Sqrat::Array Sqrat::DerivedClass< C, B, A > Sqrat::ConstTable Sqrat::RegistryTable Sqrat::RootTable Sqrat::Table

Classes

struct  iterator
 Iterator for going over the slots in the object using Object::Next. More...
 

Public Member Functions

 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 classes that represent Squirrel objects

Remarks
All Object and derived classes MUST be destroyed before calling sq_close or your application will crash when exiting.

Constructor & Destructor Documentation

Sqrat::Object::Object ( )
inline

Default constructor (null)

Sqrat::Object::Object ( const Object so)
inline

Copy constructor

Parameters
soObject to copy
Sqrat::Object::Object ( HSQOBJECT  o,
HSQUIRRELVM  v = DefaultVM::Get() 
)
inline

Constructs an Object from a Squirrel object

Parameters
oSquirrel object
vVM that the object will exist in
template<class T >
Sqrat::Object::Object ( T *  instance,
HSQUIRRELVM  v = DefaultVM::Get() 
)
inline

Constructs an Object from a C++ instance

Parameters
instancePointer to a C++ class instance that has been bound already
vVM that the object will exist in
Template Parameters
TType of instance
virtual Sqrat::Object::~Object ( )
inlinevirtual

Destructor

Member Function Documentation

template<class T >
T Sqrat::Object::Cast ( ) const
inline

Casts the object to a certain C++ type

Template Parameters
TType to cast to
Returns
A copy of the value of the Object with the given type
Remarks
This function MUST have its Error handled if it occurred.
virtual HSQOBJECT Sqrat::Object::GetObject ( ) const
inlinevirtual

Gets the Squirrel object for this Object (copy)

Returns
Squirrel object

Reimplemented in Sqrat::Class< C, A >.

virtual HSQOBJECT& Sqrat::Object::GetObject ( )
inlinevirtual

Gets the Squirrel object for this Object (reference)

Returns
Squirrel object

Reimplemented in Sqrat::Class< C, A >.

SQInteger Sqrat::Object::GetSize ( ) const
inline

Returns the size of the Object

Returns
Size of Object
Object Sqrat::Object::GetSlot ( const SQChar *  slot) const
inline

Attempts to get the value of a slot from the object

Parameters
slotName of the slot
Returns
An Object representing the value of the slot (can be a null object if nothing was found)
Object Sqrat::Object::GetSlot ( SQInteger  index) const
inline

Attempts to get the value of an index from the object

Parameters
indexIndex of the slot
Returns
An Object representing the value of the slot (can be a null object if nothing was found)
SQObjectType Sqrat::Object::GetType ( ) const
inline

Gets the type of the Object as defined by the Squirrel API

Returns
SQObjectType for the Object
HSQUIRRELVM& Sqrat::Object::GetVM ( )
inline

Gets the Squirrel VM for this Object (reference)

Returns
Squirrel VM associated with the Object
HSQUIRRELVM Sqrat::Object::GetVM ( ) const
inline

Gets the Squirrel VM for this Object (copy)

Returns
Squirrel VM associated with the Object
bool Sqrat::Object::IsNull ( ) const
inline

Checks whether the Object is null

Returns
True if the Object currently has a null value, otherwise false
bool Sqrat::Object::Next ( iterator iter) const
inline

Used to go through all the slots in an Object (same limitations as sq_next)

Parameters
iterAn iterator being used for going through the slots
Returns
Whether there is a next slot
Sqrat::Object::operator HSQOBJECT & ( )
inline

Allows the Object to be inputted directly into places that expect a HSQOBJECT

Object& Sqrat::Object::operator= ( const Object so)
inline

Assignment operator

Parameters
soObject to copy
Returns
The Object itself
template<class T >
Object Sqrat::Object::operator[] ( slot)
inline

Allows Object to be used like C++ arrays with the [] operator

Parameters
slotThe slot key
Template Parameters
TType of the slot key (usually doesnt need to be defined explicitly)
Returns
An Object representing the value of the slot (can be a null object if nothing was found)
void Sqrat::Object::Release ( )
inline

Sets the Object to null (removing its references to underlying Squirrel objects)


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