eo: add move tag to iterator

It is impossible to reuse iterator after `EINA_ITERATOR_FOREACH`(`eina_iterator_next`).

E.g.
```
eina_init();

eina_file_dir_list("/home/", EINA_FALSE, _print_cb, NULL);

it = eina_file_ls("/home/");
EINA_ITERATOR_FOREACH(it, f_name)
  {
     printf("%s\n", f_name);
     eina_stringshare_del(f_name);
  }
EINA_ITERATOR_FOREACH(it, f_name)
  {
     printf("Again %s\n", f_name);
     eina_stringshare_del(f_name);
  }
eina_iterator_free(it);
```
`Agian ...` is never printed.

Therefore, iterator always need `@move` tag to avoid unexpected behavior without
any error message.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D10719
This commit is contained in:
Yeongjong Lee 2019-11-22 06:13:25 +00:00 committed by Marcel Hollerbach
parent 4ebbe0ad04
commit fba098df38
9 changed files with 12 additions and 11 deletions

View File

@ -25,7 +25,7 @@ class @beta Efl.Boolean_Model extends Efl.Composite_Model
@in name: string; [[The name of the property to examine.]] @in name: string; [[The name of the property to examine.]]
@in request: bool; [[The value to look for.]] @in request: bool; [[The value to look for.]]
} }
return: iterator<ptr(uint64)>; [[The iterator that is valid until any change is made on the model.]] return: iterator<ptr(uint64)> @move; [[The iterator that is valid until any change is made on the model.]]
} }
} }
implements { implements {

View File

@ -47,7 +47,7 @@ class @beta Efl.Core.Env extends Efl.Object implements Efl.Duplicate {
} }
values { values {
iter : iterator<string>; iter : iterator<string> @move;
} }
} }
} }

View File

@ -217,9 +217,9 @@ interface Efl.Gfx.Image
} }
get {} get {}
values { values {
horizontal: iterator<Efl.Gfx.Image_Stretch_Region>(null); [[Representation of areas that are horizontal: iterator<Efl.Gfx.Image_Stretch_Region>(null) @move; [[Representation of areas that are
stretchable in the image horizontal space.]] stretchable in the image horizontal space.]]
vertical: iterator<Efl.Gfx.Image_Stretch_Region>(null); [[Representation of areas that are vertical: iterator<Efl.Gfx.Image_Stretch_Region>(null) @move; [[Representation of areas that are
stretchable in the image vertical space.]] stretchable in the image vertical space.]]
} }
} }

View File

@ -10,7 +10,7 @@ class @beta Efl.Ui.View_Factory
params { params {
factory: Efl.Ui.Factory; [[The factory to use for requesting the new object from and generating the created factory: Efl.Ui.Factory; [[The factory to use for requesting the new object from and generating the created
event onto.]] event onto.]]
models: iterator<Efl.Model>; [[Efl iterator providing the model to be associated to the new item. It should models: iterator<Efl.Model> @move; [[Efl iterator providing the model to be associated to the new item. It should
remain valid until the end of the function call.]] remain valid until the end of the function call.]]
} }
return: future<Efl.Gfx.Entity>; [[Created UI object]] return: future<Efl.Gfx.Entity>; [[Created UI object]]

View File

@ -263,7 +263,7 @@ mixin @beta Efl.Access.Object requires Efl.Object
} }
relations_get @protected @beta @const { relations_get @protected @beta @const {
[[Gets an all relations between accessible object and other accessible objects.]] [[Gets an all relations between accessible object and other accessible objects.]]
return: iterator<ptr(Efl.Access.Relation)>; [[Accessible relation set]] return: iterator<ptr(Efl.Access.Relation)> @move; [[Accessible relation set]]
} }
@property role @beta { @property role @beta {
[[The role of the object in accessibility domain.]] [[The role of the object in accessibility domain.]]

View File

@ -92,7 +92,7 @@ interface Efl.Ui.Focus.Manager {
]] ]]
get {} get {}
values { values {
border_elements : iterator<Efl.Ui.Focus.Object>; [[An iterator border_elements : iterator<Efl.Ui.Focus.Object> @move; [[An iterator
over the border objects.]] over the border objects.]]
} }
} }
@ -107,7 +107,7 @@ interface Efl.Ui.Focus.Manager {
viewport : Eina.Rect; [[The rectangle defining the viewport.]] viewport : Eina.Rect; [[The rectangle defining the viewport.]]
} }
values { values {
viewport_elements : iterator<Efl.Ui.Focus.Object>; [[An iterator over the viewport border objects.]] viewport_elements : iterator<Efl.Ui.Focus.Object> @move; [[An iterator over the viewport border objects.]]
} }
} }
@property root { @property root {

View File

@ -183,6 +183,7 @@ _efl_ui_view_model_property_logic_add(Eo *obj, Efl_Ui_View_Model_Data *pd,
logic->sources = eina_list_append(logic->sources, eina_stringshare_add(source)); logic->sources = eina_list_append(logic->sources, eina_stringshare_add(source));
efl_ui_view_model_property_bind(obj, source, property); efl_ui_view_model_property_bind(obj, source, property);
} }
eina_iterator_free(bound);
return 0; return 0;
} }

View File

@ -76,8 +76,8 @@ class Efl.Ui.View_Model extends Efl.Composite_Model
with the above property name.]] with the above property name.]]
set: EflUiViewModelPropertySet; [[Define the set callback called when the @Efl.Model.property.set is called set: EflUiViewModelPropertySet; [[Define the set callback called when the @Efl.Model.property.set is called
with the above property name.]] with the above property name.]]
binded: iterator<string>; [[Iterator of property name to bind with this defined property see binded: iterator<string> @move; [[Iterator of property name to bind with this defined property see
@.property_bind.]] @.property_bind.]]
} }
return: Eina.Error; return: Eina.Error;
} }

View File

@ -721,7 +721,7 @@ class Efl.Ui.Win extends Efl.Ui.Widget implements Efl.Canvas.Scene, Efl.Access.W
hover: bool @optional; [[$false by default, $true means to include hover: bool @optional; [[$false by default, $true means to include
fingers that are currently hovering.]] fingers that are currently hovering.]]
} }
return: iterator<const(Efl.Input.Pointer)>; [[Iterator to pointer positions]] return: iterator<const(Efl.Input.Pointer)> @move; [[Iterator to pointer positions]]
} }
@property win_rotation @beta { @property win_rotation @beta {
[[The rotation of this window [[The rotation of this window