Dynamic __int_hash_values(Dynamic &ioHash) { IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr()); if (!hash) return Array_obj<Dynamic>::__new(); return hash->values(); }
void __int_hash_set(Dynamic &ioHash,int inKey,const Dynamic &value) { IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr()); if (!hash) { #ifdef HX_DYNAMIC_HASH_VALUES hash = new IntHashObject(); #else if (value==null()) { hash = new IntHashObject(); } else { hxObjectType type = (hxObjectType)value->__GetType(); if (type==vtInt) hash = new IntHashInt(); else if (type==vtFloat) hash = new IntHashFloat(); else if (type==vtString) hash = new IntHashString(); else // Object or bool hash = new IntHashObject(); } #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); }
Array<int> __int_hash_keys(Dynamic &ioHash) { IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr()); if (!hash) return Array_obj<int>::__new(); return hash->keys(); }
bool __int_hash_remove(Dynamic &ioHash,int inKey) { IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr()); if (!hash) return false; return hash->remove(inKey); }
String __int_hash_to_string(Dynamic &ioHash) { IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr()); if (hash) return hash->toString(); return HX_CSTRING("{}"); }
void __int_hash_set(Dynamic &ioHash,int inKey,const Dynamic &value) { IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr()); if (!hash) { if (value==null()) { hash = new IntHashObject(); } else { ObjectType type = (ObjectType)value->__GetType(); if (type==vtBool || type==vtInt) hash = new IntHashInt(); else if (type==vtFloat) hash = new IntHashFloat(); else if (type==vtString) hash = new IntHashString(); else hash = new IntHashObject(); } 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); }
Dynamic __int_hash_get(Dynamic &ioHash,int inKey) { IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr()); if (!hash) return null(); Dynamic result = null(); hash->query(inKey,result); return result; }
void __int_hash_set_int(Dynamic &ioHash,int inKey,int inValue) { IntHashBase *hash = static_cast<IntHashBase *>(ioHash.GetPtr()); if (!hash) { hash = new IntHashInt(); ioHash = hash; } else if (hash->store==hashString) { hash = hash->convertStore(hashObject); ioHash = hash; } ioHash.mPtr = hash->set(inKey,inValue); }