当前位置: 首页>>代码示例>>C++>>正文


C++ MemberInfo::isStatic方法代码示例

本文整理汇总了C++中MemberInfo::isStatic方法的典型用法代码示例。如果您正苦于以下问题:C++ MemberInfo::isStatic方法的具体用法?C++ MemberInfo::isStatic怎么用?C++ MemberInfo::isStatic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MemberInfo的用法示例。


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

示例1: isNativeMemberPure

bool Type::isNativeMemberPure(bool ignoreStaticMembers)
{
    //if (!attr.isNative)
    //	return false;

    for (UTsize i = 0; i < members.size(); i++)
    {
        MemberInfo *memberInfo = members.at(i);

        if (ignoreStaticMembers && memberInfo->isStatic())
        {
            continue;
        }

        if (memberInfo->isConstructor())
        {
            ConstructorInfo *cinfo = (ConstructorInfo *)memberInfo;
            if (cinfo->defaultConstructor)
            {
                continue;
            }
        }

        if (memberInfo->isConstructor() || memberInfo->isMethod())
        {
            if (!((MethodBase *)memberInfo)->isNative())
            {
                return false;
            }
        }

        if (memberInfo->isProperty())
        {
            PropertyInfo *pinfo = (PropertyInfo *)memberInfo;
            if (pinfo->getGetMethod() && !pinfo->getGetMethod()->isNative())
            {
                return false;
            }
            if (pinfo->getSetMethod() && !pinfo->getSetMethod()->isNative())
            {
                return false;
            }
        }

        if (memberInfo->isField())
        {
            if (!memberInfo->getOrdinal())
            {
                return false;
            }
        }
    }

    if (baseType)
    {
        return baseType->isNativeMemberPure();
    }

    return true;
}
开发者ID:Ivory27,项目名称:LoomSDK,代码行数:60,代码来源:lsType.cpp

示例2: lsr_instanceindex

static int lsr_instanceindex(lua_State *L)
{
    // we hit the instance index metamethod when we can't find a value
    // in the instance's table, this is a native or a bound method

    lua_rawgeti(L, 1, LSINDEXTYPE);
    Type *type = (Type *)lua_topointer(L, -1);
    lua_pop(L, 1);

    lmAssert(type, "Missing type on instance index");

    if (lua_isnumber(L, 2))
    {
        int ordinal = (int)lua_tonumber(L, 2);

        MemberInfo *mi = type->getMemberInfoByOrdinal(ordinal);

        lmAssert(mi, "Unable to find ordinal %s %i", type->getFullName().c_str(), ordinal);

        if (mi->isStatic())
        {
            lua_rawgeti(L, 1, LSINDEXCLASS);
            lua_replace(L, 1);
            lua_gettable(L, 1);
            return 1;
        }

        // we need to look in the class, the result will be cached to instance

        MethodBase *method = NULL;

        if (mi->isMethod())
        {
            method = (MethodBase *)mi;
        }

        if (method)
        {
            lua_rawgeti(L, 1, LSINDEXCLASS);
            assert(!lua_isnil(L, -1));

            int clsIdx = lua_gettop(L);

            if (!method->isStatic())
            {
                if (method->isFastCall())
                {
                    // get the fast call structure pointer
                    lua_pushlightuserdata(L, method->getFastCall());

                    // get the the "this"
                    if (lua_type(L, 1) == LUA_TTABLE)
                    {
                        lua_rawgeti(L, 1, LSINDEXNATIVE);
                    }
                    else
                    {
                        lua_pushvalue(L, 1);
                    }

                    // unwrap this
                    Detail::UserdataPtr *p1 = (Detail::UserdataPtr *)lua_topointer(L, -1);
                    lua_pushlightuserdata(L, p1->getPointer());
                    lua_replace(L, -2);

                    lua_pushnumber(L, ordinal);
                    lua_gettable(L, clsIdx);
                }
                else
                {
                    lua_pushlightuserdata(L, method);
                    lua_pushvalue(L, 1);
                    lua_pushnumber(L, ordinal);
                    lua_gettable(L, clsIdx);
                }

                assert(!lua_isnil(L, -1));

                int nup = 3;

                int fd = method->getFirstDefaultParm();
                if (fd != -1)
                {
                    utString dname;
                    if (method->isConstructor())
                    {
                        dname = "__ls_constructor";
                    }
                    else
                    {
                        dname = method->getName();
                    }

                    dname += "__default_args";

                    lua_getfield(L, clsIdx, dname.c_str());

                    int dargs = lua_gettop(L);

                    for (int i = fd; i < method->getNumParameters(); i++)
//.........这里部分代码省略.........
开发者ID:xpeng,项目名称:LoomSDK,代码行数:101,代码来源:lsInstanceRT.cpp


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