• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LUABIND_DECORATE_TYPE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LUABIND_DECORATE_TYPE函数的典型用法代码示例。如果您正苦于以下问题:C++ LUABIND_DECORATE_TYPE函数的具体用法?C++ LUABIND_DECORATE_TYPE怎么用?C++ LUABIND_DECORATE_TYPE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了LUABIND_DECORATE_TYPE函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: object_cast_impl

		inline T object_cast_impl(const Obj& obj, const Policies&)
		{
			typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
			typename converter_policy::template generate_converter<T, lua_to_cpp>::type converter;

			obj.pushvalue();

			lua_State* L = obj.lua_state();
			detail::stack_pop p(L, 1);

#ifndef LUABIND_NO_ERROR_CHECKING

			if (converter.match(L, LUABIND_DECORATE_TYPE(T), -1) < 0)
			{
#ifndef LUABIND_NO_EXCEPTIONS
				throw cast_failed(L, LUABIND_TYPEID(T));
#else
				cast_failed_callback_fun e = detail::error_callback::get().cast;
				if (e) e(L, LUABIND_TYPEID(T));

				assert(0 && "object_cast failed. If you want to handle this error use luabind::set_error_callback()");
				std::terminate();
#endif
			}
#endif

			return converter.apply(L, LUABIND_DECORATE_TYPE(T), -1);
		}
开发者ID:ButchDean,项目名称:game-ai-by-example,代码行数:28,代码来源:object_funs.hpp


示例2: lua_gettop

				Ret operator[](const Policies& p)
				{
					typedef typename find_conversion_policy<0, Policies>::type converter_policy;
					typename mpl::apply_wrap2<converter_policy,Ret,lua_to_cpp>::type converter;

					m_called = true;

					// don't count the function and self-reference
					// since those will be popped by pcall
					int top = lua_gettop(L) - 2;

					// pcall will pop the function and self reference
					// and all the parameters

					detail::push_args_from_tuple<1>::apply(L, m_args, p);
# ifdef LUABIND_CPP0x
                    if (pcall(L, std::tuple_size<Tuple>::value + 1, 1))
# else
					if (pcall(L, boost::tuples::length<Tuple>::value + 1, 1))
# endif
					{
						assert(lua_gettop(L) == top + 1);
#ifndef LUABIND_NO_EXCEPTIONS
						throw error(L);
#else
						error_callback_fun e = get_error_callback();
						if (e) e(L);

						assert(0 && "the lua function threw an error and exceptions are disabled."
							"If you want to handle this error use luabind::set_error_callback()");
						std::terminate();
#endif
					}

					// pops the return values from the function
					stack_pop pop(L, lua_gettop(L) - top);

					if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
					{
						assert(lua_gettop(L) == top + 1);
#ifndef LUABIND_NO_EXCEPTIONS
						throw cast_failed(L, typeid(Ret));
#else
						cast_failed_callback_fun e = get_cast_failed_callback();
						if (e) e(L, typeid(Ret));

						assert(0 && "the lua function's return value could not be converted."
							"If you want to handle this error use luabind::set_error_callback()");
						std::terminate();
#endif
					}

					return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
				}
开发者ID:atomicstack,项目名称:ctrlr,代码行数:54,代码来源:call_member.hpp


示例3: popper

				Ret operator[](const Policies& p)
				{
					typedef typename find_conversion_policy<0, Policies>::type converter_policy;
					typename converter_policy::template generate_converter<Ret, lua_to_cpp>::type converter;

					m_called = true;
					lua_State* L = m_obj->lua_state();
					detail::stack_pop popper(L, 2); // pop the return value and the self reference

					// get the function
					m_obj->pushvalue();
					lua_pushstring(L, m_member_name);
					lua_gettable(L, -2);

					// push the self-object
					m_obj->pushvalue();

					detail::push_args_from_tuple<1>::apply(L, m_args, p);
					if (lua_pcall(L, boost::tuples::length<Tuple>::value + 1, 1, 0))
					{ 
#ifndef LUABIND_NO_EXCEPTIONS
						throw error(L);
#else
						error_callback_fun e = detail::error_callback::get().err;
						if (e) e(L);
	
						assert(0 && "the lua function threw an error and exceptions are disabled."
							"If you want to handle this error use luabind::set_error_callback()");
						std::terminate();
#endif
					}

#ifndef LUABIND_NO_ERROR_CHECKING

					if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
					{
#ifndef LUABIND_NO_EXCEPTIONS
						throw cast_failed(L, LUABIND_TYPEID(Ret));
#else
						cast_failed_callback_fun e = detail::error_callback::get().cast;
						if (e) e(L, LUABIND_TYPEID(Ret));

						assert(0 && "the lua function's return value could not be converted."
							"If you want to handle this error use luabind::set_error_callback()");
						std::terminate();
#endif
					}
#endif
					return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
				}
