OpenMiner  0.0.1a
Voxel game engine
Classes | Typedefs | Functions
sol::stack::stack_detail Namespace Reference

Classes

struct  basic_check
 
struct  check_types
 
struct  check_types< false >
 
struct  evaluator
 
struct  metatable_setup
 
struct  strip
 
struct  strip< non_null< T > >
 
struct  strip< std::reference_wrapper< T > >
 
struct  strip< user< T > >
 
struct  strip_extensible
 
struct  strip_extensible< extensible< T > >
 
struct  undefined_metatable
 

Typedefs

template<typename T >
using strip_t = typename strip< T >::type
 
template<typename T >
using strip_extensible_t = typename strip_extensible< T >::type
 

Functions

template<typename C >
static int get_size_hint (const C &c)
 
template<typename V , typename Al >
static int get_size_hint (const std::forward_list< V, Al > &)
 
template<typename T >
decltype(auto) unchecked_unqualified_get (lua_State *L, int index, record &tracking)
 
template<typename T >
decltype(auto) unchecked_get (lua_State *L, int index, record &tracking)
 
template<typename T , typename Arg , typename... Args>
int push_reference (lua_State *L, Arg &&arg, Args &&... args)
 
template<typename T , typename Handler >
bool check_usertype (std::false_type, lua_State *L, int index, type indextype, Handler &&handler, record &tracking)
 
template<typename T , typename Handler >
bool check_usertype (std::true_type, lua_State *L, int index, type indextype, Handler &&handler, record &tracking)
 
template<typename T >
decltype(auto) tagged_unqualified_get (types< T >, lua_State *L, int index, record &tracking)
 
template<typename T >
decltype(auto) tagged_get (types< T >, lua_State *L, int index, record &tracking)
 
template<typename T , bool poptable = true>
bool check_metatable (lua_State *L, int index=-2)
 
template<typename T >
int push_as_upvalues (lua_State *L, T &item)
 
template<typename T >
std::pair< T, int > get_as_upvalues (lua_State *L, int index=2)
 
template<bool checkargs = detail::default_safe_function_calls, std::size_t... I, typename R , typename... Args, typename Fx , typename... FxArgs, typename = std::enable_if_t<!std::is_void<R>::value >>
decltype(auto) call (types< R >, types< Args... > ta, std::index_sequence< I... > tai, lua_State *L, int start, Fx &&fx, FxArgs &&... args)
 
template<bool checkargs = detail::default_safe_function_calls, std::size_t... I, typename... Args, typename Fx , typename... FxArgs>
void call (types< void >, types< Args... > ta, std::index_sequence< I... > tai, lua_State *L, int start, Fx &&fx, FxArgs &&... args)
 

Typedef Documentation

§ strip_extensible_t

template<typename T >
using sol::stack::stack_detail::strip_extensible_t = typedef typename strip_extensible<T>::type

§ strip_t

template<typename T >
using sol::stack::stack_detail::strip_t = typedef typename strip<T>::type

Function Documentation

§ call() [1/2]

