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


C++ MetaObject::isInstanceOf方法代码示例

本文整理汇总了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;
}
开发者ID:Altazimuth,项目名称:eternity,代码行数:17,代码来源:metaapi.cpp

示例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;
}
开发者ID:camgunz,项目名称:eternity,代码行数:18,代码来源:metaapi.cpp

示例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;
}
开发者ID:Altazimuth,项目名称:eternity,代码行数:19,代码来源:metaapi.cpp

示例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;
}
开发者ID:camgunz,项目名称:eternity,代码行数:24,代码来源:metaapi.cpp

示例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;
}
开发者ID:camgunz,项目名称:eternity,代码行数:25,代码来源:metaapi.cpp

示例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;
}
开发者ID:camgunz,项目名称:eternity,代码行数:27,代码来源:metaapi.cpp


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