开发者ID:naddola,项目名称:HansungJolP,代码行数:50,代码来源:call_member.hpp


示例4: compute_score_aux

int compute_score_aux(
    lua_State*L, int index, Idx, Iter, End end, Policies const& policies)
{
    typedef typename Iter::type arg_type;
    typedef typename find_conversion_policy<Idx::value, Policies>::type
        conversion_policy;
    typedef typename mpl::apply_wrap2<
        conversion_policy, arg_type, lua_to_cpp>::type converter;

    int score = converter::match(L, LUABIND_DECORATE_TYPE(arg_type), index);

    if (score < 0)
        return score;

    if (conversion_policy::has_arg)
        ++index;

    int next = compute_score_aux(
        L
      , index
      , typename mpl::next<Idx>::type()
      , typename mpl::next<Iter>::type()
      , end
      , policies
    );

    if (next < 0)
        return next;

    return score + next;
}
开发者ID:OSUser,项目名称:avbot,代码行数:31,代码来源:compute_score.hpp


示例5: operator

		int operator()(lua_State* L, int pointer_offset, D T::*member)
		{
			int nargs = lua_gettop(L);

			// parameters on the lua stack:
			// 1. object_rep
			// 2. key (property name)
			// 3. value
			object_rep* obj = static_cast<object_rep*>(lua_touserdata(L, 1));
			class_rep* crep = obj->crep();

			void* raw_ptr;

			if (crep->has_holder())
				raw_ptr = crep->extractor()(obj->ptr());
			else
				raw_ptr = obj->ptr();

			T* ptr =  reinterpret_cast<T*>(static_cast<char*>(raw_ptr) + pointer_offset);

			typedef typename find_conversion_policy<1,Policies>::type converter_policy;
			typename mpl::apply_wrap2<converter_policy,D,lua_to_cpp>::type converter;
			ptr->*member = converter.apply(L, LUABIND_DECORATE_TYPE(D), 3);

			int nret = lua_gettop(L) - nargs;

			const int indices[] = { 1, nargs + nret, 3 };

			policy_list_postcall<Policies>::apply(L, indices);

			return nret;
		}
开发者ID:BarcampRD,项目名称:Basic_Game_AI_Barcamp2014,代码行数:32,代码来源:property.hpp


示例6: lua_gettop

    Ret operator[](const Policies& p)
    {
        typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
        typename mpl::apply_wrap2<converter_policy,Ret,lua_to_cpp>::type converter;

        m_called = true;
        lua_State* L = m_state;

        int top = lua_gettop(L);

        detail::push_args_from_tuple<1>::apply(L, m_args, p);
        if (m_fun(L, boost::tuples::length<Tuple>::value, 1))
        {
            assert(lua_gettop(L) == top - m_params + 1);
#ifndef LUABIND_NO_EXCEPTIONS
            throw error(L);
#else
            error_callback_fun e = get_error_callback();
            if (e) e(L);

            assert(0 && "the lua function threw an error and exceptions are disabled."
                   " If you want to handle the error you can use luabind::set_error_callback()");
            std::terminate();
#endif
        }

        // pops the return values from the function call
        stack_pop pop(L, lua_gettop(L) - top + m_params);

        if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
        {
#ifndef LUABIND_NO_EXCEPTIONS
            throw cast_failed(L, typeid(Ret));
#else
            cast_failed_callback_fun e = get_cast_failed_callback();
            if (e) e(L, typeid(Ret));

            assert(0 && "the lua function's return value could not be converted."
                   " If you want to handle the error you can use luabind::set_error_callback()");
            std::terminate();

#endif
        }

        return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
    }
开发者ID:radent,项目名称:luabind,代码行数:46,代码来源:call_function.hpp


