2018-09-28 14:55:09 +08:00
|
|
|
// sol3
|
2017-12-20 17:58:32 +08:00
|
|
|
|
2017-09-13 14:46:56 +08:00
|
|
|
// The MIT License (MIT)
|
2017-07-10 00:00:57 +08:00
|
|
|
|
2020-08-13 22:42:37 +08:00
|
|
|
// Copyright (c) 2013-2020 Rapptz, ThePhD and contributors
|
2017-07-10 00:00:57 +08:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
2020-08-10 05:17:06 +08:00
|
|
|
#include <sol/version.hpp>
|
2017-07-10 00:00:57 +08:00
|
|
|
|
2018-06-18 03:42:24 +08:00
|
|
|
#include <utility>
|
2018-12-20 12:17:15 +08:00
|
|
|
#include <type_traits>
|
2019-09-01 14:27:58 +08:00
|
|
|
#include <string_view>
|
2018-06-18 03:42:24 +08:00
|
|
|
|
2020-08-10 05:17:06 +08:00
|
|
|
#if SOL_IS_ON(SOL_USE_CXX_LUA_I_) || SOL_IS_ON(SOL_USE_CXX_LUAJIT_I_)
|
2019-03-10 09:57:49 +08:00
|
|
|
struct lua_State;
|
|
|
|
#else
|
|
|
|
extern "C" {
|
2019-09-01 14:27:58 +08:00
|
|
|
struct lua_State;
|
2019-03-10 09:57:49 +08:00
|
|
|
}
|
|
|
|
#endif // C++ Mangling for Lua vs. Not
|
|
|
|
|
2017-07-10 00:00:57 +08:00
|
|
|
namespace sol {
|
|
|
|
|
2019-09-01 14:27:58 +08:00
|
|
|
enum class type;
|
|
|
|
|
2019-06-10 16:22:59 +08:00
|
|
|
class stateless_reference;
|
2017-09-14 12:35:40 +08:00
|
|
|
template <bool b>
|
|
|
|
class basic_reference;
|
|
|
|
using reference = basic_reference<false>;
|
|
|
|
using main_reference = basic_reference<true>;
|
2019-06-10 16:22:59 +08:00
|
|
|
class stateless_stack_reference;
|
2017-07-10 00:00:57 +08:00
|
|
|
class stack_reference;
|
2017-09-14 12:35:40 +08:00
|
|
|
|
2019-03-15 04:15:43 +08:00
|
|
|
template <typename A>
|
|
|
|
class basic_bytecode;
|
|
|
|
|
2019-03-18 19:41:51 +08:00
|
|
|
struct lua_value;
|
|
|
|
|
2017-08-06 07:20:28 +08:00
|
|
|
struct proxy_base_tag;
|
2019-03-18 19:41:51 +08:00
|
|
|
template <typename>
|
2017-09-14 12:35:40 +08:00
|
|
|
struct proxy_base;
|
2019-03-18 19:41:51 +08:00
|
|
|
template <typename, typename>
|
2019-09-15 12:43:44 +08:00
|
|
|
struct table_proxy;
|
2017-09-14 12:35:40 +08:00
|
|
|
|
2019-03-18 19:41:51 +08:00
|
|
|
template <bool, typename>
|
2017-07-10 00:00:57 +08:00
|
|
|
class basic_table_core;
|
|
|
|
template <bool b>
|
|
|
|
using table_core = basic_table_core<b, reference>;
|
|
|
|
template <bool b>
|
2017-09-14 12:35:40 +08:00
|
|
|
using main_table_core = basic_table_core<b, main_reference>;
|
|
|
|
template <bool b>
|
2017-07-10 00:00:57 +08:00
|
|
|
using stack_table_core = basic_table_core<b, stack_reference>;
|
2018-08-11 08:43:39 +08:00
|
|
|
template <typename base_type>
|
|
|
|
using basic_table = basic_table_core<false, base_type>;
|
2019-01-17 21:28:34 +08:00
|
|
|
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>;
|
2018-09-28 13:27:38 +08:00
|
|
|
|
2019-03-18 19:41:51 +08:00
|
|
|
template <typename>
|
|
|
|
struct basic_lua_table;
|
|
|
|
using lua_table = basic_lua_table<reference>;
|
|
|
|
using stack_lua_table = basic_lua_table<stack_reference>;
|
|
|
|
|
2018-09-28 13:27:38 +08:00
|
|
|
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>;
|
|
|
|
|
2017-07-10 00:00:57 +08:00
|
|
|
template <typename base_t>
|
|
|
|
struct basic_environment;
|
|
|
|
using environment = basic_environment<reference>;
|
2017-09-14 12:35:40 +08:00
|
|
|
using main_environment = basic_environment<main_reference>;
|
2017-07-10 00:00:57 +08:00
|
|
|
using stack_environment = basic_environment<stack_reference>;
|
2018-09-28 13:27:38 +08:00
|
|
|
|
2017-08-06 07:20:28 +08:00
|
|
|
template <typename T, bool>
|
2017-07-10 00:00:57 +08:00
|
|
|
class basic_function;
|
2017-08-07 00:20:32 +08:00
|
|
|
template <typename T, bool, typename H>
|
2017-07-10 00:00:57 +08:00
|
|
|
class basic_protected_function;
|
2017-08-06 07:20:28 +08:00
|
|
|
using unsafe_function = basic_function<reference, false>;
|
2017-08-07 00:20:32 +08:00
|
|
|
using safe_function = basic_protected_function<reference, false, reference>;
|
2017-09-14 12:35:40 +08:00
|
|
|
using main_unsafe_function = basic_function<main_reference, false>;
|
|
|
|
using main_safe_function = basic_protected_function<main_reference, false, reference>;
|
2017-08-06 07:20:28 +08:00
|
|
|
using stack_unsafe_function = basic_function<stack_reference, false>;
|
2017-08-07 00:20:32 +08:00
|
|
|
using stack_safe_function = basic_protected_function<stack_reference, false, reference>;
|
2017-08-06 07:20:28 +08:00
|
|
|
using stack_aligned_unsafe_function = basic_function<stack_reference, true>;
|
2017-08-07 00:20:32 +08:00
|
|
|
using stack_aligned_safe_function = basic_protected_function<stack_reference, true, reference>;
|
2017-08-06 07:20:28 +08:00
|
|
|
using protected_function = safe_function;
|
2017-09-14 20:45:44 +08:00
|
|
|
using main_protected_function = main_safe_function;
|
2017-08-06 07:20:28 +08:00
|
|
|
using stack_protected_function = stack_safe_function;
|
|
|
|
using stack_aligned_protected_function = stack_aligned_safe_function;
|
2020-08-10 05:17:06 +08:00
|
|
|
#if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS_I_)
|
2017-07-10 00:00:57 +08:00
|
|
|
using function = protected_function;
|
2017-09-14 12:35:40 +08:00
|
|
|
using main_function = main_protected_function;
|
2017-07-10 00:00:57 +08:00
|
|
|
using stack_function = stack_protected_function;
|
2020-01-08 19:40:33 +08:00
|
|
|
using stack_aligned_function = stack_aligned_safe_function;
|
2017-07-10 00:00:57 +08:00
|
|
|
#else
|
|
|
|
using function = unsafe_function;
|
2017-09-14 12:35:40 +08:00
|
|
|
using main_function = main_unsafe_function;
|
2017-07-10 00:00:57 +08:00
|
|
|
using stack_function = stack_unsafe_function;
|
2017-12-08 14:22:22 +08:00
|
|
|
using stack_aligned_function = stack_aligned_unsafe_function;
|
2020-01-08 19:40:33 +08:00
|
|
|
#endif
|
2017-08-07 00:20:32 +08:00
|
|
|
using stack_aligned_stack_handler_function = basic_protected_function<stack_reference, true, stack_reference>;
|
|
|
|
|
2017-11-08 09:19:36 +08:00
|
|
|
struct unsafe_function_result;
|
2017-08-06 07:20:28 +08:00
|
|
|
struct protected_function_result;
|
|
|
|
using safe_function_result = protected_function_result;
|
2020-08-10 05:17:06 +08:00
|
|
|
#if SOL_IS_ON(SOL_SAFE_FUNCTION_OBJECTS_I_)
|
2017-11-08 09:19:36 +08:00
|
|
|
using function_result = safe_function_result;
|
|
|
|
#else
|
|
|
|
using function_result = unsafe_function_result;
|
|
|
|
#endif
|
2017-09-14 12:35:40 +08:00
|
|
|
|
2019-01-17 21:28:34 +08:00
|
|
|
template <typename base_t>
|
|
|
|
class basic_object_base;
|
2017-07-10 00:00:57 +08:00
|
|
|
template <typename base_t>
|
|
|
|
class basic_object;
|
|
|
|
template <typename base_t>
|
|
|
|
class basic_userdata;
|
|
|
|
template <typename base_t>
|
|
|
|
class basic_lightuserdata;
|
2017-09-14 12:35:40 +08:00
|
|
|
template <typename base_t>
|
|
|
|
class basic_coroutine;
|
|
|
|
template <typename base_t>
|
|
|
|
class basic_thread;
|
|
|
|
|
2017-07-10 00:00:57 +08:00
|
|
|
using object = basic_object<reference>;
|
|
|
|
using userdata = basic_userdata<reference>;
|
|
|
|
using lightuserdata = basic_lightuserdata<reference>;
|
2017-09-14 12:35:40 +08:00
|
|
|
using thread = basic_thread<reference>;
|
|
|
|
using coroutine = basic_coroutine<reference>;
|
|
|
|
using main_object = basic_object<main_reference>;
|
|
|
|
using main_userdata = basic_userdata<main_reference>;
|
|
|
|
using main_lightuserdata = basic_lightuserdata<main_reference>;
|
2017-11-22 03:33:27 +08:00
|
|
|
using main_coroutine = basic_coroutine<main_reference>;
|
2017-09-14 12:35:40 +08:00
|
|
|
using stack_object = basic_object<stack_reference>;
|
|
|
|
using stack_userdata = basic_userdata<stack_reference>;
|
2017-07-10 00:00:57 +08:00
|
|
|
using stack_lightuserdata = basic_lightuserdata<stack_reference>;
|
2017-09-14 12:35:40 +08:00
|
|
|
using stack_thread = basic_thread<stack_reference>;
|
|
|
|
using stack_coroutine = basic_coroutine<stack_reference>;
|
|
|
|
|
2017-11-10 06:41:46 +08:00
|
|
|
struct stack_proxy_base;
|
|
|
|
struct stack_proxy;
|
2017-07-10 00:00:57 +08:00
|
|
|
struct variadic_args;
|
|
|
|
struct variadic_results;
|
2017-08-06 07:20:28 +08:00
|
|
|
struct stack_count;
|
2017-07-10 00:00:57 +08:00
|
|
|
struct this_state;
|
2017-09-14 12:35:40 +08:00
|
|
|
struct this_main_state;
|
2017-07-10 00:00:57 +08:00
|
|
|
struct this_environment;
|
2017-09-14 12:35:40 +08:00
|
|
|
|
2019-01-14 10:46:53 +08:00
|
|
|
class state_view;
|
|
|
|
class state;
|
|
|
|
|
2017-07-10 00:00:57 +08:00
|
|
|
template <typename T>
|
2017-08-06 07:20:28 +08:00
|
|
|
struct as_table_t;
|
|
|
|
template <typename T>
|
2017-08-11 21:40:56 +08:00
|
|
|
struct as_container_t;
|
|
|
|
template <typename T>
|
2017-08-06 07:20:28 +08:00
|
|
|
struct nested;
|
|
|
|
template <typename T>
|
2017-07-10 00:00:57 +08:00
|
|
|
struct light;
|
|
|
|
template <typename T>
|
|
|
|
struct user;
|
|
|
|
template <typename T>
|
|
|
|
struct as_args_t;
|
2017-08-22 03:25:43 +08:00
|
|
|
template <typename T>
|
|
|
|
struct protect_t;
|
2019-05-21 15:57:10 +08:00
|
|
|
template <typename F, typename... Policies>
|
|
|
|
struct policy_wrapper;
|
2018-06-16 03:54:43 +08:00
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct usertype_traits;
|
|
|
|
template <typename T>
|
|
|
|
struct unique_usertype_traits;
|
2018-06-18 03:42:24 +08:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
2018-12-20 12:17:15 +08:00
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct weak_derive {
|
|
|
|
static bool value;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
bool weak_derive<T>::value = false;
|
|
|
|
|
2018-12-23 04:36:42 +08:00
|
|
|
namespace stack {
|
|
|
|
struct record;
|
|
|
|
}
|
|
|
|
|
2020-08-10 05:17:06 +08:00
|
|
|
#if SOL_IS_OFF(SOL_USE_BOOST_I_)
|
2019-01-05 18:48:51 +08:00
|
|
|
template <class T>
|
|
|
|
class optional;
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
class optional<T&>;
|
|
|
|
#endif
|
|
|
|
|
2019-09-01 14:27:58 +08:00
|
|
|
using check_handler_type = int(lua_State*, int, type, type, const char*);
|
|
|
|
|
2017-09-13 14:46:56 +08:00
|
|
|
} // namespace sol
|
2017-07-10 00:00:57 +08:00
|
|
|
|
2018-12-20 12:17:15 +08:00
|
|
|
#define SOL_BASE_CLASSES(T, ...) \
|
|
|
|
namespace sol { \
|
|
|
|
template <> \
|
|
|
|
struct base<T> : std::true_type { \
|
|
|
|
typedef ::sol::types<__VA_ARGS__> type; \
|
|
|
|
}; \
|
|
|
|
} \
|
|
|
|
void a_sol3_detail_function_decl_please_no_collide()
|
|
|
|
#define SOL_DERIVED_CLASSES(T, ...) \
|
|
|
|
namespace sol { \
|
|
|
|
template <> \
|
|
|
|
struct derive<T> : std::true_type { \
|
|
|
|
typedef ::sol::types<__VA_ARGS__> type; \
|
|
|
|
}; \
|
|
|
|
} \
|
|
|
|
void a_sol3_detail_function_decl_please_no_collide()
|
|
|
|
|
2017-07-10 00:59:28 +08:00
|
|
|
#endif // SOL_FORWARD_HPP
|