mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Proper deprecation to alert users to API name changes.
This commit is contained in:
parent
746ef74a61
commit
a217fa5c7a
|
@ -147,6 +147,26 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
SOL_DEPRECATED table& set_userdata(usertype<T>& user) {
|
||||
return set_usertype(user);
|
||||
}
|
||||
|
||||
template<typename Key, typename T>
|
||||
SOL_DEPRECATED table& set_userdata(Key&& key, usertype<T>& user) {
|
||||
return set_usertype(std::forward<Key>(key), user);
|
||||
}
|
||||
|
||||
template<typename Class, typename... CTor, typename... Args>
|
||||
SOL_DEPRECATED state& new_userdata(const std::string& name, Args&&... args) {
|
||||
return new_usertype<Class>(name, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<typename Class, typename... CArgs, typename... Args>
|
||||
SOL_DEPRECATED state& new_userdata(const std::string& name, constructors<CArgs...> ctor, Args&&... args) {
|
||||
return new_usertype(name, std::move(ctor), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
state& set_usertype(usertype<T>& user) {
|
||||
return set_usertype(usertype_traits<T>::name, user);
|
||||
|
|
|
@ -83,9 +83,19 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
SOL_DEPRECATED table& set_userdata(usertype<T>& user) {
|
||||
return set_usertype(user);
|
||||
}
|
||||
|
||||
template<typename Key, typename T>
|
||||
SOL_DEPRECATED table& set_userdata(Key&& key, usertype<T>& user) {
|
||||
return set_usertype(std::forward<Key>(key), user);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
table& set_usertype(usertype<T>& user) {
|
||||
return set_userdata(usertype_traits<T>::name, user);
|
||||
return set_usertype(usertype_traits<T>::name, user);
|
||||
}
|
||||
|
||||
template<typename Key, typename T>
|
||||
|
|
|
@ -90,7 +90,7 @@ inline std::string type_name(lua_State*L, type t) {
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
class userdata;
|
||||
class usertype;
|
||||
class table;
|
||||
class function;
|
||||
class object;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "function_types.hpp"
|
||||
#include "usertype_traits.hpp"
|
||||
#include "default_construct.hpp"
|
||||
#include "deprecate.hpp"
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
|
@ -315,6 +316,18 @@ public:
|
|||
template<typename... Args>
|
||||
usertype(Args&&... args): usertype(default_constructor, std::forward<Args>(args)...) {}
|
||||
|
||||
template<typename... Args>
|
||||
SOL_DEPRECATED usertype(std::string, Args&&... args): usertype(default_constructor, std::forward<Args>(args)...) {}
|
||||
|
||||
template<typename... Args>
|
||||
SOL_DEPRECATED usertype(const char*, Args&&... args): usertype(default_constructor, std::forward<Args>(args)...) {}
|
||||
|
||||
template<typename... Args, typename... CArgs>
|
||||
SOL_DEPRECATED usertype(std::string, constructors<CArgs...> c, Args&&... args) : usertype(std::move(c), std::forward<Args>(args)...) {}
|
||||
|
||||
template<typename... Args, typename... CArgs>
|
||||
SOL_DEPRECATED usertype(const char*, constructors<CArgs...> c, Args&&... args) : usertype(std::move(c), std::forward<Args>(args)...) {}
|
||||
|
||||
template<typename... Args, typename... CArgs>
|
||||
usertype(constructors<CArgs...>, Args&&... args) {
|
||||
functionnames.reserve(sizeof...(args) + 2);
|
||||
|
@ -392,6 +405,9 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using userdata = typename detail::deprecate_type<usertype<T>>::type;
|
||||
|
||||
namespace stack {
|
||||
template<typename T>
|
||||
struct pusher<usertype<T>> {
|
||||
|
|
Loading…
Reference in New Issue
Block a user