Пример #1
0
void __object_hash_set_float(Dynamic &ioHash,Dynamic inKey,Float inValue,bool inWeakKeys)
{
   DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
   if (!hash)
   {
      hash = inWeakKeys ?  (DynamicHashBase *)new WeakDynamicHashFloat() :
                           (DynamicHashBase *)new DynamicHashFloat();
      ioHash = hash;
   }
   else if (hash->store==hashString)
   {
      hash = hash->convertStore(hashObject);
      ioHash = hash;
   }
   else if (hash->store==hashInt)
   {
      hash = hash->convertStore(hashFloat);
      ioHash = hash;
   }

   hash->set(inKey,inValue);
}
Пример #2
0
void __object_hash_set_string(Dynamic &ioHash,Dynamic inKey, ::String inValue,bool inWeakKeys)
{
   toRealObject(inKey);
   DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
   if (!hash)
   {
      hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashString() :
                          (DynamicHashBase *)new DynamicHashString();
      ioHash = hash;
   }
   else if (hash->store==hashInt || hash->store==hashFloat)
   {
      hash = hash->convertStore(hashObject);
      ioHash = hash;
   }

   ioHash.mPtr = hash->set(inKey,inValue);
}
Пример #3
0
void __object_hash_set(Dynamic &ioHash,Dynamic inKey,const Dynamic &value,bool inWeakKeys)
{
   toRealObject(inKey);
   DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
   if (!hash)
   {
      #ifdef HX_DYNAMIC_HASH_VALUES
      hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashObject() :
                          (DynamicHashBase *)new DynamicHashObject();
      #else
      if (value==null())
      {
         hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashObject() :
                             (DynamicHashBase *)new DynamicHashObject();
      }
      else
      {
         hxObjectType type = (hxObjectType)value->__GetType();
         if (type==vtInt)
         {
            hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashInt() :
                                (DynamicHashBase *)new DynamicHashInt();
         }
         else if (type==vtFloat)
            hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashFloat() :
                                (DynamicHashBase *)new DynamicHashFloat();
         else if (type==vtString)
            hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashString() :
                                (DynamicHashBase *)new DynamicHashString();
         else
            hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashObject() :
                                (DynamicHashBase *)new DynamicHashObject();
      }
      #endif
      ioHash = hash;
   }
   else if (hash->store!=hashObject)
   {
      HashStore want = hashObject;
      if (value!=null())
      {
         hxObjectType type = (hxObjectType)value->__GetType();
         if (type==vtInt)
         {
            if (hash->store==hashFloat)
               want = hashFloat;
            else if (hash->store==hashInt)
               want = hashInt;
         }
         else if (type==vtFloat)
         {
            if (hash->store==hashInt || hash->store==hashFloat) 
               want =hashFloat;
         }
         else if (type==vtString)
         {
            if (hash->store==hashString)
               want = hashString;
         }
      }
      if (hash->store!=want)
      {
         hash = hash->convertStore(want);
         ioHash = hash;
      }
   }

   ioHash.mPtr = hash->set(inKey,value);
}
Пример #4
0
void __object_hash_set(Dynamic &ioHash,Dynamic inKey,const Dynamic &value,bool inWeakKeys)
{
   DynamicHashBase *hash = static_cast<DynamicHashBase *>(ioHash.GetPtr());
   if (!hash)
   {
      if (value==null())
      {
         hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashObject() :
                             (DynamicHashBase *)new DynamicHashObject();
      }
      else
      {
         ObjectType type = (ObjectType)value->__GetType();
         if (type==vtBool || type==vtInt)
         {
            hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashInt() :
                                (DynamicHashBase *)new DynamicHashInt();
         }
         else if (type==vtFloat)
            hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashFloat() :
                                (DynamicHashBase *)new DynamicHashFloat();
         else if (type==vtString)
            hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashString() :
                                (DynamicHashBase *)new DynamicHashString();
         else
            hash = inWeakKeys ? (DynamicHashBase *)new WeakDynamicHashObject() :
                                (DynamicHashBase *)new DynamicHashObject();
      }
      ioHash = hash;
   }
   else if (hash->store!=hashObject)
   {
      HashStore want = hashObject;
      if (value!=null())
      {
         ObjectType type = (ObjectType)value->__GetType();
         if (type==vtBool || type==vtInt)
         {
            if (hash->store==hashFloat)
               want = hashFloat;
            else if (hash->store==hashInt)
               want = hashInt;
         }
         else if (type==vtFloat)
         {
            if (hash->store==hashInt || hash->store==hashFloat) 
               want =hashFloat;
         }
         else if (type==vtString)
         {
            if (hash->store==hashString)
               want = hashString;
         }
      }
      if (hash->store!=want)
      {
         hash = hash->convertStore(want);
         ioHash = hash;
      }
   }

   hash->set(inKey,value);
}