예제 #1
0
        public void AddPair(IntPtr keyPtr, IntPtr valuePtr)
        {
            IntPtr localKeyPropForCapture   = keyProp;
            IntPtr localValuePropForCapture = valueProp;

            HashDelegates.GetKeyHash keyHash = delegate(IntPtr elementKey)
            {
                return(Native_UProperty.GetValueTypeHash(localKeyPropForCapture, elementKey));
            };
            HashDelegates.Equality keyEquality = delegate(IntPtr a, IntPtr b)
            {
                return(Native_UProperty.Identical(localKeyPropForCapture, a, b, 0));
            };
            HashDelegates.ConstructAndAssign keyConstructAndAssign = delegate(IntPtr newElementKey)
            {
                if (Native_UProperty.HasAnyPropertyFlags(localKeyPropForCapture, EPropertyFlags.ZeroConstructor))
                {
                    FMemory.Memzero(newElementKey, Native_UProperty.GetSize(localKeyPropForCapture));
                }
                else
                {
                    Native_UProperty.InitializeValue(localKeyPropForCapture, newElementKey);
                }

                Native_UProperty.CopySingleValue(localKeyPropForCapture, newElementKey, keyPtr);
            };
            HashDelegates.ConstructAndAssign valueConstructAndAssign = delegate(IntPtr newElementValue)
            {
                if (Native_UProperty.HasAnyPropertyFlags(localValuePropForCapture, EPropertyFlags.ZeroConstructor))
                {
                    FMemory.Memzero(newElementValue, Native_UProperty.GetSize(localValuePropForCapture));
                }
                else
                {
                    Native_UProperty.InitializeValue(localValuePropForCapture, newElementValue);
                }

                Native_UProperty.CopySingleValue(localValuePropForCapture, newElementValue, valuePtr);
            };
            HashDelegates.Assign valueAssign = delegate(IntPtr existingElementValue)
            {
                Native_UProperty.CopySingleValue(localValuePropForCapture, existingElementValue, valuePtr);
            };
            HashDelegates.Destruct keyDestruct = delegate(IntPtr elementKey)
            {
                if (!Native_UProperty.HasAnyPropertyFlags(localKeyPropForCapture, EPropertyFlags.IsPlainOldData | EPropertyFlags.NoDestructor))
                {
                    Native_UProperty.DestroyValue(localKeyPropForCapture, elementKey);
                }
            };
            HashDelegates.Destruct valueDestruct = delegate(IntPtr elementValue)
            {
                if (!Native_UProperty.HasAnyPropertyFlags(localValuePropForCapture, EPropertyFlags.IsPlainOldData | EPropertyFlags.NoDestructor))
                {
                    Native_UProperty.DestroyValue(localValuePropForCapture, elementValue);
                }
            };
            map->Add(keyPtr, valuePtr, ref mapLayout, keyHash, keyEquality, keyConstructAndAssign, valueConstructAndAssign,
                     valueAssign, keyDestruct, valueDestruct);
        }
예제 #2
0
 public void Destroy(IntPtr mapProperty)
 {
     unsafe
     {
         fixed(FScriptSet *set = &this)
         {
             Native_UProperty.DestroyValue(mapProperty, (IntPtr)set);
         }
     }
     ZeroMemory();
 }
예제 #3
0
 /// <summary>
 /// Internal function to call into the property system to destruct elements.
 /// </summary>
 /// <param name="index">first item to .</param>
 /// <param name="count">number of items to .</param>
 private void DestructItems(int index, int count)
 {
     if (!Native_UProperty.HasAnyPropertyFlags(innerProperty, EPropertyFlags.IsPlainOldData | EPropertyFlags.NoDestructor))
     {
         IntPtr dest = GetRawPtr(index);
         for (int i = 0; i < count; i++, dest += elementSize)
         {
             Native_UProperty.DestroyValue(innerProperty, dest);
         }
     }
 }
예제 #4
0
 public void Destroy(IntPtr property)
 {
     unsafe
     {
         fixed(FScriptMap *map = &this)
         {
             Native_UProperty.DestroyValue(property, (IntPtr)map);
         }
     }
     ZeroMemory();
 }
예제 #5
0
 public void Destroy(IntPtr property)
 {
     unsafe
     {
         fixed(FScriptArray *array = &this)
         {
             Native_UProperty.DestroyValue(property, (IntPtr)array);
         }
     }
     ZeroMemory();
 }