template<bool checkargs = detail::default_safe_function_calls, std::size_t... I, typename R , typename... Args, typename Fx , typename... FxArgs, typename = std::enable_if_t<!std::is_void<R>::value >>
decltype(auto) sol::stack::stack_detail::call ( types< R >  ,
types< Args... >  ta,
std::index_sequence< I... >  tai,
lua_State *  L,
int  start,
Fx &&  fx,
FxArgs &&...  args 
)
inline
11783  {
11784 #ifndef _MSC_VER
11785  static_assert(meta::all<meta::is_not_move_only<Args>...>::value, "One of the arguments being bound is a move-only type, and it is not being taken by reference: this will break your code. Please take a reference and std::move it manually if this was your intention.");
11786 #endif // This compiler make me so sad
11787  argument_handler<types<R, Args...>> handler{};
11788  multi_check<checkargs, Args...>(L, start, handler);
11789  record tracking{};
11790  return evaluator{}.eval(ta, tai, L, start, tracking, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
11791  }
bool multi_check(lua_State *L, int index)
Definition: sol.hpp:8022

§ call() [2/2]

template<bool checkargs = detail::default_safe_function_calls, std::size_t... I, typename... Args, typename Fx , typename... FxArgs>
void sol::stack::stack_detail::call ( types< void >  ,
types< Args... >  ta,
std::index_sequence< I... >  tai,
lua_State *  L,
int  start,
Fx &&  fx,
FxArgs &&...  args 
)
inline
11794  {
11795 #ifndef _MSC_VER
11796  static_assert(meta::all<meta::is_not_move_only<Args>...>::value, "One of the arguments being bound is a move-only type, and it is not being taken by reference: this will break your code. Please take a reference and std::move it manually if this was your intention.");
11797 #endif // This compiler make me so fucking sad
11798  argument_handler<types<void, Args...>> handler{};
11799  multi_check<checkargs, Args...>(L, start, handler);
11800  record tracking{};
11801  evaluator{}.eval(ta, tai, L, start, tracking, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
11802  }
bool multi_check(lua_State *L, int index)
Definition: sol.hpp:8022

§ check_metatable()

template<typename T , bool poptable = true>
bool sol::stack::stack_detail::check_metatable ( lua_State *  L,
int  index = -2 
)
inline
8164  {
8165  const auto& metakey = usertype_traits<T>::metatable();
8166  luaL_getmetatable(L, &metakey[0]);
8167  const type expectedmetatabletype = static_cast<type>(lua_type(L, -1));
8168  if (expectedmetatabletype != type::lua_nil) {
8169  if (lua_rawequal(L, -1, index) == 1) {
8170  lua_pop(L, 1 + static_cast<int>(poptable));
8171  return true;
8172  }
8173  }
8174  lua_pop(L, 1);
8175  return false;
8176  }
const lua_nil_t lua_nil
Definition: sol.hpp:4683
type
Definition: sol.hpp:5173

§ check_usertype() [1/2]

template<typename T , typename Handler >
bool sol::stack::stack_detail::check_usertype ( std::false_type  ,
lua_State *  L,
int  index,
type  indextype,
Handler &&  handler,
record tracking 
)
7724  {
7725  typedef meta::unqualified_t<T> Tu;
7726  typedef detail::as_value_tag<Tu> detail_t;
7727  return checker<detail_t, type::userdata>{}.check(types<meta::unqualified_t<T>>(), L, index, indextype, std::forward<Handler>(handler), tracking);
7728  }

§ check_usertype() [2/2]

template<typename T , typename Handler >
bool sol::stack::stack_detail::check_usertype ( std::true_type  ,
lua_State *  L,
int  index,
type  indextype,
Handler &&  handler,
record tracking 
)
7731  {
7732  typedef meta::unqualified_t<std::remove_pointer_t<meta::unqualified_t<T>>> Tu;
7733  typedef detail::as_pointer_tag<Tu> detail_t;
7734  return checker<detail_t, type::userdata>{}.check(L, index, indextype, std::forward<Handler>(handler), tracking);
7735  }

§ get_as_upvalues()

template<typename T >
std::pair<T, int> sol::stack::stack_detail::get_as_upvalues ( lua_State *  L,
int  index = 2 
)
inline
11760  {
11761  static const std::size_t data_t_count = (sizeof(T) + (sizeof(void*) - 1)) / sizeof(void*);
11762  typedef std::array<void*, data_t_count> data_t;
11763  data_t voiddata{ {} };
11764  for (std::size_t i = 0, d = 0; d < sizeof(T); ++i, d += sizeof(void*)) {
11765  voiddata[i] = get<lightuserdata_value>(L, upvalue_index(index++));
11766  }
11767  return std::pair<T, int>(*reinterpret_cast<T*>(static_cast<void*>(voiddata.data())), index);
11768  }

§ get_size_hint() [1/2]

template<typename C >
static int sol::stack::stack_detail::get_size_hint ( const C &  c)
static
7685  {
7686  return static_cast<int>(c.size());
7687  }

§ get_size_hint() [2/2]

template<typename V , typename Al >
static int sol::stack::stack_detail::get_size_hint ( const std::forward_list< V, Al > &  )
static
7690  {
7691  // forward_list makes me sad
7692  return static_cast<int>(32);
7693  }

§ push_as_upvalues()

template<typename T >
int sol::stack::stack_detail::push_as_upvalues ( lua_State *  L,
T item 
)
inline
11742  {
11743  typedef std::decay_t<T> TValue;
11744  static const std::size_t itemsize = sizeof(TValue);
11745  static const std::size_t voidsize = sizeof(void*);
11746  static const std::size_t voidsizem1 = voidsize - 1;
11747  static const std::size_t data_t_count = (sizeof(TValue) + voidsizem1) / voidsize;
11748  typedef std::array<void*, data_t_count> data_t;
11749 
11750  data_t data{ {} };
11751  std::memcpy(&data[0], std::addressof(item), itemsize);
11752  int pushcount = 0;
11753  for (auto&& v : data) {
11754  pushcount += push(L, lightuserdata_value(v));
11755  }
11756  return pushcount;
11757  }
int push(lua_State *L, Arg &&arg, Args &&... args)
Definition: sol.hpp:7776

§ push_reference()

template<typename T , typename Arg , typename... Args>
int sol::stack::stack_detail::push_reference ( lua_State *  L,
Arg &&  arg,
Args &&...  args 
)
inline
7711  {
7712  typedef meta::all<
7713  std::is_lvalue_reference<T>,
7714  meta::neg<std::is_const<T>>,
7715  meta::neg<is_lua_primitive<meta::unqualified_t<T>>>,
7716  meta::neg<is_unique_usertype<meta::unqualified_t<T>>>>
7717  use_reference_tag;
7718  pusher<std::conditional_t<use_reference_tag::value, detail::as_reference_tag, meta::unqualified_t<T>>> p{};
7719  (void)p;
7720  return p.push(L, std::forward<Arg>(arg), std::forward<Args>(args)...);
7721  }

§ tagged_get()

template<typename T >
decltype(auto) sol::stack::stack_detail::tagged_get ( types< T ,
lua_State *  L,
int  index,
record tracking 
)
inline
7964  {
7965  return stack_detail::unchecked_get<T>(L, index, tracking);
7966  }

§ tagged_unqualified_get()

template<typename T >
decltype(auto) sol::stack::stack_detail::tagged_unqualified_get ( types< T ,
lua_State *  L,
int  index,
record tracking 
)
inline
7959  {
7960  return stack_detail::unchecked_unqualified_get<T>(L, index, tracking);
7961  }

§ unchecked_get()

template<typename T >
decltype(auto) sol::stack::stack_detail::unchecked_get ( lua_State *  L,
int  index,
record tracking 
)
inline
7704  {
7705  qualified_getter<T> g{};
7706  (void)g;
7707  return g.get(L, index, tracking);
7708  }

§ unchecked_unqualified_get()

template<typename T >
decltype(auto) sol::stack::stack_detail::unchecked_unqualified_get ( lua_State *  L,
int  index,
record tracking 
)
inline
7696  {
7697  typedef meta::unqualified_t<T> Tu;
7698  getter<Tu> g{};
7699  (void)g;
7700  return g.get(L, index, tracking);
7701  }