10#ifndef SQUIRREL_CLASS_HPP
11#define SQUIRREL_CLASS_HPP
19template <
class CL, ScriptType ST>
22 const char *classname;
32 template <
typename Func>
36 engine->
AddMethod(function_name, DefSQNonStaticCallback<CL, Func, ST>, 0,
nullptr, &function_proc,
sizeof(function_proc));
42 template <
typename Func>
46 engine->
AddMethod(function_name, DefSQAdvancedNonStaticCallback<CL, Func, ST>, 0,
nullptr, &function_proc,
sizeof(function_proc));
55 template <
typename Func>
56 void DefSQMethod(
Squirrel *engine, Func function_proc,
const char *function_name,
int nparam,
const char *params)
59 engine->
AddMethod(function_name, DefSQNonStaticCallback<CL, Func, ST>, nparam, params, &function_proc,
sizeof(function_proc));
65 template <
typename Func>
69 engine->
AddMethod(function_name, DefSQStaticCallback<CL, Func>, 0,
nullptr, &function_proc,
sizeof(function_proc));
75 template <
typename Func>
79 engine->
AddMethod(function_name, DefSQAdvancedStaticCallback<CL, Func>, 0,
nullptr, &function_proc,
sizeof(function_proc));
88 template <
typename Func>
92 engine->
AddMethod(function_name, DefSQStaticCallback<CL, Func>, nparam, params, &function_proc,
sizeof(function_proc));
95 template <
typename Var>
96 void DefSQConst(
Squirrel *engine, Var value,
const char *var_name)
106 void PreRegister(
Squirrel *engine,
const char *parent_class)
111 template <
typename Func,
int Tnparam>
112 void AddConstructor(
Squirrel *engine,
const char *params)
115 engine->
AddMethod(
"constructor", DefSQConstructorCallback<CL, Func, Tnparam>, Tnparam, params);
118 void AddSQAdvancedConstructor(
Squirrel *engine)
121 engine->
AddMethod(
"constructor", DefSQAdvancedConstructorCallback<CL>, 0,
nullptr);
The template to define classes in Squirrel.
void DefSQAdvancedStaticMethod(Squirrel *engine, Func function_proc, const char *function_name)
This defines a static method inside a class for Squirrel, which has access to the 'engine' (experts o...
void DefSQMethod(Squirrel *engine, Func function_proc, const char *function_name)
This defines a method inside a class for Squirrel.
void DefSQMethod(Squirrel *engine, Func function_proc, const char *function_name, int nparam, const char *params)
This defines a method inside a class for Squirrel with defined params.
void DefSQAdvancedMethod(Squirrel *engine, Func function_proc, const char *function_name)
This defines a method inside a class for Squirrel, which has access to the 'engine' (experts only!...
void DefSQStaticMethod(Squirrel *engine, Func function_proc, const char *function_name)
This defines a static method inside a class for Squirrel.
void DefSQStaticMethod(Squirrel *engine, Func function_proc, const char *function_name, int nparam, const char *params)
This defines a static method inside a class for Squirrel with defined params.
void AddClassEnd()
Finishes adding a class to the global scope.
void AddMethod(const char *method_name, SQFUNCTION proc, uint nparam=0, const char *params=nullptr, void *userdata=nullptr, int size=0)
Adds a function to the stack.
void AddClassBegin(const char *class_name)
Adds a class to the global scope.
void AddConst(const char *var_name, int value)
Adds a const to the stack.
The Squirrel convert routines.
declarations and parts of the implementation of the class for convert code