10#ifndef SQUIRREL_CLASS_HPP
11#define SQUIRREL_CLASS_HPP
19template <
class CL, ScriptType ST>
22 std::string_view classname;
35 template <
typename Func>
36 void DefSQMethod(
Squirrel &engine, Func function_proc, std::string_view function_name, std::string_view params = {})
39 engine.
AddMethod(function_name, DefSQNonStaticCallback<CL, Func, ST>, params, &function_proc,
sizeof(function_proc));
36 void DefSQMethod(
Squirrel &engine, Func function_proc, std::string_view function_name, std::string_view params = {}) {
…}
45 template <
typename Func>
49 engine.
AddMethod(function_name, DefSQAdvancedNonStaticCallback<CL, Func, ST>, {}, &function_proc,
sizeof(function_proc));
58 template <
typename Func>
62 engine.
AddMethod(function_name, DefSQStaticCallback<CL, Func>, params, &function_proc,
sizeof(function_proc));
68 template <
typename Func>
72 engine.
AddMethod(function_name, DefSQAdvancedStaticCallback<CL, Func>, {}, &function_proc,
sizeof(function_proc));
75 template <
typename Var>
76 void DefSQConst(
Squirrel &engine, Var value, std::string_view var_name)
86 void PreRegister(
Squirrel &engine, std::string_view parent_class)
91 template <
typename Func>
92 void AddConstructor(
Squirrel &engine, std::string_view params)
95 engine.
AddMethod(
"constructor", DefSQConstructorCallback<CL, Func>, params);
98 void AddSQAdvancedConstructor(
Squirrel &engine)
101 engine.
AddMethod(
"constructor", DefSQAdvancedConstructorCallback<CL>);
The template to define classes in Squirrel.
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 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 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