forked from enlightenment/efl
csharp: Add code to update IList passed as @in variable
If the array was modified, we update the passed @in variable.
This commit is contained in:
parent
ae76c7059d
commit
9b3a725e60
|
@ -1095,6 +1095,17 @@ struct convert_in_ptr_assign_generator
|
|||
string << " = " << in_variable_name(param.param_name) << ";\n"
|
||||
).generate(sink, escape_keyword(param.param_name), context);
|
||||
}
|
||||
else if (param_is_acceptable(param, "Eina_Array *", WANT_OWN, !WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Array *", !WANT_OWN, !WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Array *", WANT_OWN, !WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Array *", !WANT_OWN, !WANT_OUT)
|
||||
)
|
||||
{
|
||||
return as_generator(
|
||||
lit("Efl.Eo.Globals.UpdateListFromNativeArray(") << escape_keyword(param.param_name) << ", " << in_variable_name(param.param_name) << ");\n"
|
||||
).generate(sink, attributes::unused, context);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -853,12 +853,9 @@ public static class Globals
|
|||
if (nativeArray == IntPtr.Zero)
|
||||
throw new ArgumentException("nativeArray is null", nameof(nativeArray));
|
||||
|
||||
uint count = Eina.ArrayNativeFunctions.eina_array_count_custom_export_mono(nativeArray);
|
||||
List<T> list = new List<T>();
|
||||
for (uint i = 0; i < count; i++)
|
||||
{
|
||||
list.Add(Eina.TraitFunctions.NativeToManaged<T>(Eina.ArrayNativeFunctions.eina_array_data_get_custom_export_mono(nativeArray, i)));
|
||||
}
|
||||
UpdateListFromNativeArray(list, nativeArray);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -875,6 +872,21 @@ public static class Globals
|
|||
return nativeArray;
|
||||
}
|
||||
|
||||
internal static void UpdateListFromNativeArray<T>(IList<T> list, IntPtr nativeArray)
|
||||
{
|
||||
list.Clear();
|
||||
if (nativeArray == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint count = Eina.ArrayNativeFunctions.eina_array_count_custom_export_mono(nativeArray);
|
||||
for (uint i = 0; i < count; i++)
|
||||
{
|
||||
list.Add(Eina.TraitFunctions.NativeToManaged<T>(Eina.ArrayNativeFunctions.eina_array_data_get_custom_export_mono(nativeArray, i)));
|
||||
}
|
||||
}
|
||||
|
||||
} // Globals
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue