csharp: Update after iterator changes
Summary: Iterator and Accessors are views only, not owning the data they point to. Also updated the tests by handling some test data that were leaking. Fixes T8036 Reviewers: vitor.sousa, felipealmeida Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers, segfaultxavi, q66 Tags: #efl Maniphest Tasks: T8036 Differential Revision: https://phab.enlightenment.org/D9189
This commit is contained in:
parent
920a1b4a52
commit
967e32d27a
|
@ -604,8 +604,6 @@ struct native_convert_in_variable_generator
|
|||
}
|
||||
else if (param.type.c_type == "Eina_Array *" || param.type.c_type == "const Eina_Array *"
|
||||
|| param.type.c_type == "Eina_List *" || param.type.c_type == "const Eina_List *"
|
||||
|| param.type.c_type == "Eina_Iterator *" || param.type.c_type == "const Eina_Iterator *"
|
||||
|| param.type.c_type == "Eina_Accessor *" || param.type.c_type == "const Eina_Accessor *"
|
||||
)
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
|
@ -618,6 +616,19 @@ struct native_convert_in_variable_generator
|
|||
<< ");\n"
|
||||
).generate(sink, std::make_tuple(in_variable_name(param.param_name), param.type), context);
|
||||
}
|
||||
else if (param.type.c_type == "Eina_Iterator *" || param.type.c_type == "const Eina_Iterator *"
|
||||
|| param.type.c_type == "Eina_Accessor *" || param.type.c_type == "const Eina_Accessor *"
|
||||
)
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
return as_generator(
|
||||
"var " << string << " = new " << type << "(" << escape_keyword(param.param_name)
|
||||
<< ", " << (param.type.has_own ? "true" : "false")
|
||||
<< ");\n"
|
||||
).generate(sink, std::make_tuple(in_variable_name(param.param_name), param.type), context);
|
||||
}
|
||||
else if (param.type.c_type == "Eina_Value")
|
||||
{
|
||||
return as_generator(
|
||||
|
@ -706,6 +717,13 @@ struct convert_in_variable_generator
|
|||
escape_keyword(param.param_name) << ".Own = false;\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// Iterators and Accessors can't own their content.
|
||||
if (param.type.c_type == "Eina_Iterator *" || param.type.c_type == "const Eina_Iterator *"
|
||||
|| param.type.c_type == "Eina_Accessor *" || param.type.c_type == "const Eina_Accessor *"
|
||||
)
|
||||
return true;
|
||||
|
||||
if (complex->subtypes.front().has_own && !as_generator(
|
||||
escape_keyword(param.param_name) << ".OwnContent = false;\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
|
@ -937,14 +955,6 @@ struct convert_out_assign_generator
|
|||
|| param_is_acceptable(param, "Eina_List *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_List *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_List *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Accessor *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Accessor *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Accessor *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Accessor *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Iterator *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Iterator *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Iterator *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Iterator *", !WANT_OWN, WANT_OUT)
|
||||
)
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
|
@ -957,6 +967,25 @@ struct convert_out_assign_generator
|
|||
<< ");\n"
|
||||
).generate(sink, std::make_tuple(escape_keyword(param.param_name), param.type, out_variable_name(param.param_name)), context);
|
||||
}
|
||||
else if (param_is_acceptable(param, "Eina_Iterator *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Iterator *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Iterator *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Iterator *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Accessor *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Accessor *", !WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Accessor *", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "const Eina_Accessor *", !WANT_OWN, WANT_OUT)
|
||||
)
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(¶m.type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
return as_generator(
|
||||
string << " = new " << type << "(" << string
|
||||
<< ", " << (param.type.has_own ? "true" : "false")
|
||||
<< ");\n"
|
||||
).generate(sink, std::make_tuple(escape_keyword(param.param_name), param.type, out_variable_name(param.param_name)), context);
|
||||
}
|
||||
else if (param_is_acceptable(param, "Eina_Value", WANT_OWN, WANT_OUT)
|
||||
|| param_is_acceptable(param, "Eina_Value", !WANT_OWN, WANT_OUT))
|
||||
{
|
||||
|
@ -1057,9 +1086,7 @@ struct convert_return_generator
|
|||
}
|
||||
else if (ret_type.c_type == "Eina_Array *" || ret_type.c_type == "const Eina_Array *"
|
||||
|| ret_type.c_type == "Eina_List *" || ret_type.c_type == "const Eina_List *"
|
||||
|| ret_type.c_type == "Eina_Iterator *" || ret_type.c_type == "const Eina_Iterator *"
|
||||
|| ret_type.c_type == "Eina_Accessor *" || ret_type.c_type == "const Eina_Accessor *"
|
||||
)
|
||||
)
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&ret_type.original_type);
|
||||
if (!complex)
|
||||
|
@ -1070,6 +1097,17 @@ struct convert_return_generator
|
|||
.generate(sink, ret_type, context))
|
||||
return false;
|
||||
}
|
||||
else if(ret_type.c_type == "Eina_Iterator *" || ret_type.c_type == "const Eina_Iterator *"
|
||||
|| ret_type.c_type == "Eina_Accessor *" || ret_type.c_type == "const Eina_Accessor *"
|
||||
)
|
||||
{
|
||||
attributes::complex_type_def const* complex = efl::eina::get<attributes::complex_type_def>(&ret_type.original_type);
|
||||
if (!complex)
|
||||
return false;
|
||||
if (!as_generator("return new " << type << "(_ret_var, " << std::string{ret_type.has_own ? "true" : "false"} << ");\n")
|
||||
.generate(sink, ret_type, context))
|
||||
return false;
|
||||
}
|
||||
else if (ret_type.c_type != "void")
|
||||
{
|
||||
return as_generator("return _ret_var;\n").generate(sink, ret_type, context);
|
||||
|
@ -1199,6 +1237,13 @@ struct native_convert_out_assign_generator
|
|||
string << ".Own = false;\n"
|
||||
).generate(sink, outvar, context))
|
||||
return false;
|
||||
|
||||
// Iterators and Accessors can't own their content.
|
||||
if (param.type.c_type == "Eina_Iterator *" || param.type.c_type == "const Eina_Iterator *"
|
||||
|| param.type.c_type == "Eina_Accessor *" || param.type.c_type == "const Eina_Accessor *"
|
||||
)
|
||||
return true;
|
||||
|
||||
if (complex->subtypes.front().has_own && !as_generator(
|
||||
string << ".OwnContent = false;\n"
|
||||
).generate(sink, outvar, context))
|
||||
|
@ -1319,9 +1364,16 @@ struct native_convert_return_generator
|
|||
if (ret_type.has_own && !as_generator("_ret_var.Own = false; ")
|
||||
.generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
if (complex->subtypes.front().has_own && !as_generator("_ret_var.OwnContent = false; ")
|
||||
.generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
// Iterators and Accessors can't own their content.
|
||||
if (ret_type.c_type != "Eina_Iterator *" && ret_type.c_type != "const Eina_Iterator *"
|
||||
|| ret_type.c_type != "Eina_Accessor *" && ret_type.c_type != "const Eina_Accessor *"
|
||||
)
|
||||
{
|
||||
if (complex->subtypes.front().has_own && !as_generator("_ret_var.OwnContent = false; ")
|
||||
.generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
}
|
||||
|
||||
return as_generator("return _ret_var.Handle;\n")
|
||||
.generate(sink, attributes::unused, context);
|
||||
|
|
|
@ -171,8 +171,7 @@ struct to_external_field_convert_generator
|
|||
return false;
|
||||
}
|
||||
else if (complex && (complex->outer.base_type == "array"
|
||||
|| complex->outer.base_type == "list"
|
||||
|| complex->outer.base_type == "iterator"))
|
||||
|| complex->outer.base_type == "list"))
|
||||
{
|
||||
// Always assumes pointer
|
||||
if (!as_generator(
|
||||
|
@ -187,6 +186,13 @@ struct to_external_field_convert_generator
|
|||
.generate(sink, std::make_tuple(field_name, field.type, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if (complex && complex->outer.base_type == "iterator")
|
||||
{
|
||||
if (!as_generator(
|
||||
indent << scope_tab << scope_tab << "_external_struct." << string << " = new " << type << "(_internal_struct." << string << ", false);\n")
|
||||
.generate(sink, std::make_tuple(field_name, field.type, field_name), context))
|
||||
return false;
|
||||
}
|
||||
else if (field.type.is_ptr && helpers::need_pointer_conversion(regular) && !helpers::need_struct_conversion(regular))
|
||||
{
|
||||
if (!as_generator(
|
||||
|
|
|
@ -315,7 +315,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
|
|||
|
||||
public Eina.Iterator<T> GetIterator()
|
||||
{
|
||||
return new Eina.Iterator<T>(eina_array_iterator_new(Handle), true, false);
|
||||
return new Eina.Iterator<T>(eina_array_iterator_new(Handle), true);
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
|
|
|
@ -485,12 +485,12 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>, IDi
|
|||
|
||||
public Eina.Iterator<TKey> Keys()
|
||||
{
|
||||
return new Eina.Iterator<TKey>(EinaHashIteratorKeyNew<TKey>(Handle), true, false);
|
||||
return new Eina.Iterator<TKey>(EinaHashIteratorKeyNew<TKey>(Handle), true);
|
||||
}
|
||||
|
||||
public Eina.Iterator<TValue> Values()
|
||||
{
|
||||
return new Eina.Iterator<TValue>(eina_hash_iterator_data_new(Handle), true, false);
|
||||
return new Eina.Iterator<TValue>(eina_hash_iterator_data_new(Handle), true);
|
||||
}
|
||||
|
||||
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
|
||||
|
|
|
@ -358,12 +358,12 @@ public class Inarray<T> : IEnumerable<T>, IDisposable
|
|||
|
||||
public Eina.Iterator<T> GetIterator()
|
||||
{
|
||||
return new Eina.Iterator<T>(eina_inarray_iterator_new(Handle), true, false);
|
||||
return new Eina.Iterator<T>(eina_inarray_iterator_new(Handle), true);
|
||||
}
|
||||
|
||||
public Eina.Iterator<T> GetReversedIterator()
|
||||
{
|
||||
return new Eina.Iterator<T>(eina_inarray_iterator_reversed_new(Handle), true, false);
|
||||
return new Eina.Iterator<T>(eina_inarray_iterator_reversed_new(Handle), true);
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
|
|
|
@ -314,7 +314,7 @@ public class Inlist<T> : IEnumerable<T>, IDisposable
|
|||
|
||||
public Eina.Iterator<T> GetIterator()
|
||||
{
|
||||
return new Eina.Iterator<T>(eina_inlist_iterator_wrapper_new_custom_export_mono(Handle), true, false);
|
||||
return new Eina.Iterator<T>(eina_inlist_iterator_wrapper_new_custom_export_mono(Handle), true);
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
|
|
|
@ -33,20 +33,11 @@ public class Iterator<T> : IEnumerable<T>, IDisposable
|
|||
{
|
||||
public IntPtr Handle {get;set;} = IntPtr.Zero;
|
||||
public bool Own {get;set;} = true;
|
||||
public bool OwnContent {get;set;} = false;
|
||||
|
||||
public Iterator(IntPtr handle, bool own)
|
||||
{
|
||||
Handle = handle;
|
||||
Own = own;
|
||||
OwnContent = own;
|
||||
}
|
||||
|
||||
public Iterator(IntPtr handle, bool own, bool ownContent)
|
||||
{
|
||||
Handle = handle;
|
||||
Own = own;
|
||||
OwnContent = ownContent;
|
||||
}
|
||||
|
||||
~Iterator()
|
||||
|
@ -63,14 +54,6 @@ public class Iterator<T> : IEnumerable<T>, IDisposable
|
|||
return;
|
||||
}
|
||||
|
||||
if (OwnContent)
|
||||
{
|
||||
for (IntPtr data; eina_iterator_next(h, out data);)
|
||||
{
|
||||
NativeFree<T>(data);
|
||||
}
|
||||
}
|
||||
|
||||
if (Own)
|
||||
{
|
||||
if (disposing)
|
||||
|
@ -102,16 +85,9 @@ public class Iterator<T> : IEnumerable<T>, IDisposable
|
|||
return h;
|
||||
}
|
||||
|
||||
public void SetOwnership(bool ownAll)
|
||||
{
|
||||
Own = ownAll;
|
||||
OwnContent = ownAll;
|
||||
}
|
||||
|
||||
public void SetOwnership(bool own, bool ownContent)
|
||||
public void SetOwnership(bool own)
|
||||
{
|
||||
Own = own;
|
||||
OwnContent = ownContent;
|
||||
}
|
||||
|
||||
public bool Next(out T res)
|
||||
|
@ -125,11 +101,6 @@ public class Iterator<T> : IEnumerable<T>, IDisposable
|
|||
|
||||
res = NativeToManaged<T>(data);
|
||||
|
||||
if (OwnContent)
|
||||
{
|
||||
NativeFree<T>(data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -353,12 +353,12 @@ public class List<T> : IEnumerable<T>, IDisposable
|
|||
|
||||
public Eina.Iterator<T> GetIterator()
|
||||
{
|
||||
return new Eina.Iterator<T>(eina_list_iterator_new(Handle), true, false);
|
||||
return new Eina.Iterator<T>(eina_list_iterator_new(Handle), true);
|
||||
}
|
||||
|
||||
public Eina.Iterator<T> GetReversedIterator()
|
||||
{
|
||||
return new Eina.Iterator<T>(eina_list_iterator_reversed_new(Handle), true, false);
|
||||
return new Eina.Iterator<T>(eina_list_iterator_reversed_new(Handle), true);
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
|
|
|
@ -3129,14 +3129,12 @@ class TestEinaIterator
|
|||
var itr = arr.GetIterator();
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
Test.Assert(t.EinaIteratorIntIn(itr));
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
|
@ -3150,20 +3148,18 @@ class TestEinaIterator
|
|||
var arr = new Eina.Array<int>();
|
||||
arr.Append(base_seq_int);
|
||||
var itr = arr.GetIterator();
|
||||
arr.OwnContent = false;
|
||||
itr.OwnContent = true;
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(!arr.OwnContent);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
// Will take ownership of the Iterator
|
||||
Test.Assert(t.EinaIteratorIntInOwn(itr));
|
||||
|
||||
Test.Assert(!itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(!arr.OwnContent);
|
||||
// Content must continue to be owned by the array
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
itr.Dispose();
|
||||
arr.Dispose();
|
||||
|
@ -3178,9 +3174,7 @@ class TestEinaIterator
|
|||
|
||||
Test.Assert(t.EinaIteratorIntOut(out itr));
|
||||
|
||||
|
||||
Test.Assert(!itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
|
||||
int idx = 0;
|
||||
foreach (int e in itr)
|
||||
|
@ -3203,7 +3197,6 @@ class TestEinaIterator
|
|||
Test.Assert(t.EinaIteratorIntOutOwn(out itr));
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(itr.OwnContent);
|
||||
|
||||
int idx = 0;
|
||||
foreach (int e in itr)
|
||||
|
@ -3223,7 +3216,6 @@ class TestEinaIterator
|
|||
var itr = t.EinaIteratorIntReturn();
|
||||
|
||||
Test.Assert(!itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
|
||||
int idx = 0;
|
||||
foreach (int e in itr)
|
||||
|
@ -3245,7 +3237,6 @@ class TestEinaIterator
|
|||
var itr = t.EinaIteratorIntReturnOwn();
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(itr.OwnContent);
|
||||
|
||||
int idx = 0;
|
||||
foreach (int e in itr)
|
||||
|
@ -3268,14 +3259,12 @@ class TestEinaIterator
|
|||
var itr = arr.GetIterator();
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
Test.Assert(t.EinaIteratorStrIn(itr));
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
|
@ -3289,24 +3278,16 @@ class TestEinaIterator
|
|||
var arr = new Eina.Array<string>();
|
||||
arr.Append(base_seq_str);
|
||||
var itr = arr.GetIterator();
|
||||
arr.OwnContent = false;
|
||||
itr.OwnContent = true;
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(!arr.OwnContent);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
Test.Assert(t.EinaIteratorStrInOwn(itr));
|
||||
|
||||
Test.Assert(!itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
Test.Assert(!itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(!arr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(!arr.OwnContent);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
itr.Dispose();
|
||||
arr.Dispose();
|
||||
|
@ -3322,7 +3303,6 @@ class TestEinaIterator
|
|||
Test.Assert(t.EinaIteratorStrOut(out itr));
|
||||
|
||||
Test.Assert(!itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
|
||||
int idx = 0;
|
||||
foreach (string e in itr)
|
||||
|
@ -3345,7 +3325,6 @@ class TestEinaIterator
|
|||
Test.Assert(t.EinaIteratorStrOutOwn(out itr));
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(itr.OwnContent);
|
||||
|
||||
int idx = 0;
|
||||
foreach (string e in itr)
|
||||
|
@ -3365,7 +3344,6 @@ class TestEinaIterator
|
|||
var itr = t.EinaIteratorStrReturn();
|
||||
|
||||
Test.Assert(!itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
|
||||
int idx = 0;
|
||||
foreach (string e in itr)
|
||||
|
@ -3387,7 +3365,6 @@ class TestEinaIterator
|
|||
var itr = t.EinaIteratorStrReturnOwn();
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(itr.OwnContent);
|
||||
|
||||
int idx = 0;
|
||||
foreach (string e in itr)
|
||||
|
@ -3410,14 +3387,12 @@ class TestEinaIterator
|
|||
var itr = arr.GetIterator();
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
Test.Assert(t.EinaIteratorObjIn(itr));
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
|
@ -3431,20 +3406,16 @@ class TestEinaIterator
|
|||
var arr = new Eina.Array<Dummy.Numberwrapper>();
|
||||
arr.Append(BaseSeqObj());
|
||||
var itr = arr.GetIterator();
|
||||
arr.OwnContent = false;
|
||||
itr.OwnContent = true;
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(!arr.OwnContent);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
Test.Assert(t.EinaIteratorObjInOwn(itr));
|
||||
|
||||
Test.Assert(!itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
Test.Assert(arr.Own);
|
||||
Test.Assert(!arr.OwnContent);
|
||||
Test.Assert(arr.OwnContent);
|
||||
|
||||
itr.Dispose();
|
||||
arr.Dispose();
|
||||
|
@ -3460,7 +3431,6 @@ class TestEinaIterator
|
|||
Test.Assert(t.EinaIteratorObjOut(out itr));
|
||||
|
||||
Test.Assert(!itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
|
||||
var base_seq_obj = BaseSeqObj();
|
||||
|
||||
|
@ -3485,7 +3455,6 @@ class TestEinaIterator
|
|||
Test.Assert(t.EinaIteratorObjOutOwn(out itr));
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(itr.OwnContent);
|
||||
|
||||
var base_seq_obj = BaseSeqObj();
|
||||
|
||||
|
@ -3507,7 +3476,6 @@ class TestEinaIterator
|
|||
var itr = t.EinaIteratorObjReturn();
|
||||
|
||||
Test.Assert(!itr.Own);
|
||||
Test.Assert(!itr.OwnContent);
|
||||
|
||||
var base_seq_obj = BaseSeqObj();
|
||||
|
||||
|
@ -3531,7 +3499,6 @@ class TestEinaIterator
|
|||
var itr = t.EinaIteratorObjReturnOwn();
|
||||
|
||||
Test.Assert(itr.Own);
|
||||
Test.Assert(itr.OwnContent);
|
||||
|
||||
var base_seq_obj = BaseSeqObj();
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ typedef struct Dummy_Test_Object_Data
|
|||
int iface_prop;
|
||||
Eo *provider;
|
||||
Eo *iface_provider;
|
||||
|
||||
// Containers passed to C# as iterator/accessors
|
||||
Eina_Array *out_array;
|
||||
} Dummy_Test_Object_Data;
|
||||
|
||||
static
|
||||
|
@ -97,6 +100,9 @@ _dummy_test_object_efl_object_destructor(Eo *obj, Dummy_Test_Object_Data *pd)
|
|||
pd->list_for_accessor = NULL;
|
||||
}
|
||||
|
||||
if (pd->out_array)
|
||||
eina_array_free(pd->out_array);
|
||||
|
||||
efl_destructor(efl_super(obj, DUMMY_TEST_OBJECT_CLASS));
|
||||
}
|
||||
|
||||
|
@ -2695,7 +2701,7 @@ static Eina_Iterator *_iterator_int_in_own_to_check = NULL;
|
|||
|
||||
Eina_Bool _dummy_test_object_eina_iterator_int_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Iterator *itr)
|
||||
{
|
||||
Eina_Bool r = _iterator_int_equal(itr, base_seq_int, base_seq_int_size, EINA_TRUE);
|
||||
Eina_Bool r = _iterator_int_equal(itr, base_seq_int, base_seq_int_size, EINA_FALSE);
|
||||
_iterator_int_in_own_to_check = itr;
|
||||
return r;
|
||||
}
|
||||
|
@ -2746,9 +2752,12 @@ Eina_Bool _dummy_test_object_eina_iterator_int_out_own(EINA_UNUSED Eo *obj, EINA
|
|||
{
|
||||
if (!itr) return EINA_FALSE;
|
||||
|
||||
Eina_Array *arr = _iterator_int_eina_array_new();
|
||||
if (pd->out_array)
|
||||
eina_array_free(pd->out_array);
|
||||
|
||||
*itr = eina_array_iterator_new(arr);
|
||||
pd->out_array = _iterator_int_eina_array_new();
|
||||
|
||||
*itr = eina_array_iterator_new(pd->out_array);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -2786,8 +2795,11 @@ Eina_Bool _dummy_test_object_check_eina_iterator_int_return(EINA_UNUSED Eo *obj,
|
|||
|
||||
Eina_Iterator *_dummy_test_object_eina_iterator_int_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
|
||||
{
|
||||
Eina_Array *arr = _iterator_int_eina_array_new();
|
||||
return eina_array_iterator_new(arr);
|
||||
if (pd->out_array)
|
||||
eina_array_free(pd->out_array);
|
||||
|
||||
pd->out_array = _iterator_int_eina_array_new();
|
||||
return eina_array_iterator_new(pd->out_array);
|
||||
}
|
||||
|
||||
// String //
|
||||
|
@ -2853,7 +2865,7 @@ static Eina_Iterator *_iterator_str_in_own_to_check = NULL;
|
|||
|
||||
Eina_Bool _dummy_test_object_eina_iterator_str_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Iterator *itr)
|
||||
{
|
||||
Eina_Bool r = _iterator_str_equal(itr, base_seq_str, base_seq_str_size, EINA_TRUE);
|
||||
Eina_Bool r = _iterator_str_equal(itr, base_seq_str, base_seq_str_size, EINA_FALSE);
|
||||
_iterator_str_in_own_to_check = itr;
|
||||
return r;
|
||||
}
|
||||
|
@ -2904,9 +2916,12 @@ Eina_Bool _dummy_test_object_eina_iterator_str_out_own(EINA_UNUSED Eo *obj, EINA
|
|||
{
|
||||
if (!itr) return EINA_FALSE;
|
||||
|
||||
Eina_Array *arr = _iterator_str_eina_array_new();
|
||||
if (pd->out_array)
|
||||
eina_array_free(pd->out_array);
|
||||
|
||||
*itr = eina_array_iterator_new(arr);
|
||||
pd->out_array = _iterator_str_eina_array_new();
|
||||
|
||||
*itr = eina_array_iterator_new(pd->out_array);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -2944,8 +2959,11 @@ Eina_Bool _dummy_test_object_check_eina_iterator_str_return(EINA_UNUSED Eo *obj,
|
|||
|
||||
Eina_Iterator *_dummy_test_object_eina_iterator_str_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
|
||||
{
|
||||
Eina_Array *arr = _iterator_str_eina_array_new();
|
||||
return eina_array_iterator_new(arr);
|
||||
if (pd->out_array)
|
||||
eina_array_free(pd->out_array);
|
||||
|
||||
pd->out_array = _iterator_str_eina_array_new();
|
||||
return eina_array_iterator_new(pd->out_array);
|
||||
}
|
||||
|
||||
// Object //
|
||||
|
@ -3015,7 +3033,7 @@ static Eina_Iterator *_iterator_obj_in_own_to_check = NULL;
|
|||
|
||||
Eina_Bool _dummy_test_object_eina_iterator_obj_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Iterator *itr)
|
||||
{
|
||||
Eina_Bool r = _iterator_obj_equal(itr, base_seq_obj, base_seq_obj_size, EINA_TRUE);
|
||||
Eina_Bool r = _iterator_obj_equal(itr, base_seq_obj, base_seq_obj_size, EINA_FALSE);
|
||||
_iterator_obj_in_own_to_check = itr;
|
||||
return r;
|
||||
}
|
||||
|
@ -3066,9 +3084,12 @@ Eina_Bool _dummy_test_object_eina_iterator_obj_out_own(EINA_UNUSED Eo *obj, EINA
|
|||
{
|
||||
if (!itr) return EINA_FALSE;
|
||||
|
||||
Eina_Array *arr = _iterator_obj_eina_array_new();
|
||||
if (pd->out_array)
|
||||
eina_array_free(pd->out_array);
|
||||
|
||||
*itr = eina_array_iterator_new(arr);
|
||||
pd->out_array = _iterator_obj_eina_array_new();
|
||||
|
||||
*itr = eina_array_iterator_new(pd->out_array);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -3106,8 +3127,11 @@ Eina_Bool _dummy_test_object_check_eina_iterator_obj_return(EINA_UNUSED Eo *obj,
|
|||
|
||||
Eina_Iterator *_dummy_test_object_eina_iterator_obj_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
|
||||
{
|
||||
Eina_Array *arr = _iterator_obj_eina_array_new();
|
||||
return eina_array_iterator_new(arr);
|
||||
if (pd->out_array)
|
||||
eina_array_free(pd->out_array);
|
||||
|
||||
pd->out_array = _iterator_obj_eina_array_new();
|
||||
return eina_array_iterator_new(pd->out_array);
|
||||
}
|
||||
|
||||
// //
|
||||
|
|
|
@ -869,14 +869,14 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
|
|||
/* Integer */
|
||||
eina_iterator_int_in {
|
||||
params {
|
||||
@in itr: iterator<ptr(int)>;
|
||||
@in itr: iterator<int>;
|
||||
}
|
||||
return: bool;
|
||||
}
|
||||
|
||||
eina_iterator_int_in_own {
|
||||
params {
|
||||
@in itr: iterator<free(ptr(int),free)> @owned;
|
||||
@in itr: iterator<int> @owned;
|
||||
}
|
||||
return: bool;
|
||||
}
|
||||
|
@ -886,7 +886,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
|
|||
|
||||
eina_iterator_int_out {
|
||||
params {
|
||||
@out itr: iterator<ptr(int)>;
|
||||
@out itr: iterator<int>;
|
||||
}
|
||||
return: bool;
|
||||
}
|
||||
|
@ -896,20 +896,20 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
|
|||
|
||||
eina_iterator_int_out_own {
|
||||
params {
|
||||
@out itr: iterator<free(ptr(int),free)> @owned;
|
||||
@out itr: iterator<int> @owned;
|
||||
}
|
||||
return: bool;
|
||||
}
|
||||
|
||||
eina_iterator_int_return {
|
||||
return: iterator<ptr(int)>;
|
||||
return: iterator<int>;
|
||||
}
|
||||
check_eina_iterator_int_return {
|
||||
return: bool;
|
||||
}
|
||||
|
||||
eina_iterator_int_return_own {
|
||||
return: iterator<free(ptr(int),free)> @owned;
|
||||
return: iterator<int> @owned;
|
||||
}
|
||||
|
||||
/* String */
|
||||
|
@ -1393,9 +1393,9 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
|
|||
/* Accessors */
|
||||
clone_accessor {
|
||||
params {
|
||||
@in acc: accessor<ptr(int)>;
|
||||
@in acc: accessor<int>;
|
||||
}
|
||||
return: accessor<ptr(int)> @owned;
|
||||
return: accessor<int> @owned;
|
||||
}
|
||||
|
||||
@property setter_only {
|
||||
|
|
Loading…
Reference in New Issue