本文整理汇总了C++中MemberInfo::isProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ MemberInfo::isProperty方法的具体用法?C++ MemberInfo::isProperty怎么用?C++ MemberInfo::isProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemberInfo
的用法示例。
在下文中一共展示了MemberInfo::isProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: findMember
PropertyInfo *Type::findPropertyInfoByName(const char *name)
{
MemberInfo *mi = findMember(name);
if (mi && mi->isProperty())
{
return (PropertyInfo *)mi;
}
return NULL;
}
示例3: findMembers
void Type::findMembers(const MemberTypes& memberTypes,
utArray<MemberInfo *>& membersOut, bool includeBases, bool includePropertyGetterSetters)
{
if (!includeBases)
{
membersOut.clear();
}
for (size_t i = 0; i < members.size(); i++)
{
MemberInfo *m = members.at((int)i);
if (m->isConstructor() && memberTypes.constructor)
{
membersOut.push_back(m);
}
if (m->isMethod() && memberTypes.method)
{
membersOut.push_back(m);
}
if (m->isField() && memberTypes.field)
{
membersOut.push_back(m);
}
if (m->isProperty() && memberTypes.property)
{
membersOut.push_back(m);
if (includePropertyGetterSetters)
{
PropertyInfo *p = (PropertyInfo *)m;
if (p->getter && (p->getter->getDeclaringType() == p->getDeclaringType()))
{
membersOut.push_back(p->getter);
}
if (p->setter && (p->setter->getDeclaringType() == p->getDeclaringType()))
{
membersOut.push_back(p->setter);
}
}
}
}
if (baseType && includeBases)
{
baseType->findMembers(memberTypes, membersOut, true, includePropertyGetterSetters);
}
}
示例4: lsr_instanceindex
//.........这里部分代码省略.........
lua_pushcclosure(L, lsr_method, nup);
}
// store to method lookup, this is worth it
// as only happens once per instance method bind
// and can now lookup MethodBase on any function
// in one table lookup
lua_rawgeti(L, LUA_GLOBALSINDEX, LSINDEXMETHODLOOKUP);
lua_pushvalue(L, -2);
lua_pushlightuserdata(L, method);
lua_rawset(L, -3);
lua_pop(L, 1);
// cache to instance
lua_pushvalue(L, -1);
lua_rawseti(L, 1, ordinal);
return 1;
}
else
{
assert(0);
}
}
FieldInfo *field = NULL;
if (mi->isField())
{
field = (FieldInfo *)mi;
}
if (field && field->isNative())
{
// for primitive fields, we could generate
// a direct lookup in the LSINDEXNATIVE table
// in bytecode gen, however this only saves for
// native vars and not properties
// (which should be using fast path anyway and complicates bytecode)
// get the native userdata
lua_rawgeti(L, 1, LSINDEXNATIVE);
lua_pushnumber(L, field->getOrdinal());
lua_gettable(L, -2);
// if we are native we need to wrap
if (lua_isuserdata(L, -1))
{
lualoom_pushnative_userdata(L, field->getType(), -1);
}
return 1;
}
// if we get here the value actually is null
lua_pushnil(L);
return 1;
}
// if we hit here, this should be an interface access where we have to
// look up by string (and cache as these are only ever instance methods)
const char *name = lua_tostring(L, 2);
const char *pname = name;
MemberInfo *mi = NULL;
if (!strncmp(name, "__pget_", 7))
{
pname = &name[7];
mi = type->findMember(pname, true);
lmAssert(mi && mi->isProperty(), "Could not find property getter for '%s' on type '%s'", pname, type->getFullName().c_str());
mi = ((PropertyInfo *)mi)->getGetMethod();
lmAssert(mi, "Found NULL property getter for '%s' on type '%s'", pname, type->getFullName().c_str());
}
else if (!strncmp(name, "__pset_", 7))
{
pname = &name[7];
mi = type->findMember(pname, true);
lmAssert(mi && mi->isProperty(), "Could not find property setter for '%s' on type '%s'", pname, type->getFullName().c_str());
mi = ((PropertyInfo *)mi)->getSetMethod();
lmAssert(mi, "Found NULL property setter for '%s' on type '%s'", pname, type->getFullName().c_str());
}
else
{
mi = type->findMember(name, true);
lmAssert(mi, "Unable to find member '%s' via string on instance of type %s", name, type->getFullName().c_str());
assert(mi);
assert(mi->isMethod());
assert(mi->getOrdinal());
}
lua_pushnumber(L, mi->getOrdinal());
lua_gettable(L, 1);
lua_pushstring(L, name);
lua_pushvalue(L, -2);
lua_rawset(L, 1);
return 1;
}