OpenTTD Source: SQConvert Namespace Reference

OpenTTD Source 12.2

Data Structures | Functions
SQConvert Namespace Reference

The Squirrel convert routines. More...

## Data Structures
class | ForceType
| Special class to make it possible for the compiler to pick the correct GetParam(). More...
struct | HasVoidReturnT
| Helper class to recognize if the function/method return type is void. More...
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)>
struct | HelperT
| Helper class to recognize the function type (retval type, args) and use the proper specialization for SQ callback. 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(*)(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(*)(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(*)(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(*)(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(*)(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(*)(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::*)(), 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(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(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(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(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(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(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...
struct | IsVoidT
| Helper class to recognize if the given type is void. More...
struct | IsVoidT< void >
struct | SQAutoFreePointers
| Pointers assigned to this class will be free'd when this instance comes out of scope. More...
struct | YesT

## Functions
template<typename T >
static int | Return (HSQUIRRELVM vm, T t)
| To return a value to squirrel, we call this function. More...
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<>
int | Return< HSQOBJECT > (HSQUIRRELVM vm, HSQOBJECT 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. More...
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<>
int64 | GetParam (ForceType< int64 >, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr)
template<>
Money | GetParam (ForceType< Money >, 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 , ScriptType Ttype>
SQInteger | DefSQNonStaticCallback (HSQUIRRELVM vm)
| A general template for all non-static method callbacks from Squirrel. More...
template<typename Tcls , typename Tmethod , ScriptType Ttype>
SQInteger | DefSQAdvancedNonStaticCallback (HSQUIRRELVM vm)
| A general template for all non-static advanced method callbacks from Squirrel. More...
template<typename Tcls , typename Tmethod >
SQInteger | DefSQStaticCallback (HSQUIRRELVM vm)
| A general template for all function/static method callbacks from Squirrel. More...
template<typename Tcls , typename Tmethod >
SQInteger | DefSQAdvancedStaticCallback (HSQUIRRELVM vm)
| A general template for all static advanced method callbacks from Squirrel. More...
template<typename Tcls >
static SQInteger | DefSQDestructorCallback (SQUserPointer p, SQInteger size)
| A general template for the destructor of SQ instances. More...
template<typename Tcls , typename Tmethod , int Tnparam>
SQInteger | DefSQConstructorCallback (HSQUIRRELVM vm)
| A general template to handle creating of instance with any amount of params. More...
template<typename Tcls >
SQInteger | DefSQAdvancedConstructorCallback (HSQUIRRELVM vm)
| A general template to handle creating of an instance with a complex constructor.

## Detailed Description

The Squirrel convert routines.

## Function Documentation

## ◆ DefSQAdvancedNonStaticCallback()

template<typename Tcls , typename Tmethod , ScriptType Ttype>

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 778 of file squirrel_helper.hpp.

References Squirrel::GetInstance().

## ◆ DefSQAdvancedStaticCallback()

template<typename Tcls , typename Tmethod >

SQInteger SQConvert::DefSQAdvancedStaticCallback | ( | HSQUIRRELVM | vm | ) |
| inline

A general template for all 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 840 of file squirrel_helper.hpp.

## ◆ DefSQConstructorCallback()

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 873 of file squirrel_helper.hpp.

## ◆ DefSQDestructorCallback()

template<typename Tcls >

static SQInteger SQConvert::DefSQDestructorCallback | ( | SQUserPointer | p,
|  | SQInteger | size
| ) |  |
| 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 860 of file squirrel_helper.hpp.

## ◆ DefSQNonStaticCallback()

template<typename Tcls , typename Tmethod , ScriptType Ttype>

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 736 of file squirrel_helper.hpp.

References Squirrel::GetInstance().

## ◆ DefSQStaticCallback()

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 816 of file squirrel_helper.hpp.

## ◆ GetParam()

template<typename T >

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

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

It converts to the right format.

## ◆ Return()

template<typename T >

static int SQConvert::Return | ( | HSQUIRRELVM | vm,
|  | T | t
| ) |  |
| static

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

It converts to the right format.