sqrat  0.9
sqrat
 All Classes Functions Variables Enumerations Enumerator Pages
Public Member Functions | List of all members
Sqrat::DerivedClass< C, B, A > Class Template Reference

#include <sqratClass.h>

Inheritance diagram for Sqrat::DerivedClass< C, B, A >:
Sqrat::Class< C, A > Sqrat::Object

Public Member Functions

 DerivedClass (HSQUIRRELVM v=DefaultVM::Get(), const string &className=string())
 
- Public Member Functions inherited from Sqrat::Class< C, A >
 Class (HSQUIRRELVM v=DefaultVM::Get(), const string &className=string(), bool createClass=true)
 
virtual HSQOBJECT GetObject () const
 
virtual HSQOBJECT & GetObject ()
 
template<class V >
ClassSetStaticValue (const SQChar *name, const V &val)
 
template<class V >
ClassSetValue (const SQChar *name, const V &val)
 
template<class V >
ClassVar (const SQChar *name, V C::*var)
 
template<class V >
ClassStaticVar (const SQChar *name, V *var)
 
template<class F1 , class F2 >
ClassProp (const SQChar *name, F1 getMethod, F2 setMethod)
 
template<class F1 , class F2 >
ClassGlobalProp (const SQChar *name, F1 getMethod, F2 setMethod)
 
template<class F >
ClassProp (const SQChar *name, F getMethod)
 
template<class F >
ClassGlobalProp (const SQChar *name, F getMethod)
 
template<class F >
ClassFunc (const SQChar *name, F method)
 
template<class F >
ClassOverload (const SQChar *name, F method)
 
template<class F >
ClassGlobalFunc (const SQChar *name, F method)
 
template<class F >
ClassStaticFunc (const SQChar *name, F method)
 
template<class F >
ClassGlobalOverload (const SQChar *name, F method)
 
template<class F >
ClassStaticOverload (const SQChar *name, F method)
 
ClassSquirrelFunc (const SQChar *name, SQFUNCTION func)
 
Function GetFunction (const SQChar *name)
 
ClassCtor (const SQChar *name=0)
 
template<class A1 >
ClassCtor (const SQChar *name=0)
 
template<class A1 , class A2 >
ClassCtor (const SQChar *name=0)
 
template<class A1 , class A2 , class A3 >
ClassCtor (const SQChar *name=0)
 
template<class A1 , class A2 , class A3 , class A4 >
ClassCtor (const SQChar *name=0)
 
template<class A1 , class A2 , class A3 , class A4 , class A5 >
ClassCtor (const SQChar *name=0)
 
template<class A1 , class A2 , class A3 , class A4 , class A5 , class A6 >
ClassCtor (const SQChar *name=0)
 
template<class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 >
ClassCtor (const SQChar *name=0)
 
template<class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 , class A8 >
ClassCtor (const SQChar *name=0)
 
template<class A1 , class A2 , class A3 , class A4 , class A5 , class A6 , class A7 , class A8 , class A9 >
ClassCtor (const SQChar *name=0)
 
- 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
 
 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

template<class C, class B, class A = DefaultAllocator<C>>
class Sqrat::DerivedClass< C, B, A >

Facilitates exposing a C++ class with a base class to Squirrel

Template Parameters
CClass type to expose
BBase class type (must already be bound)
AAn allocator to use when instantiating and destroying class instances of this type in Squirrel
Remarks
Classes in Squirrel are single-inheritance only, and as such Sqrat only allows for single inheritance as well.
DefaultAllocator is used if no allocator is specified. This should be sufficent for most classes, but if specific behavior is desired, it can be overridden. If the class should not be instantiated from Squirrel the NoConstructor allocator may be used. See NoCopy and CopyOnly too.

Constructor & Destructor Documentation

template<class C , class B , class A = DefaultAllocator<C>>
Sqrat::DerivedClass< C, B, A >::DerivedClass ( HSQUIRRELVM  v = DefaultVM::Get(),
const string &  className = string() 
)
inline

Constructs the DerivedClass object

A DerivedClass object doesnt do anything on its own. It must be told what methods and variables it contains. This is done using Class methods such as Class::Func and Class::Var. Then the DerivedClass must be exposed to Squirrel. This is usually done by calling TableBase::Bind on a RootTable with the DerivedClass.

Parameters
vSquirrel virtual machine to create the DerivedClass for
classNameThe name of the class (seen in error messages - uses an ugly one by default)
Remarks
Every time the DerivedClass constructor is called, a userdata is left on the Squirrel stack. It manages the lifetime of required class type data and therefore should not be removed from the stack until the class is no longer needed in Squirrel.

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