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

Method setDynamic

include/Array.h:1071–1099  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1069 #endif
1070
1071 inline void setDynamic( const Dynamic &inRHS, bool inIgnoreVirtualArray=false )
1072 {
1073 hx::Object *ptr = inRHS.GetPtr();
1074 if (ptr)
1075 {
1076 OBJ_ *arr = dynamic_cast<OBJ_ *>(ptr);
1077 if (!arr && ptr->__GetClass().mPtr == super::__SGetClass().mPtr )
1078 {
1079 #ifdef HX_VARRAY_DEFINED
1080 cpp::VirtualArray_obj *varray = inIgnoreVirtualArray ? 0 :
1081 dynamic_cast<cpp::VirtualArray_obj *>(ptr);
1082 if (varray)
1083 fromVArray(varray);
1084 else
1085 #endif
1086 {
1087 // Non-identical type.
1088 // Copy elements one-by-one
1089 // Not quite right, but is the best we can do...
1090 int n = ptr->__length();
1091 *this = Array_obj<ELEM_>::__new(n);
1092 for(int i=0;i<n;i++)
1093 mPtr->__unsafe_set(i,ptr->__GetItem(i));
1094 }
1095 }
1096 else
1097 mPtr = arr;
1098 }
1099 }
1100
1101 Array( const Dynamic &inRHS ) : super(0) { setDynamic(inRHS); }
1102 Array( const cpp::ArrayBase &inRHS ) : super(0) { setDynamic(inRHS); }

Callers 1

setValueMethod · 0.45

Calls 6

__newFunction · 0.85
GetPtrMethod · 0.80
__unsafe_setMethod · 0.80
__GetClassMethod · 0.45
__lengthMethod · 0.45
__GetItemMethod · 0.45

Tested by

no test coverage detected