From 3797f1992609679b39711720fac69079fadf85c1 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Wed, 4 Dec 2019 14:54:33 +0100 Subject: C#: Add Duplicate method to the Array and Dictionary bindings --- modules/mono/glue/Managed/Files/Array.cs | 13 +++++++++++++ modules/mono/glue/Managed/Files/Dictionary.cs | 13 +++++++++++++ 2 files changed, 26 insertions(+) (limited to 'modules/mono/glue/Managed') diff --git a/modules/mono/glue/Managed/Files/Array.cs b/modules/mono/glue/Managed/Files/Array.cs index 0e7b0362e0..aba1065498 100644 --- a/modules/mono/glue/Managed/Files/Array.cs +++ b/modules/mono/glue/Managed/Files/Array.cs @@ -64,6 +64,11 @@ namespace Godot.Collections return safeHandle.DangerousGetHandle(); } + public Array Duplicate(bool deep = false) + { + return new Array(godot_icall_Array_Duplicate(GetPtr(), deep)); + } + public Error Resize(int newSize) { return godot_icall_Array_Resize(GetPtr(), newSize); @@ -178,6 +183,9 @@ namespace Godot.Collections [MethodImpl(MethodImplOptions.InternalCall)] internal extern static void godot_icall_Array_CopyTo(IntPtr ptr, System.Array array, int arrayIndex); + [MethodImpl(MethodImplOptions.InternalCall)] + internal extern static IntPtr godot_icall_Array_Duplicate(IntPtr ptr, bool deep); + [MethodImpl(MethodImplOptions.InternalCall)] internal extern static int godot_icall_Array_IndexOf(IntPtr ptr, object item); @@ -250,6 +258,11 @@ namespace Godot.Collections return from.objectArray; } + public Array Duplicate(bool deep = false) + { + return new Array(objectArray.Duplicate(deep)); + } + public Error Resize(int newSize) { return objectArray.Resize(newSize); diff --git a/modules/mono/glue/Managed/Files/Dictionary.cs b/modules/mono/glue/Managed/Files/Dictionary.cs index 6ab8549a01..d72109de92 100644 --- a/modules/mono/glue/Managed/Files/Dictionary.cs +++ b/modules/mono/glue/Managed/Files/Dictionary.cs @@ -80,6 +80,11 @@ namespace Godot.Collections disposed = true; } + public Dictionary Duplicate(bool deep = false) + { + return new Dictionary(godot_icall_Dictionary_Duplicate(GetPtr(), deep)); + } + // IDictionary public ICollection Keys @@ -234,6 +239,9 @@ namespace Godot.Collections [MethodImpl(MethodImplOptions.InternalCall)] internal extern static bool godot_icall_Dictionary_ContainsKey(IntPtr ptr, object key); + [MethodImpl(MethodImplOptions.InternalCall)] + internal extern static IntPtr godot_icall_Dictionary_Duplicate(IntPtr ptr, bool deep); + [MethodImpl(MethodImplOptions.InternalCall)] internal extern static bool godot_icall_Dictionary_RemoveKey(IntPtr ptr, object key); @@ -313,6 +321,11 @@ namespace Godot.Collections return objectDict.GetPtr(); } + public Dictionary Duplicate(bool deep = false) + { + return new Dictionary(objectDict.Duplicate(deep)); + } + // IDictionary public TValue this[TKey key] -- cgit v1.2.3