예제 #6
0
        public void AddElement <T>(T item, MarshalingDelegates <T> .ToNative toNative)
        {
            unsafe
            {
                byte * temp    = stackalloc byte[elementSize * elementArrayDim];
                IntPtr tempPtr = (IntPtr)temp;
                Native_UProperty.InitializeValue(elementProp, tempPtr);
                toNative(tempPtr, 0, elementProp, item);

                AddElement(tempPtr);

                Native_UProperty.DestroyValue(elementProp, tempPtr);
            }
        }
예제 #7
0
        public int FindPairIndex <TKey>(TKey key, MarshalingDelegates <TKey> .ToNative keyToNative, UObject owner)
        {
            unsafe
            {
                byte * tempKey    = stackalloc byte[keySize * keyArrayDim];
                IntPtr tempKeyPtr = (IntPtr)tempKey;
                Native_UProperty.InitializeValue(keyProp, tempKeyPtr);
                keyToNative(tempKeyPtr, 0, keyProp, key);

                int index = FindPairIndexFromHash(tempKeyPtr);

                Native_UProperty.DestroyValue(keyProp, tempKeyPtr);

                return(index);
            }
        }
예제 #8
0
        public int IndexOf <T>(T item, MarshalingDelegates <T> .ToNative toNative, UObject owner)
        {
            unsafe
            {
                byte * temp    = stackalloc byte[elementSize * elementArrayDim];
                IntPtr tempPtr = (IntPtr)temp;
                Native_UProperty.InitializeValue(elementProp, tempPtr);
                toNative(tempPtr, 0, elementProp, item);

                int index = FindElementIndexFromHash(tempPtr);

                Native_UProperty.DestroyValue(elementProp, tempPtr);

                return(index);
            }
        }
예제 #9
0
        public void AddPair <TKey, TValue>(TKey key, TValue value, MarshalingDelegates <TKey> .ToNative keyToNative,
                                           MarshalingDelegates <TValue> .ToNative valueToNative)
        {
            unsafe
            {
                byte * tempKey    = stackalloc byte[keySize * keyArrayDim];
                IntPtr tempKeyPtr = (IntPtr)tempKey;
                Native_UProperty.InitializeValue(keyProp, tempKeyPtr);
                keyToNative(tempKeyPtr, 0, keyProp, key);

                byte * tempValue    = stackalloc byte[valueSize * valueArrayDim];
                IntPtr tempValuePtr = (IntPtr)tempValue;
                Native_UProperty.InitializeValue(valueProp, tempValuePtr);
                valueToNative(tempValuePtr, 0, valueProp, value);

                AddPair(tempKeyPtr, tempValuePtr);

                Native_UProperty.DestroyValue(keyProp, tempKeyPtr);
                Native_UProperty.DestroyValue(valueProp, tempValuePtr);
            }
        }
예제 #10
0
        /// <summary>
        /// Adds the element to the set, returning true if the element was added, or false if the element was already present
        /// </summary>
        public void AddElement(IntPtr elementToAdd)
        {
            IntPtr localElementPropForCapture = elementProp;

            HashDelegates.GetKeyHash elementHash = delegate(IntPtr elementKey)
            {
                return(Native_UProperty.GetValueTypeHash(localElementPropForCapture, elementKey));
            };
            HashDelegates.Equality elementEquality = delegate(IntPtr a, IntPtr b)
            {
                return(Native_UProperty.Identical(localElementPropForCapture, a, b, 0));
            };
            HashDelegates.Construct elementConstruct = delegate(IntPtr newElement)
            {
                if (Native_UProperty.HasAnyPropertyFlags(localElementPropForCapture, EPropertyFlags.ZeroConstructor))
                {
                    FMemory.Memzero(newElement, Native_UProperty.GetSize(localElementPropForCapture));
                }
                else
                {
                    Native_UProperty.InitializeValue(localElementPropForCapture, newElement);
                }

                Native_UProperty.CopySingleValue(localElementPropForCapture, newElement, elementToAdd);
            };
            HashDelegates.Destruct elementDestruct = delegate(IntPtr element)
            {
                if (!Native_UProperty.HasAnyPropertyFlags(localElementPropForCapture, EPropertyFlags.IsPlainOldData | EPropertyFlags.NoDestructor))
                {
                    Native_UProperty.DestroyValue(localElementPropForCapture, element);
                }
            };
            set->Add(
                elementToAdd,
                ref setLayout,
                elementHash,
                elementEquality,
                elementConstruct,
                elementDestruct);
        }