| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- // sol2
- // The MIT License (MIT)
- // Copyright (c) 2013-2022 Rapptz, ThePhD and contributors
- // Permission is hereby granted, free of charge, to any person obtaining a copy of
- // this software and associated documentation files (the "Software"), to deal in
- // the Software without restriction, including without limitation the rights to
- // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- // the Software, and to permit persons to whom the Software is furnished to do so,
- // subject to the following conditions:
- // The above copyright notice and this permission notice shall be included in all
- // copies or substantial portions of the Software.
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- #ifndef SOL_FORWARD_HPP
- #define SOL_FORWARD_HPP
- #include <sol/version.hpp>
- #include <utility>
- #include <type_traits>
- #include <string_view>
- #if SOL_IS_ON(SOL_USING_CXX_LUA) || SOL_IS_ON(SOL_USING_CXX_LUAJIT)
- struct lua_State;
- #else
- extern "C" {
- struct lua_State;
- }
- #endif // C++ Mangling for Lua vs. Not
- namespace sol {
- enum class type;
- class stateless_reference;
- template <bool b>
- class basic_reference;
- using reference = basic_reference<false>;
- using main_reference = basic_reference<true>;
- class stateless_stack_reference;
- class stack_reference;
- template <typename A>
- class basic_bytecode;
- struct lua_value;
- struct proxy_base_tag;
- template <typename>
- struct proxy_base;
- template <typename, typename>
- struct table_proxy;
- template <bool, typename>
- class basic_table_core;
- template <bool b>
- using table_core = basic_table_core<b, reference>;
- template <bool b>
- using main_table_core = basic_table_core<b, main_reference>;
- template <bool b>
- using stack_table_core = basic_table_core<b, stack_reference>;
- template <typename base_type>
- using basic_table = basic_table_core<false, base_type>;
- using table = table_core<false>;
- using global_table = table_core<true>;
- using main_table = main_table_core<false>;
- using main_global_table = main_table_core<true>;
- using stack_table = stack_table_core<false>;
- using stack_global_table = stack_table_core<true>;
- template <typename>
- struct basic_lua_table;
- using lua_table = basic_lua_table<reference>;
- using stack_lua_table = basic_lua_table<stack_reference>;
- template <typename T, typename base_type>
- class basic_usertype;
- template <typename T>
- using usertype = basic_usertype<T, reference>;
- template <typename T>
- using stack_usertype = basic_usertype<T, stack_reference>;
- template <typename base_type>
- class basic_metatable;
- using metatable = basic_metatable<reference>;
- using stack_metatable = basic_metatable<stack_reference>;
- template <typename base_t>
- struct basic_environment;
- using environment = basic_environment<reference>;
- using main_environment = basic_environment<main_reference>;
- using stack_environment = basic_environment<stack_reference>;
- template <typename T, bool>
- class basic_function;
- template <typename T, bool, typename H>
- class basic_protected_function;
- using unsafe_function = basic_function<reference, false>;
- using safe_function = basic_protected_function<reference, false, reference>;
- using main_unsafe_function = basic_function<main_reference, false>;
- using main_safe_function = basic_protected_function<main_reference, false, reference>;
- using stack_unsafe_function = basic_function<stack_reference, false>;
- using stack_safe_function = basic_protected_function<stack_reference, false, reference>;
- using stack_aligned_unsafe_function = basic_function<stack_reference, true>;
- using stack_aligned_safe_function = basic_protected_function<stack_reference, true, reference>;
- using protected_function = safe_function;
- using main_protected_function = main_safe_function;
- using stack_protected_function = stack_safe_function;
- using stack_aligned_protected_function = stack_aligned_safe_function;
- #if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS)
- using function = protected_function;
- using main_function = main_protected_function;
- using stack_function = stack_protected_function;
- using stack_aligned_function = stack_aligned_safe_function;
- #else
- using function = unsafe_function;
- using main_function = main_unsafe_function;
- using stack_function = stack_unsafe_function;
- using stack_aligned_function = stack_aligned_unsafe_function;
- #endif
- using stack_aligned_stack_handler_function = basic_protected_function<stack_reference, true, stack_reference>;
- struct unsafe_function_result;
- struct protected_function_result;
- using safe_function_result = protected_function_result;
- #if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS)
- using function_result = safe_function_result;
- #else
- using function_result = unsafe_function_result;
- #endif
- template <typename base_t>
- class basic_object_base;
- template <typename base_t>
- class basic_object;
- template <typename base_t>
- class basic_userdata;
- template <typename base_t>
- class basic_lightuserdata;
- template <typename base_t>
- class basic_coroutine;
- template <typename base_t>
- class basic_packaged_coroutine;
- template <typename base_t>
- class basic_thread;
- using object = basic_object<reference>;
- using userdata = basic_userdata<reference>;
- using lightuserdata = basic_lightuserdata<reference>;
- using thread = basic_thread<reference>;
- using coroutine = basic_coroutine<reference>;
- using packaged_coroutine = basic_packaged_coroutine<reference>;
- using main_object = basic_object<main_reference>;
- using main_userdata = basic_userdata<main_reference>;
- using main_lightuserdata = basic_lightuserdata<main_reference>;
- using main_coroutine = basic_coroutine<main_reference>;
- using stack_object = basic_object<stack_reference>;
- using stack_userdata = basic_userdata<stack_reference>;
- using stack_lightuserdata = basic_lightuserdata<stack_reference>;
- using stack_thread = basic_thread<stack_reference>;
- using stack_coroutine = basic_coroutine<stack_reference>;
- struct stack_proxy_base;
- struct stack_proxy;
- struct variadic_args;
- struct variadic_results;
- struct stack_count;
- struct this_state;
- struct this_main_state;
- struct this_environment;
- class state_view;
- class state;
- template <typename T>
- struct as_table_t;
- template <typename T>
- struct as_container_t;
- template <typename T>
- struct nested;
- template <typename T>
- struct light;
- template <typename T>
- struct user;
- template <typename T>
- struct as_args_t;
- template <typename T>
- struct protect_t;
- template <typename F, typename... Policies>
- struct policy_wrapper;
- template <typename T>
- struct usertype_traits;
- template <typename T>
- struct unique_usertype_traits;
- template <typename... Args>
- struct types {
- typedef std::make_index_sequence<sizeof...(Args)> indices;
- static constexpr std::size_t size() {
- return sizeof...(Args);
- }
- };
- template <typename T>
- struct derive : std::false_type {
- typedef types<> type;
- };
- template <typename T>
- struct base : std::false_type {
- typedef types<> type;
- };
- template <typename T>
- struct weak_derive {
- static bool value;
- };
- template <typename T>
- bool weak_derive<T>::value = false;
- namespace stack {
- struct record;
- }
- #if SOL_IS_OFF(SOL_USE_BOOST)
- template <class T>
- class optional;
- template <class T>
- class optional<T&>;
- #endif
- using check_handler_type = int(lua_State*, int, type, type, const char*);
- } // namespace sol
- #define SOL_BASE_CLASSES(T, ...) \
- namespace sol { \
- template <> \
- struct base<T> : std::true_type { \
- typedef ::sol::types<__VA_ARGS__> type; \
- }; \
- } \
- static_assert(true, "")
- #define SOL_DERIVED_CLASSES(T, ...) \
- namespace sol { \
- template <> \
- struct derive<T> : std::true_type { \
- typedef ::sol::types<__VA_ARGS__> type; \
- }; \
- } \
- static_assert(true, "")
- #endif // SOL_FORWARD_HPP
|