示例7: get_member_signature_impl

	inline void get_member_signature_impl(T(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, string_class& s)
	{
		s += "(";
#if BOOST_PP_ITERATION() > 0
		s += name_of_type(LUABIND_DECORATE_TYPE(A0), L, 0L);
		BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_PP_ITERATION()), LUABIND_ADD_LUA_TYPE_NAME, _)
#endif
		s += ")";
	}
开发者ID:2asoft,项目名称:xray-16,代码行数:9,代码来源:get_signature.hpp


示例8: object_cast_nothrow_impl

		boost::optional<T> object_cast_nothrow_impl(const Obj& obj, const Policies&)
		{
			typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
			typename converter_policy::template generate_converter<T, lua_to_cpp>::type converter;

			obj.pushvalue();

			lua_State* L = obj.lua_state();
			detail::stack_pop p(L, 1);

#ifndef LUABIND_NO_ERROR_CHECKING

			if (converter.match(L, LUABIND_DECORATE_TYPE(T), -1) < 0)
				return boost::optional<T>();
#endif

			return boost::optional<T>(converter.apply(L, LUABIND_DECORATE_TYPE(T), -1));
		}
开发者ID:ButchDean,项目名称:game-ai-by-example,代码行数:18,代码来源:object_funs.hpp


示例9: get_free_function_signature_impl

	inline void get_free_function_signature_impl(T(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), A)), lua_State* L, std::string& s)
	{
		(void)f;
		s += "(";
#if BOOST_PP_ITERATION() > 0
		s += name_of_type(LUABIND_DECORATE_TYPE(A0), L, 0L);
		BOOST_PP_REPEAT(BOOST_PP_DEC(BOOST_PP_ITERATION()), LUABIND_ADD_LUA_TYPE_NAME, _)
#endif
		s += ")";
	}
开发者ID:LuaDist,项目名称:luabind,代码行数:10,代码来源:get_signature.hpp


示例10: operator

    int operator()(lua_State* L, int pointer_offset, D T::*member)
    {
        int nargs = lua_gettop(L);

        // parameters on the lua stack:
        // 1. object_rep
        // 2. key (property name)
        // 3. value
        object_rep* obj = static_cast<object_rep*>(lua_touserdata(L, 1));
        T* ptr =  reinterpret_cast<T*>(static_cast<char*>(obj->ptr()) + pointer_offset);

        typedef typename find_conversion_policy<1,Policies>::type converter_policy;
        typename converter_policy::template generate_converter<D,lua_to_cpp>::type converter;
        ptr->*member = converter.apply(L, LUABIND_DECORATE_TYPE(D), 3);

        int nret = lua_gettop(L) - nargs;

        const int indices[] = { 1, nargs + nret, 3 };

        policy_list_postcall<Policies>::apply(L, indices);

        return nret;
    }
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:23,代码来源:property.hpp


示例11: name_of_type

	string_class name_of_type(by_const_pointer<T>, lua_State* L, int) { return "const " + name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + "*"; };
开发者ID:2asoft,项目名称:xray-16,代码行数:1,代码来源:get_signature.hpp


示例12: apply

		static void apply(lua_State* L, string_class& s)
		{
			s += "(";
			s += name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L);
			s += ")";
		}
开发者ID:2asoft,项目名称:xray-16,代码行数:6,代码来源:get_signature.hpp


示例13: error

				Ret operator[](const Policies& p)
				{
					typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
					typename converter_policy::template generate_converter<Ret, lua_to_cpp>::type converter;

					m_called = true;
					lua_State* L = m_func->lua_state();
#ifndef LUABIND_NO_ERROR_CHECKING
					if (L == 0)
					{
	#ifndef LUABIND_NO_EXCEPTIONS
						throw error(L); 
	#else
						error_callback_fun e = get_error_callback();
						if (e) e(L);
	
						/*assert(0 && "tried to call uninitialized functor object."
							"if you want to handle this error use luabind::set_error_callback()");
						std::terminate();*/
	#endif
					}
#endif

					detail::stack_pop popper(L, 1); // pop the return value

					// get the function
					m_func->pushvalue();

					detail::push_args_from_tuple<1>::apply(L, m_args, p);
					if (pcall(L, boost::tuples::length<Tuple>::value, 1))
					{ 
#ifndef LUABIND_NO_EXCEPTIONS
						throw error(L);
#else
						error_callback_fun e = get_error_callback();
						if (e) e(L);
	
						/*assert(0 && "the lua function threw an error and exceptions are disabled."
							"if you want to handle this error use luabind::set_error_callback()");
						std::terminate();*/
#endif
					}

#ifndef LUABIND_NO_ERROR_CHECKING

					if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
					{
#ifndef LUABIND_NO_EXCEPTIONS
						throw cast_failed(L, LUABIND_TYPEID(Ret));
#else
						cast_failed_callback_fun e = get_cast_failed_callback();
						if (e) e(L, LUABIND_TYPEID(Ret));

						/*assert(0 && "the lua function's return value could not be converted."
							"if you want to handle this error use luabind::set_error_callback()");
						std::terminate();*/
#endif
					}
#endif
					return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
				}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:61,代码来源:functor.hpp


