[EflSharp] Introduce EflSharp project (#749)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / 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.ComponentModel;
7 namespace Efl { 
8 /// <summary>Efl file saving interface</summary>
9 [FileSaveNativeInherit]
10 public interface FileSave : 
11    Efl.Eo.IWrapper, IDisposable
12 {
13    /// <summary>Save the given image object&apos;s contents to an (image) file.
14 /// 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.
15 /// 
16 /// 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;.</summary>
17 /// <param name="file">The filename to be used to save the image (extension obligatory).</param>
18 /// <param name="key">The image key in the file (if an Eet one), or <c>null</c>, otherwise.</param>
19 /// <param name="info">The flags to be used (<c>null</c> for defaults).</param>
20 /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
21 bool Save(  System.String file,   System.String key,  ref Efl.FileSaveInfo info);
22    }
23 /// <summary>Efl file saving interface</summary>
24 sealed public class FileSaveConcrete : 
25
26 FileSave
27    
28 {
29    ///<summary>Pointer to the native class description.</summary>
30    public System.IntPtr NativeClass {
31       get {
32          if (((object)this).GetType() == typeof (FileSaveConcrete))
33             return Efl.FileSaveNativeInherit.GetEflClassStatic();
34          else
35             return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
36       }
37    }
38    private  System.IntPtr handle;
39    ///<summary>Pointer to the native instance.</summary>
40    public System.IntPtr NativeHandle {
41       get { return handle; }
42    }
43    [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
44       efl_file_save_interface_get();
45    ///<summary>Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
46    public FileSaveConcrete(System.IntPtr raw)
47    {
48       handle = raw;
49       register_event_proxies();
50    }
51    ///<summary>Destructor.</summary>
52    ~FileSaveConcrete()
53    {
54       Dispose(false);
55    }
56    ///<summary>Releases the underlying native instance.</summary>
57    void Dispose(bool disposing)
58    {
59       if (handle != System.IntPtr.Zero) {
60          Efl.Eo.Globals.efl_unref(handle);
61          handle = System.IntPtr.Zero;
62       }
63    }
64    ///<summary>Releases the underlying native instance.</summary>
65    public void Dispose()
66    {
67       Dispose(true);
68       GC.SuppressFinalize(this);
69    }
70    ///<summary>Casts obj into an instance of this type.</summary>
71    public static FileSaveConcrete static_cast(Efl.Object obj)
72    {
73       if (obj == null)
74          throw new System.ArgumentNullException("obj");
75       return new FileSaveConcrete(obj.NativeHandle);
76    }
77    ///<summary>Verifies if the given object is equal to this one.</summary>
78    public override bool Equals(object obj)
79    {
80       var other = obj as Efl.Object;
81       if (other == null)
82          return false;
83       return this.NativeHandle == other.NativeHandle;
84    }
85    ///<summary>Gets the hash code for this object based on the native pointer it points to.</summary>
86    public override int GetHashCode()
87    {
88       return this.NativeHandle.ToInt32();
89    }
90    ///<summary>Turns the native pointer into a string representation.</summary>
91    public override String ToString()
92    {
93       return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
94    }
95     void register_event_proxies()
96    {
97    }
98    /// <summary>Save the given image object&apos;s contents to an (image) file.
99    /// 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.
100    /// 
101    /// 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;.</summary>
102    /// <param name="file">The filename to be used to save the image (extension obligatory).</param>
103    /// <param name="key">The image key in the file (if an Eet one), or <c>null</c>, otherwise.</param>
104    /// <param name="info">The flags to be used (<c>null</c> for defaults).</param>
105    /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
106    public bool Save(  System.String file,   System.String key,  ref Efl.FileSaveInfo info) {
107                    var _in_info = Efl.FileSaveInfo_StructConversion.ToInternal(info);
108                                           var _ret_var = Efl.FileSaveNativeInherit.efl_file_save_ptr.Value.Delegate(this.NativeHandle, file,  key,  ref _in_info);
109       Eina.Error.RaiseIfUnhandledException();
110                                     info = Efl.FileSaveInfo_StructConversion.ToManaged(_in_info);
111       return _ret_var;
112  }
113 }
114 public class FileSaveNativeInherit  : Efl.Eo.NativeClass{
115    public  static Efl.Eo.NativeModule _Module = new Efl.Eo.NativeModule(efl.Libs.Efl);
116    public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
117    {
118       var descs = new System.Collections.Generic.List<Efl_Op_Description>();
119       if (efl_file_save_static_delegate == null)
120       efl_file_save_static_delegate = new efl_file_save_delegate(save);
121       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)});
122       return descs;
123    }
124    public override IntPtr GetEflClass()
125    {
126       return Efl.FileSaveConcrete.efl_file_save_interface_get();
127    }
128    public static  IntPtr GetEflClassStatic()
129    {
130       return Efl.FileSaveConcrete.efl_file_save_interface_get();
131    }
132
133
134     [return: MarshalAs(UnmanagedType.U1)] 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_StructInternal info);
135
136
137     [return: MarshalAs(UnmanagedType.U1)] 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_StructInternal info);
138     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");
139     private static bool save(System.IntPtr obj, System.IntPtr pd,   System.String file,   System.String key,  ref Efl.FileSaveInfo_StructInternal info)
140    {
141       Eina.Log.Debug("function efl_file_save was called");
142       Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.data_get(pd);
143       if(wrapper != null) {
144                            var _in_info = Efl.FileSaveInfo_StructConversion.ToManaged(info);
145                                              bool _ret_var = default(bool);
146          try {
147             _ret_var = ((FileSave)wrapper).Save( file,  key,  ref _in_info);
148          } catch (Exception e) {
149             Eina.Log.Warning($"Callback error: {e.ToString()}");
150             Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
151          }
152                                     info = Efl.FileSaveInfo_StructConversion.ToInternal(_in_info);
153       return _ret_var;
154       } else {
155          return efl_file_save_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)),  file,  key,  ref info);
156       }
157    }
158    private static efl_file_save_delegate efl_file_save_static_delegate;
159 }
160
161 namespace Efl { 
162 /// <summary>Info used to determine various attributes when saving a file.</summary>
163 [StructLayout(LayoutKind.Sequential)]
164 public struct FileSaveInfo
165 {
166    /// <summary>The quality level (0-100) to save the file with; commonly used when saving image files.</summary>
167    public  uint Quality;
168    /// <summary>The compression level (0-100) to save the file with.</summary>
169    public  uint Compression;
170    /// <summary>The encoding to use when saving the file.</summary>
171    public  System.String Encoding;
172    ///<summary>Constructor for FileSaveInfo.</summary>
173    public FileSaveInfo(
174        uint Quality=default( uint),
175        uint Compression=default( uint),
176        System.String Encoding=default( System.String)   )
177    {
178       this.Quality = Quality;
179       this.Compression = Compression;
180       this.Encoding = Encoding;
181    }
182 public static implicit operator FileSaveInfo(IntPtr ptr)
183    {
184       var tmp = (FileSaveInfo_StructInternal)Marshal.PtrToStructure(ptr, typeof(FileSaveInfo_StructInternal));
185       return FileSaveInfo_StructConversion.ToManaged(tmp);
186    }
187 }
188 ///<summary>Internal wrapper for struct FileSaveInfo.</summary>
189 [StructLayout(LayoutKind.Sequential)]
190 public struct FileSaveInfo_StructInternal
191 {
192    
193    public  uint Quality;
194    
195    public  uint Compression;
196 ///<summary>Internal wrapper for field Encoding</summary>
197 public System.IntPtr Encoding;
198    ///<summary>Implicit conversion to the internal/marshalling representation.</summary>
199    public static implicit operator FileSaveInfo(FileSaveInfo_StructInternal struct_)
200    {
201       return FileSaveInfo_StructConversion.ToManaged(struct_);
202    }
203    ///<summary>Implicit conversion to the managed representation.</summary>
204    public static implicit operator FileSaveInfo_StructInternal(FileSaveInfo struct_)
205    {
206       return FileSaveInfo_StructConversion.ToInternal(struct_);
207    }
208 }
209 /// <summary>Conversion class for struct FileSaveInfo</summary>
210 public static class FileSaveInfo_StructConversion
211 {
212    internal static FileSaveInfo_StructInternal ToInternal(FileSaveInfo _external_struct)
213    {
214       var _internal_struct = new FileSaveInfo_StructInternal();
215
216       _internal_struct.Quality = _external_struct.Quality;
217       _internal_struct.Compression = _external_struct.Compression;
218       _internal_struct.Encoding = Eina.MemoryNative.StrDup(_external_struct.Encoding);
219
220       return _internal_struct;
221    }
222
223    internal static FileSaveInfo ToManaged(FileSaveInfo_StructInternal _internal_struct)
224    {
225       var _external_struct = new FileSaveInfo();
226
227       _external_struct.Quality = _internal_struct.Quality;
228       _external_struct.Compression = _internal_struct.Compression;
229       _external_struct.Encoding = Eina.StringConversion.NativeUtf8ToManagedString(_internal_struct.Encoding);
230
231       return _external_struct;
232    }
233
234 }
235