/
usr
/
include
/
luabind
/
/usr/include/luabind
mkdir
upload
Name
Size
Mode
Actions
detail/
-
0755
rm
adopt_policy.hpp
5091
0644
edit
dl
rm
back_reference.hpp
3111
0644
edit
dl
rm
back_reference_fwd.hpp
1495
0644
edit
dl
rm
build_information.hpp
2015
0644
edit
dl
rm
class.hpp
27490
0644
edit
dl
rm
class_info.hpp
1704
0644
edit
dl
rm
config.hpp
5232
0644
edit
dl
rm
container_policy.hpp
4951
0644
edit
dl
rm
copy_policy.hpp
1313
0644
edit
dl
rm
dependency_policy.hpp
2691
0644
edit
dl
rm
discard_result_policy.hpp
2512
0644
edit
dl
rm
error.hpp
3345
0644
edit
dl
rm
error_callback_fun.hpp
1750
0644
edit
dl
rm
exception_handler.hpp
2086
0644
edit
dl
rm
from_stack.hpp
1485
0644
edit
dl
rm
function.hpp
1519
0644
edit
dl
rm
function_converter.hpp
4021
0644
edit
dl
rm
function_introspection.hpp
1949
0644
edit
dl
rm
get_main_thread.hpp
522
0644
edit
dl
rm
get_pointer.hpp
1554
0644
edit
dl
rm
handle.hpp
4218
0644
edit
dl
rm
intrusive_ptr_converter.hpp
1789
0644
edit
dl
rm
iterator_policy.hpp
2982
0644
edit
dl
rm
luabind.hpp
1356
0644
edit
dl
rm
lua_include.hpp
2665
0644
edit
dl
rm
lua_state_fwd.hpp
1357
0644
edit
dl
rm
make_function.hpp
3238
0644
edit
dl
rm
nil.hpp
1368
0644
edit
dl
rm
no_dependency.hpp
903
0644
edit
dl
rm
object.hpp
1291
0644
edit
dl
rm
object_fwd.hpp
331
0644
edit
dl
rm
open.hpp
1371
0644
edit
dl
rm
operator.hpp
8993
0644
edit
dl
rm
out_value_policy.hpp
12029
0644
edit
dl
rm
prefix.hpp
1265
0644
edit
dl
rm
raw_policy.hpp
2426
0644
edit
dl
rm
return_reference_to_policy.hpp
2661
0644
edit
dl
rm
scope.hpp
2944
0644
edit
dl
rm
set_package_preload.hpp
2452
0644
edit
dl
rm
shared_ptr_converter.hpp
5274
0644
edit
dl
rm
stack.hpp
4016
0644
edit
dl
rm
std_shared_ptr_converter.hpp
2271
0644
edit
dl
rm
tag_function.hpp
1622
0644
edit
dl
rm
typeid.hpp
2498
0644
edit
dl
rm
value_wrapper.hpp
4241
0644
edit
dl
rm
version.hpp
513
0644
edit
dl
rm
weak_ref.hpp
1834
0644
edit
dl
rm
wrapper_base.hpp
5987
0644
edit
dl
rm
yield_policy.hpp
1734
0644
edit
dl
rm
Edit:
/usr/include/luabind/operator.hpp
(8993B)
// Copyright (c) 2004 Daniel Wallin and Arvid Norberg // 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 OPERATOR_040729_HPP #define OPERATOR_040729_HPP #include <luabind/detail/other.hpp> #include <luabind/raw_policy.hpp> #include <boost/mpl/apply_wrap.hpp> #include <boost/mpl/eval_if.hpp> #include <boost/mpl/identity.hpp> #include <boost/preprocessor/repetition/enum_binary_params.hpp> #include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/enum_trailing.hpp> #include <boost/preprocessor/repetition/enum_trailing_params.hpp> #include <boost/type_traits/is_same.hpp> #if defined(__GNUC__) && __GNUC__ < 3 # define LUABIND_NO_STRINGSTREAM #else # if defined(BOOST_NO_STRINGSTREAM) # define LUABIND_NO_STRINGSTREAM # endif #endif #ifdef LUABIND_NO_STRINGSTREAM #include <strstream> #else #include <sstream> #endif namespace luabind { namespace detail { template<class W, class T> struct unwrap_parameter_type; template<class Derived> struct operator_ {}; struct operator_void_return {}; template<class T> inline T const& operator,(T const& x, operator_void_return) { return x; } }} // namespace luabind #include <boost/preprocessor/iteration/iterate.hpp> namespace luabind { namespace operators { #define BOOST_PP_ITERATION_PARAMS_1 (3, \ (0, LUABIND_MAX_ARITY, <luabind/detail/call_operator_iterate.hpp>)) #include BOOST_PP_ITERATE() }} // namespace luabind::operators #include <boost/preprocessor/iteration/local.hpp> namespace luabind { template<class Derived> struct self_base { operators::call_operator0<Derived> operator()() const { return 0; } #define BOOST_PP_LOCAL_MACRO(n) \ template<BOOST_PP_ENUM_PARAMS(n, class A)> \ BOOST_PP_CAT(operators::call_operator, n)< \ Derived \ BOOST_PP_ENUM_TRAILING_PARAMS(n, A) \ >\ operator()( \ BOOST_PP_ENUM_BINARY_PARAMS(n, A, const& BOOST_PP_INTERCEPT) \ ) const \ { \ return 0; \ } #define BOOST_PP_LOCAL_LIMITS (1, LUABIND_MAX_ARITY) #include BOOST_PP_LOCAL_ITERATE() }; struct self_type : self_base<self_type> { }; struct const_self_type : self_base<const_self_type> { }; namespace detail { template<class W, class T> struct unwrap_parameter_type { typedef typename boost::mpl::eval_if< boost::is_same<T, self_type> , boost::mpl::identity<W&> , boost::mpl::eval_if< boost::is_same<T, const_self_type> , boost::mpl::identity<W const&> , unwrap_other<T> > >::type type; }; template<class Derived, class A, class B> struct binary_operator : operator_<binary_operator<Derived, A, B> > { binary_operator(int) {} template<class T, class Policies> struct apply { typedef typename unwrap_parameter_type<T, A>::type arg0; typedef typename unwrap_parameter_type<T, B>::type arg1; static void execute(lua_State* L, arg0 _0, arg1 _1) { Derived::template apply<arg0, arg1, Policies>::execute( L, _0, _1); } }; static char const* name() { return Derived::name(); } }; template<class Derived, class A> struct unary_operator : operator_<unary_operator<Derived, A> > { unary_operator(int) {} template<class T, class Policies> struct apply { typedef typename unwrap_parameter_type<T, A>::type arg0; static void execute(lua_State* L, arg0 _0) { Derived::template apply<arg0, Policies>::execute(L, _0); } }; static char const* name() { return Derived::name(); } }; template<class Policies> inline void operator_result(lua_State*, operator_void_return, Policies*) { } namespace mpl = boost::mpl; template<class T, class Policies> inline void operator_result(lua_State* L, T const& x, Policies*) { typedef typename find_conversion_policy< 0 , Policies >::type cv_policy; typename mpl::apply_wrap2<cv_policy,T,cpp_to_lua>::type cv; cv.apply(L, x); } }} // namespace detail::luabind namespace luabind { #define LUABIND_BINARY_OPERATOR(name_, op) \ namespace operators { \ \ struct name_ \ { \ template<class T0, class T1, class Policies> \ struct apply \ { \ static void execute(lua_State* L, T0 _0, T1 _1) \ { \ detail::operator_result(L, _0 op _1, static_cast<Policies*>(0)); \ } \ }; \ \ static char const* name() \ { \ return "__" # name_; \ } \ }; \ \ } \ \ template<class T, class U> \ detail::binary_operator< \ operators::name_ \ , U \ , T \ > \ inline operator op(self_base<U>, T const&) \ { \ return 0; \ } \ \ template<class T, class U> \ detail::binary_operator< \ operators::name_ \ , T \ , U \ > \ inline operator op(T const&, self_base<U>) \ { \ return 0; \ } \ \ detail::binary_operator< \ operators::name_ \ , self_type \ , self_type \ > \ inline operator op(self_type, self_type) \ { \ return 0; \ } \ \ detail::binary_operator< \ operators::name_ \ , self_type \ , const_self_type \ > \ inline operator op(self_type, const_self_type) \ { \ return 0; \ } \ \ detail::binary_operator< \ operators::name_ \ , const_self_type \ , self_type \ > \ inline operator op(const_self_type, self_type) \ { \ return 0; \ } \ \ detail::binary_operator< \ operators::name_ \ , const_self_type \ , const_self_type \ > \ inline operator op(const_self_type, const_self_type) \ { \ return 0; \ } LUABIND_BINARY_OPERATOR(add, +) LUABIND_BINARY_OPERATOR(sub, -) LUABIND_BINARY_OPERATOR(mul, *) LUABIND_BINARY_OPERATOR(div, /) LUABIND_BINARY_OPERATOR(mod, %) LUABIND_BINARY_OPERATOR(pow, ^) LUABIND_BINARY_OPERATOR(lt, <) LUABIND_BINARY_OPERATOR(le, <=) LUABIND_BINARY_OPERATOR(eq, ==) #undef LUABIND_BINARY_OPERATOR #define LUABIND_UNARY_OPERATOR(name_, op, fn) \ namespace operators { \ \ struct name_ \ { \ template<class T, class Policies> \ struct apply \ { \ static void execute(lua_State* L, T x) \ { \ detail::operator_result(L, op(x), static_cast<Policies*>(0)); \ } \ }; \ \ static char const* name() \ { \ return "__" # name_; \ } \ }; \ \ } \ \ template<class T> \ detail::unary_operator< \ operators::name_ \ , T \ > \ inline fn(self_base<T>) \ { \ return 0; \ } template<class T> std::string tostring_operator(T const& x) { #ifdef LUABIND_NO_STRINGSTREAM std::strstream s; s << x << std::ends; #else std::stringstream s; s << x; #endif return s.str(); } LUABIND_UNARY_OPERATOR(tostring, tostring_operator, tostring) LUABIND_UNARY_OPERATOR(unm, -, operator-) #undef LUABIND_UNARY_OPERATOR // defined in operator.cpp LUABIND_API extern self_type self; LUABIND_API extern const_self_type const_self; } // namespace luabind #endif // OPERATOR_040729_HPP
Save
cmd:
run