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.bail@free.fr>
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D7786
This commit is contained in:
Mike Blumenkrantz 2019-01-30 09:05:05 -05:00 committed by Marcel Hollerbach
parent e59603ee4c
commit aadd9af864
12 changed files with 42 additions and 31 deletions

View File

@ -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 \

View File

@ -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"

View File

@ -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"

View File

@ -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]]
}
}
}

View File

@ -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]]
}
}
}

View File

@ -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',

View File

@ -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; }

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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)

View File

@ -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;
}
}

View File

@ -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;