# SQConvert Namespace Reference

The Squirrel convert routines. More...

## Data Structures

struct | SQAutoFreePointers
| Pointers assigned to this class will be free'd when this instance comes out of scope. More...
struct | YesT
struct | IsVoidT
| Helper class to recognize if the given type is void. More...
struct | IsVoidT< void >
struct | HasVoidReturnT< Tretval(*)()>
struct | HasVoidReturnT< Tretval(*)(Targ1)>
struct | HasVoidReturnT< Tretval(*)(Targ1, Targ2)>
struct | HasVoidReturnT< Tretval(*)(Targ1, Targ2, Targ3)>
struct | HasVoidReturnT< Tretval(*)(Targ1, Targ2, Targ3, Targ4)>
struct | HasVoidReturnT< Tretval(*)(Targ1, Targ2, Targ3, Targ4, Targ5)>
struct | HasVoidReturnT< Tretval(*)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9, Targ10)>
struct | HasVoidReturnT< Tretval(Tcls::*)()>
struct | HasVoidReturnT< Tretval(Tcls::*)(Targ1)>
struct | HasVoidReturnT< Tretval(Tcls::*)(Targ1, Targ2)>
struct | HasVoidReturnT< Tretval(Tcls::*)(Targ1, Targ2, Targ3)>
struct | HasVoidReturnT< Tretval(Tcls::*)(Targ1, Targ2, Targ3, Targ4)>
struct | HasVoidReturnT< Tretval(Tcls::*)(Targ1, Targ2, Targ3, Targ4, Targ5)>
struct | HasVoidReturnT< Tretval(Tcls::*)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9, Targ10)>
class | ForceType
| Special class to make it possible for the compiler to pick the correct GetParam(). More...
struct | HelperT< Tretval(*)(), false >
| The real C++ caller for function with return value and 0 params. More...
struct | HelperT< Tretval(*)(), true >
| The real C++ caller for function with no return value and 0 params. More...
struct | HelperT< Tretval(Tcls::*)(), false >
| The real C++ caller for method with return value and 0 params. More...
struct | HelperT< Tretval(Tcls::*)(), true >
| The real C++ caller for method with no return value and 0 params. More...
struct | HelperT< Tretval(*)(Targ1), false >
| The real C++ caller for function with return value and 1 param. More...
struct | HelperT< Tretval(*)(Targ1), true >
| The real C++ caller for function with no return value and 1 param. More...
struct | HelperT< Tretval(Tcls::*)(Targ1), false >
| The real C++ caller for method with return value and 1 param. More...
struct | HelperT< Tretval(Tcls::*)(Targ1), true >
| The real C++ caller for method with no return value and 1 param. More...
struct | HelperT< Tretval(*)(Targ1, Targ2), false >
| The real C++ caller for function with return value and 2 params. More...
struct | HelperT< Tretval(*)(Targ1, Targ2), true >
| The real C++ caller for function with no return value and 2 params. More...
struct | HelperT< Tretval(Tcls::*)(Targ1, Targ2), false >
| The real C++ caller for method with return value and 2 params. More...
struct | HelperT< Tretval(Tcls::*)(Targ1, Targ2), true >
| The real C++ caller for method with no return value and 2 params. More...
struct | HelperT< Tretval(*)(Targ1, Targ2, Targ3), false >
| The real C++ caller for function with return value and 3 params. More...
struct | HelperT< Tretval(*)(Targ1, Targ2, Targ3), true >
| The real C++ caller for function with no return value and 3 params. More...
struct | HelperT< Tretval(Tcls::*)(Targ1, Targ2, Targ3), false >
| The real C++ caller for method with return value and 3 params. More...
struct | HelperT< Tretval(Tcls::*)(Targ1, Targ2, Targ3), true >
| The real C++ caller for method with no return value and 3 params. More...
struct | HelperT< Tretval(*)(Targ1, Targ2, Targ3, Targ4), false >
| The real C++ caller for function with return value and 4 params. More...
struct | HelperT< Tretval(*)(Targ1, Targ2, Targ3, Targ4), true >
| The real C++ caller for function with no return value and 4 params. More...
struct | HelperT< Tretval(Tcls::*)(Targ1, Targ2, Targ3, Targ4), false >
| The real C++ caller for method with return value and 4 params. More...
struct | HelperT< Tretval(Tcls::*)(Targ1, Targ2, Targ3, Targ4), true >
| The real C++ caller for method with no return value and 4 params. More...
struct | HelperT< Tretval(*)(Targ1, Targ2, Targ3, Targ4, Targ5), false >
| The real C++ caller for function with return value and 5 params. More...
struct | HelperT< Tretval(*)(Targ1, Targ2, Targ3, Targ4, Targ5), true >
| The real C++ caller for function with no return value and 5 params. More...
struct | HelperT< Tretval(Tcls::*)(Targ1, Targ2, Targ3, Targ4, Targ5), false >
| The real C++ caller for method with return value and 5 params. More...
struct | HelperT< Tretval(Tcls::*)(Targ1, Targ2, Targ3, Targ4, Targ5), true >
| The real C++ caller for method with no return value and 5 params. More...
struct | HelperT< Tretval(*)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9, Targ10), false >
| The real C++ caller for function with return value and 10 params. More...
struct | HelperT< Tretval(*)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9, Targ10), true >
| The real C++ caller for function with no return value and 10 params. More...
struct | HelperT< Tretval(Tcls::*)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9, Targ10), false >
| The real C++ caller for method with return value and 10 params. More...
struct | HelperT< Tretval(Tcls::*)(Targ1, Targ2, Targ3, Targ4, Targ5, Targ6, Targ7, Targ8, Targ9, Targ10), true >
| The real C++ caller for method with no return value and 10 params. More...

