mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-13 23:28:21 +00:00
Revert "Build System Updated"
This commit is contained in:
@@ -23,86 +23,88 @@
|
||||
#ifndef LUABIND_BACK_REFERENCE_040510_HPP
|
||||
#define LUABIND_BACK_REFERENCE_040510_HPP
|
||||
|
||||
#include <luabind/config.hpp>
|
||||
#include <luabind/lua_state_fwd.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(LUABIND_NO_RTTI) && !defined(LUABIND_WRAPPER_BASE_HPP_INCLUDED)
|
||||
#include <luabind/lua_include.hpp>
|
||||
#include <luabind/wrapper_base.hpp>
|
||||
#endif
|
||||
|
||||
#include <luabind/pointer_traits.hpp>
|
||||
#include <luabind/detail/has_get_pointer.hpp>
|
||||
#include <luabind/get_pointer.hpp>
|
||||
#include <boost/type_traits/is_polymorphic.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
namespace luabind {
|
||||
struct wrap_base;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux0(T const* p, std::true_type)
|
||||
{
|
||||
return dynamic_cast<wrap_base const*>(p);
|
||||
}
|
||||
namespace detail
|
||||
{
|
||||
namespace mpl = boost::mpl;
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux0(T const* p, mpl::true_)
|
||||
{
|
||||
return dynamic_cast<wrap_base const*>(p);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux0(T const*, std::false_type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux0(T const*, mpl::false_)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux1(T const* p)
|
||||
{
|
||||
return get_back_reference_aux0(p, std::is_polymorphic<T>());
|
||||
}
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux1(T const* p)
|
||||
{
|
||||
return get_back_reference_aux0(p, boost::is_polymorphic<T>());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux2(T const& x, std::true_type)
|
||||
{
|
||||
return get_back_reference_aux1(get_pointer(x));
|
||||
}
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux2(T const& x, mpl::true_)
|
||||
{
|
||||
return get_back_reference_aux1(get_pointer(x));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux2(T const& x, std::false_type)
|
||||
{
|
||||
return get_back_reference_aux1(&x);
|
||||
}
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference_aux2(T const& x, mpl::false_)
|
||||
{
|
||||
return get_back_reference_aux1(&x);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference(T const& x)
|
||||
{
|
||||
return detail::get_back_reference_aux2(x, has_get_pointer<T>());
|
||||
}
|
||||
template<class T>
|
||||
wrap_base const* get_back_reference(T const& x)
|
||||
{
|
||||
return detail::get_back_reference_aux2(
|
||||
x
|
||||
, has_get_pointer<T>()
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class T>
|
||||
bool get_back_reference(lua_State* L, T const& x)
|
||||
{
|
||||
template<class T>
|
||||
bool get_back_reference(lua_State* L, T const& x)
|
||||
{
|
||||
#ifndef LUABIND_NO_RTTI
|
||||
if(wrap_base const* w = detail::get_back_reference(x))
|
||||
{
|
||||
detail::wrap_access::ref(*w).get(L);
|
||||
return true;
|
||||
}
|
||||
if (wrap_base const* w = detail::get_back_reference(x))
|
||||
{
|
||||
detail::wrap_access::ref(*w).get(L);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool move_back_reference(lua_State* L, T const& x)
|
||||
{
|
||||
template<class T>
|
||||
bool move_back_reference(lua_State* L, T const& x)
|
||||
{
|
||||
#ifndef LUABIND_NO_RTTI
|
||||
if(wrap_base* w = const_cast<wrap_base*>(detail::get_back_reference(x)))
|
||||
{
|
||||
assert(detail::wrap_access::ref(*w).m_strong_ref.is_valid());
|
||||
detail::wrap_access::ref(*w).get(L);
|
||||
detail::wrap_access::ref(*w).m_strong_ref.reset();
|
||||
return true;
|
||||
}
|
||||
if (wrap_base* w = const_cast<wrap_base*>(detail::get_back_reference(x)))
|
||||
{
|
||||
assert(detail::wrap_access::ref(*w).m_strong_ref.is_valid());
|
||||
detail::wrap_access::ref(*w).get(L);
|
||||
detail::wrap_access::ref(*w).m_strong_ref.reset();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace luabind
|
||||
|
||||
|
||||
Reference in New Issue
Block a user