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

#include <sqratConst.h>

Inheritance diagram for Sqrat::Enumeration:
Sqrat::Object Sqrat::ConstTable

Public Member Functions

 Enumeration (HSQUIRRELVM v=DefaultVM::Get(), bool createTable=true)
 
virtual EnumerationConst (const SQChar *name, const int val)
 
virtual EnumerationConst (const SQChar *name, const float val)
 
virtual EnumerationConst (const SQChar *name, const SQChar *val)
 
- 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

Facilitates exposing a C++ enumeration to Squirrel

Remarks
The Enumeration class only facilitates binding C++ enumerations that contain only integers, floats, and strings because the Squirrel constant table can only contain these types of values. Other types of enumerations can be bound using Class::SetStaticValue instead.

Constructor & Destructor Documentation

Sqrat::Enumeration::Enumeration ( HSQUIRRELVM  v = DefaultVM::Get(),
bool  createTable = true 
)
inline

Constructs the Enumeration object

An Enumeration object doesnt do anything on its own. It must be told what constant values it contains. This is done using Enumeration::Const. Then the Enumeration must be exposed to Squirrel. This is done by calling ConstTable::Enum with the Enumeration.

Parameters
vSquirrel virtual machine to create the Enumeration for
createTableWhether the underlying table that values are bound to is created by the constructor

Member Function Documentation

virtual Enumeration& Sqrat::Enumeration::Const ( const SQChar *  name,
const int  val 
)
inlinevirtual

Binds an enumeration value

Parameters
nameName of the value as it will appear in Squirrel
valValue to bind
Returns
The Enumeration itself so the call can be chained

Reimplemented in Sqrat::ConstTable.

virtual Enumeration& Sqrat::Enumeration::Const ( const SQChar *  name,
const float  val 
)
inlinevirtual

Binds an enumeration value

Parameters
nameName of the value as it will appear in Squirrel
valValue to bind
Returns
The Enumeration itself so the call can be chained

Reimplemented in Sqrat::ConstTable.

virtual Enumeration& Sqrat::Enumeration::Const ( const SQChar *  name,
const SQChar *  val 
)
inlinevirtual

Binds an enumeration value

Parameters
nameName of the value as it will appear in Squirrel
valValue to bind
Returns
The Enumeration itself so the call can be chained

Reimplemented in Sqrat::ConstTable.


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