MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / __string_hash_set

Function __string_hash_set

src/hx/Hash.cpp:580–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578
579
580void __string_hash_set(HX_MAP_THIS_ARG,String inKey,const Dynamic &value, bool inForceDynamic)
581{
582 StringHashBase *hash = static_cast<StringHashBase *>(ioHash.GetPtr());
583 if (!hash)
584 {
585 if (inForceDynamic || value==null() )
586 {
587 hash = new StringHashObject();
588 }
589 else
590 {
591 hxObjectType type = (hxObjectType)value->__GetType();
592 switch (type)
593 {
594 case vtInt : hash = new StringHashInt(); break;
595 case vtFloat : hash = new StringHashFloat(); break;
596 case vtString: hash = new StringHashString(); break;
597 case vtInt64 : hash = new StringHashInt64(); break;
598 default : hash = new StringHashObject(); break;
599 }
600 }
601 ioHash = hash;
602 HX_OBJ_WB_GET(owner,hash);
603 }
604 else if (hash->store!=hashObject)
605 {
606 HashStore want = hashObject;
607 if (value!=null())
608 {
609 hxObjectType type = (hxObjectType)value->__GetType();
610 if (type==vtInt)
611 {
612 if (hash->store==hashFloat)
613 want = hashFloat;
614 else if (hash->store==hashInt)
615 want = hashInt;
616 else if (hash->store==hashInt64)
617 want = hashInt64;
618 }
619 else if (type==vtFloat)
620 {
621 if (hash->store==hashInt || hash->store==hashFloat)
622 want = hashFloat;
623 }
624 else if (type==vtString)
625 {
626 if (hash->store==hashString)
627 want = hashString;
628 }
629 else if (type==vtInt64)
630 {
631 if (hash->store==hashInt || hash->store==hashInt64)
632 want = hashInt64;
633 }
634 }
635 if (hash->store!=want)
636 {
637 hash = hash->convertStore(want);

Callers 1

FieldMapSetFunction · 0.85

Calls 5

GetPtrMethod · 0.80
convertStoreMethod · 0.80
nullClass · 0.50
__GetTypeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected