Good to split up,  but in considering apis,

efl_file => efl_file_file_set()
efl_file_save => efl_file_save_save()

Classes and functions are too inconsistency and ugly, just my thought?

We could provide better pretties such like this,
efl_file_loader => efl_file_loader_set()
efl_file_saver  => efl_file_saver_set()
and this efl_file_saver could extends efl_file_loader.
This case, even derived classes of efl_file_saver just need to implement
one class to load and save both.

On Thu, Jan 31, 2019 at 2:18 AM Mike Blumenkrantz <
michael.blumenkra...@gmail.com> wrote:

> bu5hm4n pushed a commit to branch master.
>
>
> http://git.enlightenment.org/core/efl.git/commit/?id=aadd9af864a83d355b216ac3b2f293ca902a7b6f
>
> commit aadd9af864a83d355b216ac3b2f293ca902a7b6f
> Author: Mike Blumenkrantz <zm...@samsung.com>
> Date:   Wed Jan 30 09:05:05 2019 -0500
>
>     efl.file: move 'save' method into separate efl.file_save interface
>
>     the save method is implemented very rarely, and most objects which use
> efl.file
>     will not be able to use a save method
>
>     ref T5719
>
>     Reviewed-by: Cedric BAIL <cedric.b...@free.fr>
>     Reviewed-by: Marcel Hollerbach <marcel-hollerb...@t-online.de>
>     Differential Revision: https://phab.enlightenment.org/D7786
> ---
>  src/Makefile_Efl.am                              |  1 +
>  src/lib/efl/Efl.h                                |  1 +
>  src/lib/efl/interfaces/efl_file.c                |  1 +
>  src/lib/efl/interfaces/efl_file.eo               | 22 ------------------
>  src/lib/efl/interfaces/efl_file_save.eo          | 29
> ++++++++++++++++++++++++
>  src/lib/efl/interfaces/meson.build               |  1 +
>  src/lib/evas/canvas/efl_canvas_image_internal.eo |  4 ++--
>  src/lib/evas/canvas/efl_canvas_vg_object.c       |  2 +-
>  src/lib/evas/canvas/efl_canvas_vg_object.eo      |  4 ++--
>  src/lib/evas/canvas/evas_canvas3d_mesh.c         |  2 +-
>  src/lib/evas/canvas/evas_canvas3d_mesh.eo        |  4 ++--
>  src/lib/evas/canvas/evas_object_image.c          |  2 +-
>  12 files changed, 42 insertions(+), 31 deletions(-)
>
> diff --git a/src/Makefile_Efl.am b/src/Makefile_Efl.am
> index 475a5f1eb2..20daaeb0b2 100644
> --- a/src/Makefile_Efl.am
> +++ b/src/Makefile_Efl.am
> @@ -23,6 +23,7 @@ efl_eolian_files = \
>        lib/efl/interfaces/efl_control.eo \
>        lib/efl/interfaces/efl_duplicate.eo \
>        lib/efl/interfaces/efl_file.eo \
> +      lib/efl/interfaces/efl_file_save.eo \
>        lib/efl/interfaces/efl_gfx_image_load_controller.eo \
>        lib/efl/interfaces/efl_part.eo \
>        lib/efl/interfaces/efl_playable.eo \
> diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h
> index 7daa52d50c..097111134e 100644
> --- a/src/lib/efl/Efl.h
> +++ b/src/lib/efl/Efl.h
> @@ -85,6 +85,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
>  #include "interfaces/efl_control.eo.h"
>  #include "interfaces/efl_duplicate.eo.h"
>  #include "interfaces/efl_file.eo.h"
> +#include "interfaces/efl_file_save.eo.h"
>  #include "interfaces/efl_gfx_image.eo.h"
>  #include "interfaces/efl_gfx_frame_controller.eo.h"
>  #include "interfaces/efl_gfx_image_load_controller.eo.h"
> diff --git a/src/lib/efl/interfaces/efl_file.c
> b/src/lib/efl/interfaces/efl_file.c
> index 8edbbfb463..d1c86ee7c2 100644
> --- a/src/lib/efl/interfaces/efl_file.c
> +++ b/src/lib/efl/interfaces/efl_file.c
> @@ -60,3 +60,4 @@ _efl_file_load_error_get(const Eo *obj EINA_UNUSED,
> Efl_File_Data *pd)
>  }
>
>  #include "interfaces/efl_file.eo.c"
> +#include "interfaces/efl_file_save.eo.c"
> diff --git a/src/lib/efl/interfaces/efl_file.eo
> b/src/lib/efl/interfaces/efl_file.eo
> index 9260c16bf1..c9873f06da 100644
> --- a/src/lib/efl/interfaces/efl_file.eo
> +++ b/src/lib/efl/interfaces/efl_file.eo
> @@ -89,27 +89,5 @@ mixin Efl.File {
>                                   $null, otherwise.]]
>           }
>        }
> -      save @const @pure_virtual {
> -         [[Save the given image object's contents to an (image) file.
> -
> -           The extension suffix on $file will determine which saver
> -           module Evas is to use when saving, thus the final file's
> -           format. If the file supports multiple data stored in it (Eet
> ones),
> -           you can specify the key to be used as the index of the image
> in it.
> -
> -           You can specify some flags when saving the image.  Currently
> -           acceptable flags are $quality and $compress. Eg.:
> -           "quality=100 compress=9".
> -         ]]
> -         params {
> -            @in file: string @nonull; [[The filename to be used to save
> the image (extension
> -                                              obligatory).]]
> -            @in key: string; [[The image key in the file (if an Eet one),
> or $null,
> -                                     otherwise.]]
> -            @in flags: string; [[String containing the flags to be used
> ($null for
> -                                       none).]]
> -         }
> -         return: bool;  [[$true on success, $false otherwise]]
> -      }
>     }
>  }
> diff --git a/src/lib/efl/interfaces/efl_file_save.eo
> b/src/lib/efl/interfaces/efl_file_save.eo
> new file mode 100644
> index 0000000000..153b74b23e
> --- /dev/null
> +++ b/src/lib/efl/interfaces/efl_file_save.eo
> @@ -0,0 +1,29 @@
> +import eina_types;
> +
> +interface Efl.File_Save {
> +   [[Efl file saving interface]]
> +   methods {
> +      save @const {
> +         [[Save the given image object's contents to an (image) file.
> +
> +           The extension suffix on $file will determine which saver
> +           module Evas is to use when saving, thus the final file's
> +           format. If the file supports multiple data stored in it (Eet
> ones),
> +           you can specify the key to be used as the index of the image
> in it.
> +
> +           You can specify some flags when saving the image.  Currently
> +           acceptable flags are $quality and $compress. Eg.:
> +           "quality=100 compress=9".
> +         ]]
> +         params {
> +            @in file: string @nonull; [[The filename to be used to save
> the image (extension
> +                                              obligatory).]]
> +            @in key: string; [[The image key in the file (if an Eet one),
> or $null,
> +                                     otherwise.]]
> +            @in flags: string; [[String containing the flags to be used
> ($null for
> +                                       none).]]
> +         }
> +         return: bool;  [[$true on success, $false otherwise]]
> +      }
> +   }
> +}
> diff --git a/src/lib/efl/interfaces/meson.build
> b/src/lib/efl/interfaces/meson.build
> index 61d91fbed9..a1ef0ee2ae 100644
> --- a/src/lib/efl/interfaces/meson.build
> +++ b/src/lib/efl/interfaces/meson.build
> @@ -49,6 +49,7 @@ pub_eo_files = [
>    'efl_control.eo',
>    'efl_duplicate.eo',
>    'efl_file.eo',
> +  'efl_file_save.eo',
>    'efl_gfx_image_load_controller.eo',
>    'efl_part.eo',
>    'efl_player.eo',
> diff --git a/src/lib/evas/canvas/efl_canvas_image_internal.eo
> b/src/lib/evas/canvas/efl_canvas_image_internal.eo
> index fc7df3c497..b3b8f3b082 100644
> --- a/src/lib/evas/canvas/efl_canvas_image_internal.eo
> +++ b/src/lib/evas/canvas/efl_canvas_image_internal.eo
> @@ -1,7 +1,7 @@
>  abstract Efl.Canvas.Image_Internal extends Efl.Canvas.Object implements
> Efl.Canvas.Filter.Internal,
>                                      Efl.Gfx.Image, Efl.Gfx.Buffer,
>                                      Efl.Gfx.Fill, Efl.Gfx.View,
> -                                    Efl.Orientation, Efl.File
> +                                    Efl.Orientation, Efl.File_Save
>  {
>     [[Efl canvas internal image class]]
>     data: Evas_Image_Data;
> @@ -10,7 +10,7 @@ abstract Efl.Canvas.Image_Internal extends
> Efl.Canvas.Object implements Efl.Canv
>        Efl.Object.destructor;
>        Efl.Object.finalize;
>        Efl.Object.debug_name_override;
> -      Efl.File.save;
> +      Efl.File_Save.save;
>        Efl.Orientation.orientation { get; set; }
>        Efl.Orientation.flip { get; set; }
>        Efl.Gfx.Image.smooth_scale { get; set; }
> diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c
> b/src/lib/evas/canvas/efl_canvas_vg_object.c
> index 7a8e8a1d45..cede9af759 100644
> --- a/src/lib/evas/canvas/efl_canvas_vg_object.c
> +++ b/src/lib/evas/canvas/efl_canvas_vg_object.c
> @@ -283,7 +283,7 @@ _efl_canvas_vg_object_efl_file_file_get(const Eo *obj
> EINA_UNUSED, Efl_Canvas_Vg
>  }
>
>  EOLIAN static Eina_Bool
> -_efl_canvas_vg_object_efl_file_save(const Eo *obj,
> Efl_Canvas_Vg_Object_Data *pd, const char *file, const char *key, const
> char *flags)
> +_efl_canvas_vg_object_efl_file_save_save(const Eo *obj,
> Efl_Canvas_Vg_Object_Data *pd, const char *file, const char *key, const
> char *flags)
>  {
>     if (pd->vg_entry)
>       return evas_cache_vg_entry_file_save(pd->vg_entry, file, key, flags);
> diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.eo
> b/src/lib/evas/canvas/efl_canvas_vg_object.eo
> index a1038efd8c..710909658e 100644
> --- a/src/lib/evas/canvas/efl_canvas_vg_object.eo
> +++ b/src/lib/evas/canvas/efl_canvas_vg_object.eo
> @@ -21,7 +21,7 @@ enum Efl.Canvas.Vg.Fill_Mode
>                    dimension of the viewport.]]
>  }
>
> -class Efl.Canvas.Vg.Object extends Efl.Canvas.Object implements Efl.File
> +class Efl.Canvas.Vg.Object extends Efl.Canvas.Object implements Efl.File,
> Efl.File_Save
>  {
>     [[Efl vector graphics class]]
>     legacy_prefix: evas_object_vg;
> @@ -75,6 +75,6 @@ class Efl.Canvas.Vg.Object extends Efl.Canvas.Object
> implements Efl.File
>        Efl.Object.destructor;
>        // FIXME: Implement mmap only (also fix cache keys)
>        Efl.File.file { get; set; }
> -      Efl.File.save;
> +      Efl.File_Save.save;
>     }
>  }
> diff --git a/src/lib/evas/canvas/evas_canvas3d_mesh.c
> b/src/lib/evas/canvas/evas_canvas3d_mesh.c
> index eb32e63182..d91feafb99 100644
> --- a/src/lib/evas/canvas/evas_canvas3d_mesh.c
> +++ b/src/lib/evas/canvas/evas_canvas3d_mesh.c
> @@ -907,7 +907,7 @@ _evas_canvas3d_mesh_efl_file_file_set(Eo *obj,
> Evas_Canvas3D_Mesh_Data *pd,
>  }
>
>  EOLIAN static Eina_Bool
> -_evas_canvas3d_mesh_efl_file_save(const Eo *obj, Evas_Canvas3D_Mesh_Data
> *pd,
> +_evas_canvas3d_mesh_efl_file_save_save(const Eo *obj,
> Evas_Canvas3D_Mesh_Data *pd,
>                     const char *file,
>                     const char *key EINA_UNUSED,
>                     const char *flags EINA_UNUSED)
> diff --git a/src/lib/evas/canvas/evas_canvas3d_mesh.eo
> b/src/lib/evas/canvas/evas_canvas3d_mesh.eo
> index d7ffa7300a..028465423e 100644
> --- a/src/lib/evas/canvas/evas_canvas3d_mesh.eo
> +++ b/src/lib/evas/canvas/evas_canvas3d_mesh.eo
> @@ -2,7 +2,7 @@ import evas_canvas3d_types;
>
>  struct @extern Eina.Inarray; [[Eina inarray data structure]]
>
> -class Evas.Canvas3D.Mesh extends Evas.Canvas3D.Object implements Efl.File
> +class Evas.Canvas3D.Mesh extends Evas.Canvas3D.Object implements
> Efl.File, Efl.File_Save
>  {
>     [[Evas 3D canvas mesh class]]
>     data: Evas_Canvas3D_Mesh_Data;
> @@ -428,7 +428,7 @@ class Evas.Canvas3D.Mesh extends Evas.Canvas3D.Object
> implements Efl.File
>        Evas.Canvas3D.Object.change_notify;
>        Efl.File.file { get; set; }
>        Efl.File.mmap { get; set; }
> -      Efl.File.save;
> +      Efl.File_Save.save;
>     }
>
>  }
> diff --git a/src/lib/evas/canvas/evas_object_image.c
> b/src/lib/evas/canvas/evas_object_image.c
> index 7834ce087e..02ec6493dd 100644
> --- a/src/lib/evas/canvas/evas_object_image.c
> +++ b/src/lib/evas/canvas/evas_object_image.c
> @@ -855,7 +855,7 @@
> _efl_canvas_image_internal_efl_gfx_image_ratio_get(const Eo *eo_obj
> EINA_UNUSED,
>  }
>
>  EOLIAN static Eina_Bool
> -_efl_canvas_image_internal_efl_file_save(const Eo *eo_obj,
> Evas_Image_Data *o, const char *file, const char *key, const char *flags)
> +_efl_canvas_image_internal_efl_file_save_save(const Eo *eo_obj,
> Evas_Image_Data *o, const char *file, const char *key, const char *flags)
>  {
>     int quality = 80, compress = 9, ok = 0;
>     char *encoding = NULL;
>
> --
>
>
>

-- 
Regards, Hermet

_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to