|
Otclient 1.0
14/8/2020
|
Classes | |
| struct | bind_lambda_fun |
| Specialization for lambdas. More... | |
| struct | bind_lambda_fun< Ret(Lambda::*)(Args...) const > |
| struct | connect_lambda |
| struct | connect_lambda< Ret(Lambda::*)(Args...) const > |
| struct | expand_fun_arguments |
| Expand arguments from tuple for later calling the C++ function. More... | |
| struct | expand_fun_arguments< 0, Ret > |
| struct | pack_values_into_tuple |
| Pack arguments from lua stack into a tuple recursively. More... | |
| struct | pack_values_into_tuple< 0 > |
Functions | |
| template<typename Ret , typename F , typename... Args> | |
| std::enable_if<!std::is_void< Ret >::value, int >::type | call_fun_and_push_result (const F &f, LuaInterface *lua, const Args &... args) |
| C++ function caller that can push results to lua. More... | |
| template<typename Ret , typename F , typename... Args> | |
| std::enable_if< std::is_void< Ret >::value, int >::type | call_fun_and_push_result (const F &f, LuaInterface *, const Args &... args) |
| C++ void function caller. More... | |
| template<typename Ret , typename F , typename Tuple > | |
| LuaCppFunction | bind_fun_specializer (const F &f) |
| Bind different types of functions generating a lambda. More... | |
| LuaCppFunction | bind_fun (const std::function< int(LuaInterface *)> &f) |
| Bind a customized function. More... | |
| template<typename Ret , typename... Args> | |
| LuaCppFunction | bind_fun (const std::function< Ret(Args...)> &f) |
| Bind a std::function. More... | |
| template<typename Lambda > | |
| std::enable_if< std::is_constructible< decltype(&Lambda::operator())>::value, LuaCppFunction >::type | bind_fun (const Lambda &f) |
| template<typename Ret , typename... Args> | |
| LuaCppFunction | bind_fun (Ret(*f)(Args...)) |
| Convert to C++ functions pointers to std::function then bind. More... | |
| template<typename Ret , typename C , typename... Args> | |
| std::function< Ret(const stdext::shared_object_ptr< C > &, const Args &...)> | make_mem_func (Ret(C::*f)(Args...)) |
| Create member function lambdas. More... | |
| template<typename C , typename... Args> | |
| std::function< void(const stdext::shared_object_ptr< C > &, const Args &...)> | make_mem_func (void(C::*f)(Args...)) |
| template<typename Ret , typename C , typename... Args> | |
| std::function< Ret(const Args &...)> | make_mem_func_singleton (Ret(C::*f)(Args...), C *instance) |
| Create member function lambdas for singleton classes. More... | |
| template<typename C , typename... Args> | |
| std::function< void(const Args &...)> | make_mem_func_singleton (void(C::*f)(Args...), C *instance) |
| template<typename C , typename Ret , class FC , typename... Args> | |
| LuaCppFunction | bind_mem_fun (Ret(FC::*f)(Args...)) |
| Bind member functions. More... | |
| template<typename C , typename Ret , class FC , typename... Args> | |
| LuaCppFunction | bind_singleton_mem_fun (Ret(FC::*f)(Args...), C *instance) |
| Bind singleton member functions. More... | |
| template<typename C > | |
| LuaCppFunction | bind_mem_fun (int(C::*f)(LuaInterface *)) |
| Bind customized member functions. More... | |
This namespace contains some dirty metaprogamming that uses a lot of C++0x features The purpose here is to create templates that can bind any function from C++ and expose in lua environment. This is done combining variadic templates, lambdas, tuples and some type traits features from the new C++0x standard to create templates that can detect functions's arguments and then generate lambdas. These lambdas pops arguments from lua stack, call the bound C++ function and then pushes the result to lua.
| std::enable_if<std::is_constructible<decltype(&Lambda::operator())>::value, LuaCppFunction>::type luabinder::bind_fun | ( | const Lambda & | f | ) |
Definition at line 139 of file luabinder.h.
|
inline |
Bind a customized function.
Definition at line 110 of file luabinder.h.

| LuaCppFunction luabinder::bind_fun | ( | const std::function< Ret(Args...)> & | f | ) |
Bind a std::function.
Definition at line 116 of file luabinder.h.
| LuaCppFunction luabinder::bind_fun | ( | Ret(*)(Args...) | f | ) |
Convert to C++ functions pointers to std::function then bind.
Definition at line 146 of file luabinder.h.

| LuaCppFunction luabinder::bind_fun_specializer | ( | const F & | f | ) |
Bind different types of functions generating a lambda.
Definition at line 93 of file luabinder.h.

| LuaCppFunction luabinder::bind_mem_fun | ( | int(C::*)(LuaInterface *) | f | ) |
Bind customized member functions.
Definition at line 206 of file luabinder.h.
| LuaCppFunction luabinder::bind_mem_fun | ( | Ret(FC::*)(Args...) | f | ) |
Bind member functions.
Definition at line 185 of file luabinder.h.
| LuaCppFunction luabinder::bind_singleton_mem_fun | ( | Ret(FC::*)(Args...) | f, |
| C * | instance | ||
| ) |
Bind singleton member functions.
Definition at line 195 of file luabinder.h.

| std::enable_if<std::is_void<Ret>::value, int>::type luabinder::call_fun_and_push_result | ( | const F & | f, |
| LuaInterface * | , | ||
| const Args &... | args | ||
| ) |
C++ void function caller.
Definition at line 70 of file luabinder.h.
| std::enable_if<!std::is_void<Ret>::value, int>::type luabinder::call_fun_and_push_result | ( | const F & | f, |
| LuaInterface * | lua, | ||
| const Args &... | args | ||
| ) |
C++ function caller that can push results to lua.
Definition at line 61 of file luabinder.h.

| std::function<Ret(const stdext::shared_object_ptr<C>&, const Args&...)> luabinder::make_mem_func | ( | Ret(C::*)(Args...) | f | ) |
Create member function lambdas.
Definition at line 152 of file luabinder.h.

| std::function<void(const stdext::shared_object_ptr<C>&, const Args&...)> luabinder::make_mem_func | ( | void(C::*)(Args...) | f | ) |
| std::function<Ret(const Args&...)> luabinder::make_mem_func_singleton | ( | Ret(C::*)(Args...) | f, |
| C * | instance | ||
| ) |
Create member function lambdas for singleton classes.
Definition at line 172 of file luabinder.h.
| std::function<void(const Args&...)> luabinder::make_mem_func_singleton | ( | void(C::*)(Args...) | f, |
| C * | instance | ||
| ) |
Definition at line 177 of file luabinder.h.