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