mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix up string_view handling
- Fix mispelling for is_stackED_based_v - Regenerate single - Repair badly named test - Remove unused variable names
This commit is contained in:
parent
c032cda56e
commit
a9ff1d4187
|
@ -145,9 +145,10 @@ namespace sol {
|
||||||
basic_coroutine(proxy_base<Super>&& p)
|
basic_coroutine(proxy_base<Super>&& p)
|
||||||
: basic_coroutine(std::move(p), detail::get_default_handler<reference, is_main_threaded<base_t>::value>(p.lua_state())) {
|
: basic_coroutine(std::move(p), detail::get_default_handler<reference, is_main_threaded<base_t>::value>(p.lua_state())) {
|
||||||
}
|
}
|
||||||
template <typename Proxy, typename Handler,
|
template <typename Proxy, typename HandlerReference,
|
||||||
meta::enable<std::is_base_of<proxy_base_tag, meta::unqualified_t<Proxy>>, meta::neg<is_lua_index<meta::unqualified_t<Handler>>>> = meta::enabler>
|
meta::enable<std::is_base_of<proxy_base_tag, meta::unqualified_t<Proxy>>,
|
||||||
basic_coroutine(Proxy&& p, Handler&& eh) : basic_coroutine(detail::force_cast<base_t>(p), std::forward<Handler>(eh)) {
|
meta::neg<is_lua_index<meta::unqualified_t<HandlerReference>>>> = meta::enabler>
|
||||||
|
basic_coroutine(Proxy&& p, HandlerReference&& eh) : basic_coroutine(detail::force_cast<base_t>(p), std::forward<HandlerReference>(eh)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||||
|
|
|
@ -149,9 +149,9 @@ namespace sol {
|
||||||
basic_packaged_coroutine(proxy_base<Super>&& p)
|
basic_packaged_coroutine(proxy_base<Super>&& p)
|
||||||
: basic_packaged_coroutine(std::move(p), detail::get_default_handler<reference, is_main_threaded<base_t>::value>(p.lua_state())) {
|
: basic_packaged_coroutine(std::move(p), detail::get_default_handler<reference, is_main_threaded<base_t>::value>(p.lua_state())) {
|
||||||
}
|
}
|
||||||
template <typename Proxy, typename Handler,
|
template <typename Proxy, typename HandlerReference,
|
||||||
meta::enable<std::is_base_of<proxy_base_tag, meta::unqualified_t<Proxy>>, meta::neg<is_lua_index<meta::unqualified_t<Handler>>>> = meta::enabler>
|
meta::enable<std::is_base_of<proxy_base_tag, meta::unqualified_t<Proxy>>, meta::neg<is_lua_index<meta::unqualified_t<HandlerReference>>>> = meta::enabler>
|
||||||
basic_packaged_coroutine(Proxy&& p, Handler&& eh) : basic_packaged_coroutine(detail::force_cast<base_t>(p), std::forward<Handler>(eh)) {
|
basic_packaged_coroutine(Proxy&& p, HandlerReference&& eh) : basic_packaged_coroutine(detail::force_cast<base_t>(p), std::forward<HandlerReference>(eh)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||||
|
|
|
@ -198,27 +198,27 @@ namespace sol {
|
||||||
return m_cached_key_value_pair;
|
return m_cached_key_value_pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator==(const pairs_iterator& left, const pairs_iterator& right) noexcept {
|
friend bool operator==(const pairs_iterator& left, const pairs_iterator& right) noexcept {
|
||||||
return left.m_table_ref == right.m_table_ref && left.m_iteration_index == right.m_iteration_index;
|
return left.m_table_ref == right.m_table_ref && left.m_iteration_index == right.m_iteration_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator!=(const pairs_iterator& left, const pairs_iterator& right) noexcept {
|
friend bool operator!=(const pairs_iterator& left, const pairs_iterator& right) noexcept {
|
||||||
return left.m_table_ref != right.m_table_ref || left.m_iteration_index != right.m_iteration_index;
|
return left.m_table_ref != right.m_table_ref || left.m_iteration_index != right.m_iteration_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator==(const pairs_iterator& left, const pairs_sentinel&) noexcept {
|
friend bool operator==(const pairs_iterator& left, const pairs_sentinel&) noexcept {
|
||||||
return left.m_key_index == empty_key_index;
|
return left.m_key_index == empty_key_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator!=(const pairs_iterator& left, const pairs_sentinel&) noexcept {
|
friend bool operator!=(const pairs_iterator& left, const pairs_sentinel&) noexcept {
|
||||||
return left.m_key_index != empty_key_index;
|
return left.m_key_index != empty_key_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator==(const pairs_sentinel&, const pairs_iterator& left) noexcept {
|
friend bool operator==(const pairs_sentinel&, const pairs_iterator& left) noexcept {
|
||||||
return left.m_key_index == empty_key_index;
|
return left.m_key_index == empty_key_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator!=(const pairs_sentinel&, const pairs_iterator& left) noexcept {
|
friend bool operator!=(const pairs_sentinel&, const pairs_iterator& left) noexcept {
|
||||||
return left.m_key_index != empty_key_index;
|
return left.m_key_index != empty_key_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,10 +121,11 @@ namespace sol {
|
||||||
template <typename Super>
|
template <typename Super>
|
||||||
basic_protected_function(proxy_base<Super>&& p) : basic_protected_function(std::move(p), get_default_handler(p.lua_state())) {
|
basic_protected_function(proxy_base<Super>&& p) : basic_protected_function(std::move(p), get_default_handler(p.lua_state())) {
|
||||||
}
|
}
|
||||||
template <typename Proxy, typename Handler,
|
template <typename Proxy, typename HandlerReference,
|
||||||
meta::enable<std::is_base_of<proxy_base_tag, meta::unqualified_t<Proxy>>, meta::neg<is_lua_index<meta::unqualified_t<Handler>>>> = meta::enabler>
|
meta::enable<std::is_base_of<proxy_base_tag, meta::unqualified_t<Proxy>>,
|
||||||
basic_protected_function(Proxy&& p, Handler&& eh)
|
meta::neg<is_lua_index<meta::unqualified_t<HandlerReference>>>> = meta::enabler>
|
||||||
: basic_protected_function(detail::force_cast<base_t>(p), make_reference<handler_t>(p.lua_state(), std::forward<Handler>(eh))) {
|
basic_protected_function(Proxy&& p, HandlerReference&& eh)
|
||||||
|
: basic_protected_function(detail::force_cast<base_t>(p), make_reference<handler_t>(p.lua_state(), std::forward<HandlerReference>(eh))) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||||
|
@ -277,7 +278,7 @@ namespace sol {
|
||||||
|
|
||||||
auto get_error_handler() const noexcept {
|
auto get_error_handler() const noexcept {
|
||||||
if constexpr (is_stateless_lua_reference_v<handler_t>) {
|
if constexpr (is_stateless_lua_reference_v<handler_t>) {
|
||||||
if constexpr (is_stacked_based_v<handler_t>) {
|
if constexpr (is_stack_based_v<handler_t>) {
|
||||||
return stack_reference(lua_state(), m_error_handler.stack_index());
|
return stack_reference(lua_state(), m_error_handler.stack_index());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -772,8 +772,8 @@ namespace sol {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Class, typename... Args>
|
template <typename Class, typename... Args>
|
||||||
usertype<Class> new_usertype(const std::string& name, Args&&... args) {
|
usertype<Class> new_usertype(Args&&... args) {
|
||||||
return global.new_usertype<Class>(name, std::forward<Args>(args)...);
|
return global.new_usertype<Class>(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool read_only = true, typename... Args>
|
template <bool read_only = true, typename... Args>
|
||||||
|
|
|
@ -71,6 +71,12 @@ namespace sol {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOL_IS_ON(SOL_CHAR8_T_I_)
|
||||||
|
inline auto make_string_view(const char8_t* s) {
|
||||||
|
return string_view(reinterpret_cast<const char*>(s));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline auto make_string_view(call_construction) {
|
inline auto make_string_view(call_construction) {
|
||||||
return string_view(to_string(meta_function::call_function));
|
return string_view(to_string(meta_function::call_function));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 2021-01-21 08:26:13.647505 UTC
|
// Generated 2021-01-21 20:56:50.106258 UTC
|
||||||
// This header was generated with sol v3.2.3 (revision f7d8e1e8)
|
// This header was generated with sol v3.2.3 (revision c032cda5)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_CONFIG_HPP
|
#ifndef SOL_SINGLE_CONFIG_HPP
|
||||||
|
|
|
@ -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 2021-01-21 08:26:13.622520 UTC
|
// Generated 2021-01-21 20:56:50.090246 UTC
|
||||||
// This header was generated with sol v3.2.3 (revision f7d8e1e8)
|
// This header was generated with sol v3.2.3 (revision c032cda5)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||||
|
|
|
@ -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 2021-01-21 08:26:12.913504 UTC
|
// Generated 2021-01-21 20:56:49.214244 UTC
|
||||||
// This header was generated with sol v3.2.3 (revision f7d8e1e8)
|
// This header was generated with sol v3.2.3 (revision c032cda5)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||||
|
@ -20275,10 +20275,11 @@ namespace sol {
|
||||||
template <typename Super>
|
template <typename Super>
|
||||||
basic_protected_function(proxy_base<Super>&& p) : basic_protected_function(std::move(p), get_default_handler(p.lua_state())) {
|
basic_protected_function(proxy_base<Super>&& p) : basic_protected_function(std::move(p), get_default_handler(p.lua_state())) {
|
||||||
}
|
}
|
||||||
template <typename Proxy, typename Handler,
|
template <typename Proxy, typename HandlerReference,
|
||||||
meta::enable<std::is_base_of<proxy_base_tag, meta::unqualified_t<Proxy>>, meta::neg<is_lua_index<meta::unqualified_t<Handler>>>> = meta::enabler>
|
meta::enable<std::is_base_of<proxy_base_tag, meta::unqualified_t<Proxy>>,
|
||||||
basic_protected_function(Proxy&& p, Handler&& eh)
|
meta::neg<is_lua_index<meta::unqualified_t<HandlerReference>>>> = meta::enabler>
|
||||||
: basic_protected_function(detail::force_cast<base_t>(p), make_reference<handler_t>(p.lua_state(), std::forward<Handler>(eh))) {
|
basic_protected_function(Proxy&& p, HandlerReference&& eh)
|
||||||
|
: basic_protected_function(detail::force_cast<base_t>(p), make_reference<handler_t>(p.lua_state(), std::forward<HandlerReference>(eh))) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||||
|
@ -20431,7 +20432,7 @@ namespace sol {
|
||||||
|
|
||||||
auto get_error_handler() const noexcept {
|
auto get_error_handler() const noexcept {
|
||||||
if constexpr (is_stateless_lua_reference_v<handler_t>) {
|
if constexpr (is_stateless_lua_reference_v<handler_t>) {
|
||||||
if constexpr (is_stacked_based_v<handler_t>) {
|
if constexpr (is_stack_based_v<handler_t>) {
|
||||||
return stack_reference(lua_state(), m_error_handler.stack_index());
|
return stack_reference(lua_state(), m_error_handler.stack_index());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -22621,6 +22622,12 @@ namespace sol {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SOL_IS_ON(SOL_CHAR8_T_I_)
|
||||||
|
inline auto make_string_view(const char8_t* s) {
|
||||||
|
return string_view(reinterpret_cast<const char*>(s));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline auto make_string_view(call_construction) {
|
inline auto make_string_view(call_construction) {
|
||||||
return string_view(to_string(meta_function::call_function));
|
return string_view(to_string(meta_function::call_function));
|
||||||
}
|
}
|
||||||
|
@ -24619,27 +24626,27 @@ namespace sol {
|
||||||
return m_cached_key_value_pair;
|
return m_cached_key_value_pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator==(const pairs_iterator& left, const pairs_iterator& right) noexcept {
|
friend bool operator==(const pairs_iterator& left, const pairs_iterator& right) noexcept {
|
||||||
return left.m_table_ref == right.m_table_ref && left.m_iteration_index == right.m_iteration_index;
|
return left.m_table_ref == right.m_table_ref && left.m_iteration_index == right.m_iteration_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator!=(const pairs_iterator& left, const pairs_iterator& right) noexcept {
|
friend bool operator!=(const pairs_iterator& left, const pairs_iterator& right) noexcept {
|
||||||
return left.m_table_ref != right.m_table_ref || left.m_iteration_index != right.m_iteration_index;
|
return left.m_table_ref != right.m_table_ref || left.m_iteration_index != right.m_iteration_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator==(const pairs_iterator& left, const pairs_sentinel&) noexcept {
|
friend bool operator==(const pairs_iterator& left, const pairs_sentinel&) noexcept {
|
||||||
return left.m_key_index == empty_key_index;
|
return left.m_key_index == empty_key_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator!=(const pairs_iterator& left, const pairs_sentinel&) noexcept {
|
friend bool operator!=(const pairs_iterator& left, const pairs_sentinel&) noexcept {
|
||||||
return left.m_key_index != empty_key_index;
|
return left.m_key_index != empty_key_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator==(const pairs_sentinel&, const pairs_iterator& left) noexcept {
|
friend bool operator==(const pairs_sentinel&, const pairs_iterator& left) noexcept {
|
||||||
return left.m_key_index == empty_key_index;
|
return left.m_key_index == empty_key_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend static bool operator!=(const pairs_sentinel&, const pairs_iterator& left) noexcept {
|
friend bool operator!=(const pairs_sentinel&, const pairs_iterator& left) noexcept {
|
||||||
return left.m_key_index != empty_key_index;
|
return left.m_key_index != empty_key_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27196,8 +27203,8 @@ namespace sol {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Class, typename... Args>
|
template <typename Class, typename... Args>
|
||||||
usertype<Class> new_usertype(const std::string& name, Args&&... args) {
|
usertype<Class> new_usertype(Args&&... args) {
|
||||||
return global.new_usertype<Class>(name, std::forward<Args>(args)...);
|
return global.new_usertype<Class>(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool read_only = true, typename... Args>
|
template <bool read_only = true, typename... Args>
|
||||||
|
@ -27599,9 +27606,10 @@ namespace sol {
|
||||||
basic_coroutine(proxy_base<Super>&& p)
|
basic_coroutine(proxy_base<Super>&& p)
|
||||||
: basic_coroutine(std::move(p), detail::get_default_handler<reference, is_main_threaded<base_t>::value>(p.lua_state())) {
|
: basic_coroutine(std::move(p), detail::get_default_handler<reference, is_main_threaded<base_t>::value>(p.lua_state())) {
|
||||||
}
|
}
|
||||||
template <typename Proxy, typename Handler,
|
template <typename Proxy, typename HandlerReference,
|
||||||
meta::enable<std::is_base_of<proxy_base_tag, meta::unqualified_t<Proxy>>, meta::neg<is_lua_index<meta::unqualified_t<Handler>>>> = meta::enabler>
|
meta::enable<std::is_base_of<proxy_base_tag, meta::unqualified_t<Proxy>>,
|
||||||
basic_coroutine(Proxy&& p, Handler&& eh) : basic_coroutine(detail::force_cast<base_t>(p), std::forward<Handler>(eh)) {
|
meta::neg<is_lua_index<meta::unqualified_t<HandlerReference>>>> = meta::enabler>
|
||||||
|
basic_coroutine(Proxy&& p, HandlerReference&& eh) : basic_coroutine(detail::force_cast<base_t>(p), std::forward<HandlerReference>(eh)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||||
|
|
|
@ -216,7 +216,7 @@ TEST_CASE("usertype/constructor list", "Show that we can create classes from use
|
||||||
REQUIRE((z.as<int>() == 9));
|
REQUIRE((z.as<int>() == 9));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("usertype/no_constructor", "make sure if no constructor is present, do not fix anything") {
|
TEST_CASE("usertype/no_constructor linking time", "make sure if no constructor is present, do not fix anything") {
|
||||||
sol::state lua;
|
sol::state lua;
|
||||||
lua.open_libraries(sol::lib::base);
|
lua.open_libraries(sol::lib::base);
|
||||||
|
|
||||||
|
|
|
@ -72,10 +72,10 @@ inline namespace sol2_test_usertypes_overload {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
sol::object lua_TestClass2_GetByIndex(const sol::this_state& s, TestClass2* tc, const uint32_t index) {
|
sol::object lua_TestClass2_GetByIndex(const sol::this_state& s, TestClass2* tc, const uint32_t) {
|
||||||
return sol::make_object(s, tc);
|
return sol::make_object(s, tc);
|
||||||
}
|
}
|
||||||
sol::object lua_TestClass2_GetByName(const sol::this_state& s, TestClass2* tc, const std::string_view& name) {
|
sol::object lua_TestClass2_GetByName(const sol::this_state& s, TestClass2* tc, const std::string_view&) {
|
||||||
return sol::make_object(s, tc);
|
return sol::make_object(s, tc);
|
||||||
}
|
}
|
||||||
} // namespace sol2_test_usertypes_overload
|
} // namespace sol2_test_usertypes_overload
|
||||||
|
|
Loading…
Reference in New Issue
Block a user