示例#1
0
//
// 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
0
//
// 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
0
//
// 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
0
//
// 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
0
//
// 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
0
//
// 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;
}