本文整理汇总了C++中MetaObject::isInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaObject::isInstanceOf方法的具体用法?C++ MetaObject::isInstanceOf怎么用?C++ MetaObject::isInstanceOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaObject
的用法示例。
在下文中一共展示了MetaObject::isInstanceOf方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
//
// MetaTable::getObjectKeyAndType
//
// As above, but satisfying both conditions at once.
//
MetaObject *MetaTable::getObjectKeyAndType(const char *key, const MetaObject::Type *type) const
{
MetaObject *obj = nullptr;
while((obj = pImpl->keyhash.keyIterator(obj, key)))
{
if(obj->isInstanceOf(type))
break;
}
return obj;
}
示例2: countOfKeyAndType
//
// MetaTable::countOfKeyAndType
//
// As above, but satisfying both conditions at once.
//
int MetaTable::countOfKeyAndType(const char *key, const char *type)
{
MetaObject *obj = NULL;
int count = 0;
while((obj = pImpl->keyhash.keyIterator(obj, key)))
{
if(obj->isInstanceOf(type))
++count;
}
return count;
}
示例3: MetaKeyForIndex
//
// MetaTable::getObjectKeyAndType
//
// Overload taking a MetaObject interned key index and RTTIObject::Type
// instance.
//
MetaObject *MetaTable::getObjectKeyAndType(size_t keyIndex, const MetaObject::Type *type) const
{
metakey_t &keyObj = MetaKeyForIndex(keyIndex);
MetaObject *obj = nullptr;
while((obj = pImpl->keyhash.keyIterator(obj, keyObj.key, keyObj.unmodHC)))
{
if(obj->isInstanceOf(type))
break;
}
return obj;
}
示例4: hasKeyAndType
//
// MetaTable::hasKeyAndType
//
// Returns true if an object exists in the table of both the specified key
// and type, and it is the same object. This is naturally slower as it must
// search down the key hash chain for a type match.
//
bool MetaTable::hasKeyAndType(const char *key, const char *type)
{
MetaObject *obj = NULL;
bool found = false;
while((obj = pImpl->keyhash.keyIterator(obj, key)))
{
// for each object that matches the key, test the type
if(obj->isInstanceOf(type))
{
found = true;
break;
}
}
return found;
}
示例5: MetaKeyForIndex
//
// MetaTable::getNextKeyAndType
//
// Overload taking a MetaObject interned key index.
//
MetaObject *MetaTable::getNextKeyAndType(MetaObject *object, size_t keyIdx, const char *type)
{
MetaObject *obj = object;
metakey_t &keyObj = MetaKeyForIndex(keyIdx);
if(object)
{
// As above, allow NULL in type to mean "same as current"
if(!type)
type = object->getClassName();
}
while((obj = pImpl->keyhash.keyIterator(obj, keyObj.key, keyObj.unmodHC)))
{
if(obj->isInstanceOf(type))
break;
}
return obj;
}
示例6: while
//
// MetaTable::getNextKeyAndType
//
// As above, but satisfying both conditions at once.
//
MetaObject *MetaTable::getNextKeyAndType(MetaObject *object, const char *key, const char *type)
{
MetaObject *obj = object;
if(object)
{
// As above, allow NULL in either key or type to mean "same as current"
if(!key)
key = object->getKey();
if(!type)
type = object->getClassName();
}
while((obj = pImpl->keyhash.keyIterator(obj, key)))
{
if(obj->isInstanceOf(type))
break;
}
return obj;
}