示例14: name_of_type

	std::string name_of_type(by_pointer<T>, lua_State* L, int) { return name_of_type(LUABIND_DECORATE_TYPE(T), L, 0L) + "*"; };
开发者ID:LuaDist,项目名称:luabind,代码行数:1,代码来源:get_signature.hpp


示例15: BOOST_PP_LOCAL_MACRO

int
# ifdef LUABIND_INVOKE_MEMBER
invoke_member
# else
invoke_normal
# endif
(
    lua_State* L, F const& f, Signature, Policies const&, mpl::long_<N>
# ifdef LUABIND_INVOKE_VOID
  , mpl::true_
# else
  , mpl::false_
# endif
)
{
    typedef typename mpl::begin<Signature>::type first;
# ifndef LUABIND_INVOKE_VOID
    typedef typename mpl::deref<first>::type result_type;
    typedef typename find_conversion_policy<0, Policies>::type result_policy;
    typename mpl::apply_wrap2<
        result_policy, result_type, cpp_to_lua>::type result_converter;
# endif

# if N > 0
#  define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_DECLARE_CONVERTER(n)
#  define BOOST_PP_LOCAL_LIMITS (0,N-1)
#  include BOOST_PP_LOCAL_ITERATE()
# endif

    int const arguments = lua_gettop(L);

# ifndef LUABIND_INVOKE_VOID
    result_converter.apply(
        L,
# endif
# ifdef LUABIND_INVOKE_MEMBER
        (c0.apply(L, LUABIND_DECORATE_TYPE(a0), index0).*f)(
            BOOST_PP_ENUM(BOOST_PP_DEC(N), LUABIND_INVOKE_ARG, BOOST_PP_INC)
        )
# else
#  define LUABIND_INVOKE_IDENTITY(x) x
        f(
            BOOST_PP_ENUM(N, LUABIND_INVOKE_ARG, LUABIND_INVOKE_IDENTITY)
        )
#  undef LUABIND_INVOKE_IDENTITY
# endif
# ifndef LUABIND_INVOKE_VOID
    )
# endif
    ;

# if N > 0
#  define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_CONVERTER_POSTCALL(n)
#  define BOOST_PP_LOCAL_LIMITS (0,N-1)
#  include BOOST_PP_LOCAL_ITERATE()
# endif

    int const results = lua_gettop(L) - arguments;

    int const indices[] = {
        arguments + results BOOST_PP_ENUM_TRAILING_PARAMS(N, index)
    };

    policy_list_postcall<Policies>::apply(L, indices);

    return maybe_yield(L, results, (Policies*)0);
}
开发者ID:DanielNeander,项目名称:my-3d-engine,代码行数:67,代码来源:call.hpp


示例16: apply

		static int apply(lua_State* L, int index)
		{
			typedef typename find_conversion_policy<1, Policies>::type converter_policy;
			typedef typename mpl::apply_wrap2<converter_policy,T,lua_to_cpp>::type converter;
			return converter::match(L, LUABIND_DECORATE_TYPE(T), index);
		}
开发者ID:BarcampRD,项目名称:Basic_Game_AI_Barcamp2014,代码行数:6,代码来源:property.hpp


示例17: name_of_type

	std::string name_of_type(by_const_pointer<T>, lua_State* L) { return "const " + name_of_type(LUABIND_DECORATE_TYPE(T), L) + "*"; };
开发者ID:naddola,项目名称:HansungJolP,代码行数:1,代码来源:get_signature.hpp



注:本文中的LUABIND_DECORATE_TYPE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LUACHECKOBJ函数代码示例发布时间:2022-05-30
下一篇:
C++ LTVector函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap