x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
signature_match.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\luabind\luabind\detail\signature_match.hpp
旋转
特效
属性
历史版本
// Copyright (c) 2003 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. #if !BOOST_PP_IS_ITERATING #ifndef LUABIND_SIGNATURE_MATCH_HPP_INCLUDED #define LUABIND_SIGNATURE_MATCH_HPP_INCLUDED #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace luabind { namespace detail { template
struct constructor_arity_helper { BOOST_STATIC_CONSTANT(int, value = 1); }; template<> struct constructor_arity_helper
{ BOOST_STATIC_CONSTANT(int, value = 0); }; } #define LUABIND_SUM(z, n, _) detail::constructor_arity_helper
::value + template
struct constructor { BOOST_STATIC_CONSTANT(int, arity = BOOST_PP_REPEAT(LUABIND_MAX_ARITY, LUABIND_SUM, _) 0); }; #undef LUABIND_SUM } namespace luabind { namespace detail { #define LUABIND_MATCH_DECL(Z, N,_) \ typedef typename find_conversion_policy< \ N + 1 \ , Policies \ >::type BOOST_PP_CAT(converter_policy, N); \ \ typedef typename boost::mpl::apply_wrap2< \ BOOST_PP_CAT(converter_policy, N), BOOST_PP_CAT(A, N), lua_to_cpp \ >::type BOOST_PP_CAT(converter, N); \ \ int BOOST_PP_CAT(r, N) = BOOST_PP_CAT(converter, N)::match( \ L \ , LUABIND_DECORATE_TYPE(BOOST_PP_CAT(A, N)) \ , start_index + current_index \ ); \ \ current_index += BOOST_PP_CAT(converter_policy, N)::has_arg; \ \ if (BOOST_PP_CAT(r, N) < 0) return -1; \ else m += BOOST_PP_CAT(r, N); template
struct match_constructor; #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY,
, 2)) #include BOOST_PP_ITERATE() #undef LUABIND_MATCH_DECL // this is a function that checks if the lua stack (starting at the given start_index) matches // the types in the constructor type given as 3:rd parameter. It uses the Policies given as // 4:th parameter to do the matching. It returns the total number of cast-steps that needs to // be taken in order to match the parameters on the lua stack to the given parameter-list. Or, // if the parameter doesn't match, it returns -1. template< BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, class A) , class Policies > int match_params( lua_State* L , int start_index , const constructor
* c , const Policies* p) { typedef constructor
sig_t; return match_constructor
::apply( L, start_index, c, p); } template
struct constructor_match { inline static int apply(lua_State* L) { int top = lua_gettop(L) - StartIndex + 1; if (top != Sig::arity) return -1; return match_params(L, StartIndex, (Sig*)0, (Policies*)0); }}; #define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY,
, 1)) #include BOOST_PP_ITERATE() }} #endif // LUABIND_SIGNATURE_MATCH_HPP_INCLUDED #elif BOOST_PP_ITERATION_FLAGS() == 1 #define N BOOST_PP_ITERATION() // non-const non-member function this as a pointer template< class WrappedClass , class Policies , class R BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A) > int match(R(*)( BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)) , lua_State* L , WrappedClass* , Policies const*) { typedef constructor
ParameterTypes; return match_params( L, 1, (ParameterTypes*)0, (Policies*)0); } # if (BOOST_PP_ITERATION() < (LUABIND_MAX_ARITY - 1)) // non-const member function template< class T , class WrappedClass , class Policies , class R BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, class A) > int match( R(T::*)(BOOST_PP_ENUM_PARAMS(N, A)) , lua_State* L , WrappedClass* , Policies const*) { typedef constructor< BOOST_DEDUCED_TYPENAME most_derived
::type& BOOST_PP_ENUM_TRAILING_PARAMS(N, A) > params_t; return match_params( L, 1, (params_t*)0, (Policies*)0); } // const member function template< class T , class WrappedClass , class Policies , class R BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_PARAMS(N, class A) > int match( R(T::*)(BOOST_PP_ENUM_PARAMS(N, A)) const , lua_State* L , WrappedClass* , Policies const* policies) { typedef constructor< BOOST_DEDUCED_TYPENAME most_derived
::type const& BOOST_PP_ENUM_TRAILING_PARAMS(N, A) > params_t; return match_params( L, 1, (params_t*)0, (Policies*)0); } # endif #undef N #elif BOOST_PP_ITERATION_FLAGS() == 2 #define N BOOST_PP_ITERATION() template<> struct match_constructor
{ template< BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, class A) , class Policies > static int apply( lua_State* L , int start_index , const constructor
* , const Policies*) { int m = 0; #if N int current_index = 0; #endif // Removes unreferenced local variable warning on VC7. (void)start_index; (void)L; BOOST_PP_REPEAT(N, LUABIND_MATCH_DECL, _) return m; } }; #undef N #endif
signature_match.hpp
网页地址
文件地址
上一页
40/43
下一页
下载
( 7 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.