mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
forward declare more things to make gcc/clang happier
This commit is contained in:
parent
92f3330e03
commit
fd52cc1aa9
|
@ -20,8 +20,8 @@
|
||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2018-06-15 19:50:07.516271 UTC
|
// Generated 2018-06-15 19:54:27.149295 UTC
|
||||||
// This header was generated with sol v2.20.2 (revision 2777b6a)
|
// This header was generated with sol v2.20.2 (revision 92f3330)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||||
|
@ -387,6 +387,11 @@ namespace sol {
|
||||||
struct protect_t;
|
struct protect_t;
|
||||||
template <typename F, typename... Filters>
|
template <typename F, typename... Filters>
|
||||||
struct filter_wrapper;
|
struct filter_wrapper;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct usertype_traits;
|
||||||
|
template <typename T>
|
||||||
|
struct unique_usertype_traits;
|
||||||
} // namespace sol
|
} // namespace sol
|
||||||
|
|
||||||
// end of sol/forward.hpp
|
// end of sol/forward.hpp
|
||||||
|
@ -6001,117 +6006,7 @@ namespace sol {
|
||||||
|
|
||||||
// beginning of sol/inheritance.hpp
|
// beginning of sol/inheritance.hpp
|
||||||
|
|
||||||
namespace sol {
|
// beginning of sol/usertype_traits.hpp
|
||||||
template <typename... Args>
|
|
||||||
struct base_list {};
|
|
||||||
template <typename... Args>
|
|
||||||
using bases = base_list<Args...>;
|
|
||||||
|
|
||||||
typedef bases<> base_classes_tag;
|
|
||||||
const auto base_classes = base_classes_tag();
|
|
||||||
|
|
||||||
namespace detail {
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct has_derived {
|
|
||||||
static bool value;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
bool has_derived<T>::value = false;
|
|
||||||
|
|
||||||
inline decltype(auto) base_class_check_key() {
|
|
||||||
static const auto& key = "class_check";
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline decltype(auto) base_class_cast_key() {
|
|
||||||
static const auto& key = "class_cast";
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline decltype(auto) base_class_index_propogation_key() {
|
|
||||||
static const auto& key = u8"\xF0\x9F\x8C\xB2.index";
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline decltype(auto) base_class_new_index_propogation_key() {
|
|
||||||
static const auto& key = u8"\xF0\x9F\x8C\xB2.new_index";
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T, typename... Bases>
|
|
||||||
struct inheritance {
|
|
||||||
static bool type_check_bases(types<>, const std::string&) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Base, typename... Args>
|
|
||||||
static bool type_check_bases(types<Base, Args...>, const std::string& ti) {
|
|
||||||
return ti == usertype_traits<Base>::qualified_name() || type_check_bases(types<Args...>(), ti);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool type_check(const std::string& ti) {
|
|
||||||
return ti == usertype_traits<T>::qualified_name() || type_check_bases(types<Bases...>(), ti);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void* type_cast_bases(types<>, T*, const std::string&) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Base, typename... Args>
|
|
||||||
static void* type_cast_bases(types<Base, Args...>, T* data, const std::string& ti) {
|
|
||||||
// Make sure to convert to T first, and then dynamic cast to the proper type
|
|
||||||
return ti != usertype_traits<Base>::qualified_name() ? type_cast_bases(types<Args...>(), data, ti) : static_cast<void*>(static_cast<Base*>(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void* type_cast(void* voiddata, const std::string& ti) {
|
|
||||||
T* data = static_cast<T*>(voiddata);
|
|
||||||
return static_cast<void*>(ti != usertype_traits<T>::qualified_name() ? type_cast_bases(types<Bases...>(), data, ti) : data);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U>
|
|
||||||
static bool type_unique_cast_bases(void*, const string_view&) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U, typename Base, typename... Args>
|
|
||||||
static bool type_unique_cast_bases(void* source_data, void* target_data, const string_view& ti) {
|
|
||||||
typedef unique_usertype_traits<U>::typename rebind_base<Base> base_ptr;
|
|
||||||
string_view base_ti = usertype_traits<Base>::qualified_name();
|
|
||||||
if (base_ti == ti) {
|
|
||||||
if (target_data != nullptr) {
|
|
||||||
U* source = static_cast<U*>(source_data);
|
|
||||||
base_ptr* target = static_cast<base_ptr*>(target_data);
|
|
||||||
// perform proper derived -> base conversion
|
|
||||||
*target = *source;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return type_unique_cast_bases<Args...>(source_data, target_data, ti);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename U>
|
|
||||||
static bool type_unique_cast(void* source_data, void* target_data, const string_view& ti, const string_view& rebind_ti) {
|
|
||||||
typedef unique_usertype_traits<U>::typename rebind_base<void> rebind_t;
|
|
||||||
string_view this_rebind_ti = usertype_traits<rebind_t>::qualified_name();
|
|
||||||
if (rebind_ti != this_rebind_ti) {
|
|
||||||
// this is not even of the same container type
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return type_unique_cast_bases<Bases...>(source_data, target_data, ti);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
using inheritance_check_function = decltype(&inheritance<void>::type_check);
|
|
||||||
using inheritance_cast_function = decltype(&inheritance<void>::type_cast);
|
|
||||||
using inheritance_unique_cast_function = decltype(&inheritance<void>::type_unique_cast<void>);
|
|
||||||
} // namespace detail
|
|
||||||
} // namespace sol
|
|
||||||
|
|
||||||
// end of sol/inheritance.hpp
|
|
||||||
|
|
||||||
// beginning of sol/error_handler.hpp
|
|
||||||
|
|
||||||
// beginning of sol/demangle.hpp
|
// beginning of sol/demangle.hpp
|
||||||
|
|
||||||
|
@ -6259,6 +6154,152 @@ namespace detail {
|
||||||
|
|
||||||
// end of sol/demangle.hpp
|
// end of sol/demangle.hpp
|
||||||
|
|
||||||
|
namespace sol {
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct usertype_traits {
|
||||||
|
static const std::string& name() {
|
||||||
|
static const std::string& n = detail::short_demangle<T>();
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
static const std::string& qualified_name() {
|
||||||
|
static const std::string& q_n = detail::demangle<T>();
|
||||||
|
return q_n;
|
||||||
|
}
|
||||||
|
static const std::string& metatable() {
|
||||||
|
static const std::string m = std::string("sol.").append(detail::demangle<T>());
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
static const std::string& user_metatable() {
|
||||||
|
static const std::string u_m = std::string("sol.").append(detail::demangle<T>()).append(".user");
|
||||||
|
return u_m;
|
||||||
|
}
|
||||||
|
static const std::string& user_gc_metatable() {
|
||||||
|
static const std::string u_g_m = std::string("sol.").append(detail::demangle<T>()).append(".user\xE2\x99\xBB");
|
||||||
|
return u_g_m;
|
||||||
|
}
|
||||||
|
static const std::string& gc_table() {
|
||||||
|
static const std::string g_t = std::string("sol.").append(detail::demangle<T>()).append(".\xE2\x99\xBB");
|
||||||
|
return g_t;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sol
|
||||||
|
|
||||||
|
// end of sol/usertype_traits.hpp
|
||||||
|
|
||||||
|
namespace sol {
|
||||||
|
template <typename... Args>
|
||||||
|
struct base_list {};
|
||||||
|
template <typename... Args>
|
||||||
|
using bases = base_list<Args...>;
|
||||||
|
|
||||||
|
typedef bases<> base_classes_tag;
|
||||||
|
const auto base_classes = base_classes_tag();
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct has_derived {
|
||||||
|
static bool value;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool has_derived<T>::value = false;
|
||||||
|
|
||||||
|
inline decltype(auto) base_class_check_key() {
|
||||||
|
static const auto& key = "class_check";
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline decltype(auto) base_class_cast_key() {
|
||||||
|
static const auto& key = "class_cast";
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline decltype(auto) base_class_index_propogation_key() {
|
||||||
|
static const auto& key = u8"\xF0\x9F\x8C\xB2.index";
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline decltype(auto) base_class_new_index_propogation_key() {
|
||||||
|
static const auto& key = u8"\xF0\x9F\x8C\xB2.new_index";
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename... Bases>
|
||||||
|
struct inheritance {
|
||||||
|
static bool type_check_bases(types<>, const std::string&) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Base, typename... Args>
|
||||||
|
static bool type_check_bases(types<Base, Args...>, const std::string& ti) {
|
||||||
|
return ti == usertype_traits<Base>::qualified_name() || type_check_bases(types<Args...>(), ti);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool type_check(const std::string& ti) {
|
||||||
|
return ti == usertype_traits<T>::qualified_name() || type_check_bases(types<Bases...>(), ti);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* type_cast_bases(types<>, T*, const std::string&) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Base, typename... Args>
|
||||||
|
static void* type_cast_bases(types<Base, Args...>, T* data, const std::string& ti) {
|
||||||
|
// Make sure to convert to T first, and then dynamic cast to the proper type
|
||||||
|
return ti != usertype_traits<Base>::qualified_name() ? type_cast_bases(types<Args...>(), data, ti) : static_cast<void*>(static_cast<Base*>(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* type_cast(void* voiddata, const std::string& ti) {
|
||||||
|
T* data = static_cast<T*>(voiddata);
|
||||||
|
return static_cast<void*>(ti != usertype_traits<T>::qualified_name() ? type_cast_bases(types<Bases...>(), data, ti) : data);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename U>
|
||||||
|
static bool type_unique_cast_bases(void*, const string_view&) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename U, typename Base, typename... Args>
|
||||||
|
static bool type_unique_cast_bases(void* source_data, void* target_data, const string_view& ti) {
|
||||||
|
typedef unique_usertype_traits<U>::typename rebind_base<Base> base_ptr;
|
||||||
|
string_view base_ti = usertype_traits<Base>::qualified_name();
|
||||||
|
if (base_ti == ti) {
|
||||||
|
if (target_data != nullptr) {
|
||||||
|
U* source = static_cast<U*>(source_data);
|
||||||
|
base_ptr* target = static_cast<base_ptr*>(target_data);
|
||||||
|
// perform proper derived -> base conversion
|
||||||
|
*target = *source;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return type_unique_cast_bases<Args...>(source_data, target_data, ti);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename U>
|
||||||
|
static bool type_unique_cast(void* source_data, void* target_data, const string_view& ti, const string_view& rebind_ti) {
|
||||||
|
typedef unique_usertype_traits<U>::typename rebind_base<void> rebind_t;
|
||||||
|
string_view this_rebind_ti = usertype_traits<rebind_t>::qualified_name();
|
||||||
|
if (rebind_ti != this_rebind_ti) {
|
||||||
|
// this is not even of the same container type
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return type_unique_cast_bases<Bases...>(source_data, target_data, ti);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
using inheritance_check_function = decltype(&inheritance<void>::type_check);
|
||||||
|
using inheritance_cast_function = decltype(&inheritance<void>::type_cast);
|
||||||
|
using inheritance_unique_cast_function = decltype(&inheritance<void>::type_unique_cast<void>);
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace sol
|
||||||
|
|
||||||
|
// end of sol/inheritance.hpp
|
||||||
|
|
||||||
|
// beginning of sol/error_handler.hpp
|
||||||
|
|
||||||
namespace sol {
|
namespace sol {
|
||||||
|
|
||||||
inline std::string associated_type_name(lua_State* L, int index, type t) {
|
inline std::string associated_type_name(lua_State* L, int index, type t) {
|
||||||
|
@ -8068,42 +8109,6 @@ namespace sol {
|
||||||
|
|
||||||
// beginning of sol/stack_check_unqualified.hpp
|
// beginning of sol/stack_check_unqualified.hpp
|
||||||
|
|
||||||
// beginning of sol/usertype_traits.hpp
|
|
||||||
|
|
||||||
namespace sol {
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct usertype_traits {
|
|
||||||
static const std::string& name() {
|
|
||||||
static const std::string& n = detail::short_demangle<T>();
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
static const std::string& qualified_name() {
|
|
||||||
static const std::string& q_n = detail::demangle<T>();
|
|
||||||
return q_n;
|
|
||||||
}
|
|
||||||
static const std::string& metatable() {
|
|
||||||
static const std::string m = std::string("sol.").append(detail::demangle<T>());
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
static const std::string& user_metatable() {
|
|
||||||
static const std::string u_m = std::string("sol.").append(detail::demangle<T>()).append(".user");
|
|
||||||
return u_m;
|
|
||||||
}
|
|
||||||
static const std::string& user_gc_metatable() {
|
|
||||||
static const std::string u_g_m = std::string("sol.").append(detail::demangle<T>()).append(".user\xE2\x99\xBB");
|
|
||||||
return u_g_m;
|
|
||||||
}
|
|
||||||
static const std::string& gc_table() {
|
|
||||||
static const std::string g_t = std::string("sol.").append(detail::demangle<T>()).append(".\xE2\x99\xBB");
|
|
||||||
return g_t;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace sol
|
|
||||||
|
|
||||||
// end of sol/usertype_traits.hpp
|
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#ifdef SOL_CXX17_FEATURES
|
#ifdef SOL_CXX17_FEATURES
|
||||||
#ifdef SOL_STD_VARIANT
|
#ifdef SOL_STD_VARIANT
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2018-06-15 19:50:08.054132 UTC
|
// Generated 2018-06-15 19:54:27.490289 UTC
|
||||||
// This header was generated with sol v2.20.2 (revision 2777b6a)
|
// This header was generated with sol v2.20.2 (revision 92f3330)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||||
|
@ -354,6 +354,11 @@ namespace sol {
|
||||||
struct protect_t;
|
struct protect_t;
|
||||||
template <typename F, typename... Filters>
|
template <typename F, typename... Filters>
|
||||||
struct filter_wrapper;
|
struct filter_wrapper;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct usertype_traits;
|
||||||
|
template <typename T>
|
||||||
|
struct unique_usertype_traits;
|
||||||
} // namespace sol
|
} // namespace sol
|
||||||
|
|
||||||
// end of sol/forward.hpp
|
// end of sol/forward.hpp
|
||||||
|
|
|
@ -153,6 +153,11 @@ namespace sol {
|
||||||
struct protect_t;
|
struct protect_t;
|
||||||
template <typename F, typename... Filters>
|
template <typename F, typename... Filters>
|
||||||
struct filter_wrapper;
|
struct filter_wrapper;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct usertype_traits;
|
||||||
|
template <typename T>
|
||||||
|
struct unique_usertype_traits;
|
||||||
} // namespace sol
|
} // namespace sol
|
||||||
|
|
||||||
#endif // SOL_FORWARD_HPP
|
#endif // SOL_FORWARD_HPP
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#define SOL_INHERITANCE_HPP
|
#define SOL_INHERITANCE_HPP
|
||||||
|
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
|
#include "usertype_traits.hpp"
|
||||||
|
|
||||||
namespace sol {
|
namespace sol {
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user