e780924a1f0a40ed18b5efc9017f1b7e3edcaca9
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_file_save.eo.cs
1 #pragma warning disable CS1591
2 using System;
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Threading;
7 using System.ComponentModel;
8 namespace Efl {
9
10 /// <summary>Efl file saving interface
11 /// (Since EFL 1.22)</summary>
12 [Efl.IFileSaveConcrete.NativeMethods]
13 public interface IFileSave : 
14     Efl.Eo.IWrapper, IDisposable
15 {
16     /// <summary>Save the given image object&apos;s contents to an (image) file.
17 /// The extension suffix on <c>file</c> will determine which saver module Evas is to use when saving, thus the final file&apos;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.
18 /// 
19 /// You can specify some flags when saving the image.  Currently acceptable flags are <c>quality</c> and <c>compress</c>. Eg.: &quot;quality=100 compress=9&quot;.
20 /// (Since EFL 1.22)</summary>
21 /// <param name="file">The filename to be used to save the image (extension obligatory).</param>
22 /// <param name="key">The image key in the file (if an Eet one), or <c>null</c>, otherwise.</param>
23 /// <param name="info">The flags to be used (<c>null</c> for defaults).</param>
24 /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
25 bool Save(System.String file, System.String key, ref Efl.FileSaveInfo info);
26     }
27 /// <summary>Efl file saving interface
28 /// (Since EFL 1.22)</summary>
29 sealed public class IFileSaveConcrete :
30     Efl.Eo.EoWrapper
31     , IFileSave
32     
33 {
34     ///<summary>Pointer to the native class description.</summary>
35     public override System.IntPtr NativeClass
36     {
37         get
38         {
39             if (((object)this).GetType() == typeof(IFileSaveConcrete))
40             {
41                 return GetEflClassStatic();
42             }
43             else
44             {
45                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
46             }
47         }
48     }
49
50     [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
51         efl_file_save_interface_get();
52     /// <summary>Initializes a new instance of the <see cref="IFileSave"/> class.
53     /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
54     private IFileSaveConcrete(System.IntPtr raw) : base(raw)
55     {
56     }
57
58     /// <summary>Save the given image object&apos;s contents to an (image) file.
59     /// The extension suffix on <c>file</c> will determine which saver module Evas is to use when saving, thus the final file&apos;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.
60     /// 
61     /// You can specify some flags when saving the image.  Currently acceptable flags are <c>quality</c> and <c>compress</c>. Eg.: &quot;quality=100 compress=9&quot;.
62     /// (Since EFL 1.22)</summary>
63     /// <param name="file">The filename to be used to save the image (extension obligatory).</param>
64     /// <param name="key">The image key in the file (if an Eet one), or <c>null</c>, otherwise.</param>
65     /// <param name="info">The flags to be used (<c>null</c> for defaults).</param>
66     /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
67     public bool Save(System.String file, System.String key, ref Efl.FileSaveInfo info) {
68                          Efl.FileSaveInfo.NativeStruct _in_info = info;
69                                                         var _ret_var = Efl.IFileSaveConcrete.NativeMethods.efl_file_save_ptr.Value.Delegate(this.NativeHandle,file, key, ref _in_info);
70         Eina.Error.RaiseIfUnhandledException();
71                                                 info = _in_info;
72         return _ret_var;
73  }
74     private static IntPtr GetEflClassStatic()
75     {
76         return Efl.IFileSaveConcrete.efl_file_save_interface_get();
77     }
78     /// <summary>Wrapper for native methods and virtual method delegates.
79     /// For internal use by generated code only.</summary>
80     public class NativeMethods  : Efl.Eo.NativeClass
81     {
82         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Efl);
83         /// <summary>Gets the list of Eo operations to override.</summary>
84         /// <returns>The list of Eo operations to be overload.</returns>
85         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
86         {
87             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
88             var methods = Efl.Eo.Globals.GetUserMethods(type);
89
90             if (efl_file_save_static_delegate == null)
91             {
92                 efl_file_save_static_delegate = new efl_file_save_delegate(save);
93             }
94
95             if (methods.FirstOrDefault(m => m.Name == "Save") != null)
96             {
97                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_file_save"), func = Marshal.GetFunctionPointerForDelegate(efl_file_save_static_delegate) });
98             }
99
100             return descs;
101         }
102         /// <summary>Returns the Eo class for the native methods of this class.</summary>
103         /// <returns>The native class pointer.</returns>
104         public override IntPtr GetEflClass()
105         {
106             return Efl.IFileSaveConcrete.efl_file_save_interface_get();
107         }
108
109         #pragma warning disable CA1707, CS1591, SA1300, SA1600
110
111         [return: MarshalAs(UnmanagedType.U1)]
112         private delegate bool efl_file_save_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String file, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String key,  ref Efl.FileSaveInfo.NativeStruct info);
113
114         [return: MarshalAs(UnmanagedType.U1)]
115         public delegate bool efl_file_save_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String file, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String key,  ref Efl.FileSaveInfo.NativeStruct info);
116
117         public static Efl.Eo.FunctionWrapper<efl_file_save_api_delegate> efl_file_save_ptr = new Efl.Eo.FunctionWrapper<efl_file_save_api_delegate>(Module, "efl_file_save");
118
119         private static bool save(System.IntPtr obj, System.IntPtr pd, System.String file, System.String key, ref Efl.FileSaveInfo.NativeStruct info)
120         {
121             Eina.Log.Debug("function efl_file_save was called");
122             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
123             if (ws != null)
124             {
125                         Efl.FileSaveInfo _in_info = info;
126                                                             bool _ret_var = default(bool);
127                 try
128                 {
129                     _ret_var = ((IFileSave)ws.Target).Save(file, key, ref _in_info);
130                 }
131                 catch (Exception e)
132                 {
133                     Eina.Log.Warning($"Callback error: {e.ToString()}");
134                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
135                 }
136
137                                                 info = _in_info;
138         return _ret_var;
139
140             }
141             else
142             {
143                 return efl_file_save_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), file, key, ref info);
144             }
145         }
146
147         private static efl_file_save_delegate efl_file_save_static_delegate;
148
149         #pragma warning restore CA1707, CS1591, SA1300, SA1600
150
151 }
152 }
153 }
154
155 namespace Efl {
156
157 /// <summary>Info used to determine various attributes when saving a file.
158 /// (Since EFL 1.22)</summary>
159 [StructLayout(LayoutKind.Sequential)]
160 public struct FileSaveInfo
161 {
162     /// <summary>The quality level (0-100) to save the file with; commonly used when saving image files.</summary>
163     public uint Quality;
164     /// <summary>The compression level (0-100) to save the file with.</summary>
165     public uint Compression;
166     /// <summary>The encoding to use when saving the file.</summary>
167     public System.String Encoding;
168     ///<summary>Constructor for FileSaveInfo.</summary>
169     public FileSaveInfo(
170         uint Quality = default(uint),
171         uint Compression = default(uint),
172         System.String Encoding = default(System.String)    )
173     {
174         this.Quality = Quality;
175         this.Compression = Compression;
176         this.Encoding = Encoding;
177     }
178
179     ///<summary>Implicit conversion to the managed representation from a native pointer.</summary>
180     ///<param name="ptr">Native pointer to be converted.</param>
181     public static implicit operator FileSaveInfo(IntPtr ptr)
182     {
183         var tmp = (FileSaveInfo.NativeStruct)Marshal.PtrToStructure(ptr, typeof(FileSaveInfo.NativeStruct));
184         return tmp;
185     }
186
187     #pragma warning disable CS1591
188
189     ///<summary>Internal wrapper for struct FileSaveInfo.</summary>
190     [StructLayout(LayoutKind.Sequential)]
191     public struct NativeStruct
192     {
193         
194         public uint Quality;
195         
196         public uint Compression;
197         ///<summary>Internal wrapper for field Encoding</summary>
198         public System.IntPtr Encoding;
199         ///<summary>Implicit conversion to the internal/marshalling representation.</summary>
200         public static implicit operator FileSaveInfo.NativeStruct(FileSaveInfo _external_struct)
201         {
202             var _internal_struct = new FileSaveInfo.NativeStruct();
203             _internal_struct.Quality = _external_struct.Quality;
204             _internal_struct.Compression = _external_struct.Compression;
205             _internal_struct.Encoding = Eina.MemoryNative.StrDup(_external_struct.Encoding);
206             return _internal_struct;
207         }
208
209         ///<summary>Implicit conversion to the managed representation.</summary>
210         public static implicit operator FileSaveInfo(FileSaveInfo.NativeStruct _internal_struct)
211         {
212             var _external_struct = new FileSaveInfo();
213             _external_struct.Quality = _internal_struct.Quality;
214             _external_struct.Compression = _internal_struct.Compression;
215             _external_struct.Encoding = Eina.StringConversion.NativeUtf8ToManagedString(_internal_struct.Encoding);
216             return _external_struct;
217         }
218
219     }
220
221     #pragma warning restore CS1591
222
223 }
224
225 }
226