## Functions

template<typename T >
static int | Return (HSQUIRRELVM vm, T t)
| To return a value to squirrel, we call this function.
template<>
int | Return< uint8 > (HSQUIRRELVM vm, uint8 res)
template<>
int | Return< uint16 > (HSQUIRRELVM vm, uint16 res)
template<>
int | Return< uint32 > (HSQUIRRELVM vm, uint32 res)
template<>
int | Return< int8 > (HSQUIRRELVM vm, int8 res)
template<>
int | Return< int16 > (HSQUIRRELVM vm, int16 res)
template<>
int | Return< int32 > (HSQUIRRELVM vm, int32 res)
template<>
int | Return< int64 > (HSQUIRRELVM vm, int64 res)
template<>
int | Return< Money > (HSQUIRRELVM vm, Money res)
template<>
int | Return< bool > (HSQUIRRELVM vm, bool res)
template<>
int | Return< char * > (HSQUIRRELVM vm, char *res)
template<>
int | Return< const char * > (HSQUIRRELVM vm, const char *res)
template<>
int | Return< void * > (HSQUIRRELVM vm, void *res)
template<typename T >
static T | GetParam (ForceType< T >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
| To get a param from squirrel, we call this function.
template<>
uint8 | GetParam (ForceType< uint8 >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<>
uint16 | GetParam (ForceType< uint16 >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<>
uint32 | GetParam (ForceType< uint32 >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<>
int8 | GetParam (ForceType< int8 >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<>
int16 | GetParam (ForceType< int16 >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<>
int32 | GetParam (ForceType< int32 >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<>
bool | GetParam (ForceType< bool >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<>
void * | GetParam (ForceType< void * >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<>
const char * | GetParam (ForceType< const char * >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<>
Array * | GetParam (ForceType< Array * >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<typename Tcls , typename Tmethod >
SQInteger | DefSQNonStaticCallback (HSQUIRRELVM vm)
| A general template for all non-static method callbacks from Squirrel.
template<typename Tcls , typename Tmethod >
SQInteger | DefSQAdvancedNonStaticCallback (HSQUIRRELVM vm)
| A general template for all non-static advanced method callbacks from Squirrel.
template<typename Tcls , typename Tmethod >
SQInteger | DefSQStaticCallback (HSQUIRRELVM vm)
| A general template for all function/static method callbacks from Squirrel.
template<typename Tcls >
static SQInteger | DefSQDestructorCallback (SQUserPointer p, SQInteger size)
| A general template for the destructor of SQ instances.
template<typename Tcls , typename Tmethod , int Tnparam>
SQInteger | DefSQConstructorCallback (HSQUIRRELVM vm)
| A general template to handle creating of instance with any amount of params.

## Detailed Description

The Squirrel convert routines.

## Function Documentation

template<typename Tcls , typename Tmethod >

SQInteger SQConvert::DefSQAdvancedNonStaticCallback | ( | HSQUIRRELVM | vm | ) | `[inline]`

A general template for all non-static advanced method callbacks from Squirrel.

In here the function_proc is recovered, and the SQCall is called that can handle this exact amount of params.

Definition at line 795 of file squirrel_helper.hpp.

References Squirrel::GetInstance().

template<typename Tcls , typename Tmethod , int Tnparam>

SQInteger SQConvert::DefSQConstructorCallback | ( | HSQUIRRELVM | vm | ) | `[inline]`

A general template to handle creating of instance with any amount of params.

It creates the instance in C++, and it sets all the needed settings in SQ to register the instance.

Definition at line 868 of file squirrel_helper.hpp.

template<typename Tcls >

static SQInteger SQConvert::DefSQDestructorCallback | ( | SQUserPointer | p,
|  | SQInteger | size |
| ) |  |  | `[inline, static]`

A general template for the destructor of SQ instances.

This is needed here as it has to be in the same scope as DefSQConstructorCallback.

Definition at line 855 of file squirrel_helper.hpp.

template<typename Tcls , typename Tmethod >

SQInteger SQConvert::DefSQNonStaticCallback | ( | HSQUIRRELVM | vm | ) | `[inline]`

A general template for all non-static method callbacks from Squirrel.

In here the function_proc is recovered, and the SQCall is called that can handle this exact amount of params.

Definition at line 753 of file squirrel_helper.hpp.

References Squirrel::GetInstance().

template<typename Tcls , typename Tmethod >

SQInteger SQConvert::DefSQStaticCallback | ( | HSQUIRRELVM | vm | ) | `[inline]`

A general template for all function/static method callbacks from Squirrel.

In here the function_proc is recovered, and the SQCall is called that can handle this exact amount of params.

Definition at line 832 of file squirrel_helper.hpp.

template<typename T >

static T SQConvert::GetParam | ( | ForceType< T > | ,
|  | HSQUIRRELVM | vm,
|  | int | index,
|  | SQAutoFreePointers * | ptr |
| ) |  |  | `[inline, static]`

To get a param from squirrel, we call this function.

It converts to the right format.

template<typename T >

static int SQConvert::Return | ( | HSQUIRRELVM | vm,
|  | T | t |
| ) |  |  | `[inline, static]`

To return a value to squirrel, we call this function.

It converts to the right format.