using static Efl.UnsafeNativeMethods;
-namespace Efl {
-
-static class UnsafeNativeMethods {
+namespace Efl
+{
+static class UnsafeNativeMethods
+{
private delegate void init_func_delegate();
[DllImport(efl.Libs.Ecore)] public static extern void ecore_init();
[DllImport(efl.Libs.Ecore)] public static extern void ecore_shutdown();
[DllImport(efl.Libs.Elementary)] public static extern void elm_run();
[DllImport(efl.Libs.Elementary)] public static extern void elm_exit();
- static UnsafeNativeMethods() {
+ static UnsafeNativeMethods()
+ {
_evas_init = new Efl.Eo.FunctionWrapper<init_func_delegate>("evas", "evas_init");
}
+
public static void evas_init()
{
_evas_init.Value.Delegate();
}
}
-public static class All {
+public static class All
+{
private static bool InitializedUi = false;
- public static void Init(Efl.Csharp.Components components=Efl.Csharp.Components.Basic) {
+ public static void Init(Efl.Csharp.Components components = Efl.Csharp.Components.Basic)
+ {
Eina.Config.Init();
Efl.Eo.Config.Init();
ecore_init();
evas_init();
eldbus.Config.Init();
- if (components == Efl.Csharp.Components.Ui) {
+ if (components == Efl.Csharp.Components.Ui)
+ {
Efl.Ui.Config.Init();
InitializedUi = true;
}
}
/// <summary>Shutdowns all EFL subsystems.</summary>
- public static void Shutdown() {
+ public static void Shutdown()
+ {
// Try to cleanup everything before actually shutting down.
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
if (InitializedUi)
+ {
Efl.Ui.Config.Shutdown();
+ }
+
eldbus.Config.Shutdown();
evas_shutdown();
ecore_shutdown();
}
// Placeholder. Will move to elm_config.cs later
-namespace Ui {
+namespace Ui
+{
-public static class Config {
- public static void Init() {
+public static class Config
+{
+ public static void Init()
+ {
// TODO Support elm command line arguments
#if WIN32 // Not a native define, we define it in our build system
// Ecore_Win32 uses OleInitialize, which requires single thread apartments
if (System.Threading.Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
+ {
throw new InvalidOperationException("UI Applications require STAThreadAttribute in Main()");
+ }
#endif
elm_init(0, IntPtr.Zero);
elm_policy_set((int)Elm.Policy.Quit, (int)Elm.PolicyQuit.LastWindowHidden);
}
- public static void Shutdown() {
+
+ public static void Shutdown()
+ {
elm_shutdown();
}
- public static void Run() {
+ public static void Run()
+ {
elm_run();
}
- public static void Exit() {
+ public static void Exit()
+ {
elm_exit();
}
}
using System.Threading;
using static Efl.UnsafeNativeMethods;
-namespace Efl {
- namespace Csharp {
- ///<summary>The components to be initialized.</summary>
- public enum Components {
- ///<summary>Basic components: Eina, Eo, Ecore, Evas and DBus.</summary>
- Basic,
- ///<summary>The same components of <see cref="Efl.Csharp.Components.Basic"/> and the Elementary widget toolkit.</summary>
- Ui,
- }
- /// <summary>
- /// This represents the entry point for the EFL framework
- /// You can use this class to implement the 4 abstract methods which will then be called accordingly
- /// All subsystems of efl are booted up correctly when the abstract methods of this class are called.
- /// </summary>
- /// <remarks>
- /// Calls to efl outside those efl-callbacks or outside the mainloop are not allowed and will lead to issues
- /// </remarks>
- /// <example>
- /// UserApp is the class that implements the Application abstract
- /// <code>
- /// public static void Main() {
- /// UserApp editor = new UserApp();
- /// editor.Launch(editor);
- /// }
- /// </code>
- /// </example>
- public abstract class Application {
- //the initializied components
- private static Components initComponent;
- //what follows are 3 private functions to boot up the internals of efl
- private static void Init(Efl.Csharp.Components component) {
+namespace Efl
+{
+
+namespace Csharp
+{
+
+///<summary>The components to be initialized.</summary>
+public enum Components
+{
+ ///<summary>Basic components: Eina, Eo, Ecore, Evas and DBus.</summary>
+ Basic,
+ ///<summary>The same components of <see cref="Efl.Csharp.Components.Basic"/> and the Elementary widget toolkit.</summary>
+ Ui,
+}
+
+/// <summary>
+/// This represents the entry point for the EFL framework
+/// You can use this class to implement the 4 abstract methods which will then be called accordingly
+/// All subsystems of efl are booted up correctly when the abstract methods of this class are called.
+/// </summary>
+/// <remarks>
+/// Calls to efl outside those efl-callbacks or outside the mainloop are not allowed and will lead to issues
+/// </remarks>
+/// <example>
+/// UserApp is the class that implements the Application abstract
+/// <code>
+/// public static void Main()
+/// {
+/// UserApp editor = new UserApp();
+/// editor.Launch(editor);
+/// }
+/// </code>
+/// </example>
+public abstract class Application
+{
+ //the initializied components
+ private static Components initComponent;
+ //what follows are 3 private functions to boot up the internals of efl
+ private static void Init(Efl.Csharp.Components component)
+ {
Eina.Config.Init();
Efl.Eo.Config.Init();
ecore_init();
evas_init();
eldbus.Config.Init();
- if (component == Components.Ui) {
- // TODO Support elm command line arguments
-#if WIN32 // Not a native define, we define it in our build system
- // Ecore_Win32 uses OleInitialize, which requires single thread apartments
- if (System.Threading.Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
- throw new InvalidOperationException("UI Applications require STAThreadAttribute in Main()");
+ if (component == Components.Ui)
+ {
+ // TODO Support elm command line arguments
+#if WIN32 // Not a native define, we define it in our build system
+ // Ecore_Win32 uses OleInitialize, which requires single thread apartments
+ if (System.Threading.Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
+ {
+ throw new InvalidOperationException("UI Applications require STAThreadAttribute in Main()");
+ }
#endif
- elm_init(0, IntPtr.Zero);
+ elm_init(0, IntPtr.Zero);
- elm_policy_set((int)Elm.Policy.Quit, (int)Elm.PolicyQuit.LastWindowHidden);
+ elm_policy_set((int)Elm.Policy.Quit, (int)Elm.PolicyQuit.LastWindowHidden);
}
+
initComponent = component;
- }
- private static void Shutdown() {
+ }
+
+ private static void Shutdown()
+ {
// Try to cleanup everything before actually shutting down.
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
- if (initComponent == Components.Ui) {
- elm_shutdown();
+ if (initComponent == Components.Ui)
+ {
+ elm_shutdown();
}
+
eldbus.Config.Shutdown();
evas_shutdown();
ecore_shutdown();
Efl.Eo.Config.Shutdown();
Eina.Config.Shutdown();
- }
- /// <summary>
- /// Called when the application is started. Arguments from the command line are passed here.
- /// </summary>
- protected abstract void OnInitialize(Eina.Array<System.String> args);
- /// <summary>
- /// Arguments are passed here, Additional calls to this function may occure,
- /// but then the initialization flag is set to false.
- /// </summary>
- /// <remarks>
- /// When Initialize is true then OnInitialize is also called
- /// </remarks>
- protected virtual void OnArguments(Efl.LoopArguments args) { }
- /// <summary>
- /// Called when the application is not going to be displayed, or is not used by a user for some time.
- /// </summary>
- protected virtual void OnPause() { }
- /// <summary>
- /// Called before an application is used again after a call to OnPause().
- /// </summary>
- protected virtual void OnResume() { }
- /// <summary>
- /// Called before starting the shutdown of the application.
- /// </summary>
- protected virtual void OnTerminate() { }
- /// <summary>
- /// This function initializices everything in EFL and runs your application.
- /// This call will result in a call to OnInitialize(), which you application should override.
- /// </summary>
- public void Launch(Efl.Csharp.Components components=Components.Ui) {
+ }
+
+ /// <summary>
+ /// Called when the application is started. Arguments from the command line are passed here.
+ /// </summary>
+ protected abstract void OnInitialize(Eina.Array<System.String> args);
+
+ /// <summary>
+ /// Arguments are passed here, Additional calls to this function may occure,
+ /// but then the initialization flag is set to false.
+ /// </summary>
+ /// <remarks>
+ /// When Initialize is true then OnInitialize is also called
+ /// </remarks>
+ protected virtual void OnArguments(Efl.LoopArguments args)
+ {
+ }
+
+ /// <summary>
+ /// Called when the application is not going to be displayed, or is not used by a user for some time.
+ /// </summary>
+ protected virtual void OnPause()
+ {
+ }
+
+ /// <summary>
+ /// Called before an application is used again after a call to OnPause().
+ /// </summary>
+ protected virtual void OnResume()
+ {
+ }
+
+ /// <summary>
+ /// Called before starting the shutdown of the application.
+ /// </summary>
+ protected virtual void OnTerminate()
+ {
+ }
+
+ /// <summary>
+ /// This function initializices everything in EFL and runs your application.
+ /// This call will result in a call to OnInitialize(), which you application should override.
+ /// </summary>
+ public void Launch(Efl.Csharp.Components components = Components.Ui)
+ {
Init(components);
Efl.App app = Efl.App.AppMain;
Eina.Array<String> command_line = new Eina.Array<String>();
#if EFL_BETA
app.SetCommandArray(command_line);
#endif
- app.ArgumentsEvt += (object sender, LoopArgumentsEvt_Args evt) => {
- if (evt.arg.Initialization) {
- OnInitialize(evt.arg.Argv);
- }
- OnArguments(evt.arg);
+ app.ArgumentsEvt += (object sender, LoopArgumentsEvt_Args evt) =>
+ {
+ if (evt.arg.Initialization)
+ {
+ OnInitialize(evt.arg.Argv);
+ }
+
+ OnArguments(evt.arg);
};
- app.PauseEvt += (object sender, EventArgs e) => {
- OnPause();
+ app.PauseEvt += (object sender, EventArgs e) =>
+ {
+ OnPause();
};
- app.ResumeEvt += (object sender, EventArgs e) => {
- OnResume();
+ app.ResumeEvt += (object sender, EventArgs e) =>
+ {
+ OnResume();
};
- app.TerminateEvt += (object sender, EventArgs e) => {
- OnTerminate();
+ app.TerminateEvt += (object sender, EventArgs e) =>
+ {
+ OnTerminate();
};
app.Begin();
Shutdown();
- }
}
- }
}
+}
+}
using static Eina.AccessorNativeFunctions;
-namespace Eina {
+namespace Eina
+{
internal class AccessorNativeFunctions
{
/// <summary>Create a new accessor wrapping the given pointer.</summary>
/// <param name="handle">The native handle to be wrapped.</param>
/// <param name="owner">Whether this wrapper owns the native accessor.</param>
- public Accessor(IntPtr handle, Ownership owner=Ownership.Managed)
+ public Accessor(IntPtr handle, Ownership owner = Ownership.Managed)
{
Handle = handle;
Ownership = owner;
/// <param name="handle">The native handle to be wrapped.</param>
/// <param name="own">Whether this wrapper owns the native accessor.</param>
/// <param name="ownContent">For compatibility with other EFL# containers. Ignored in acessors.</param>
- public Accessor(IntPtr handle, bool own, bool ownContent=false)
+ public Accessor(IntPtr handle, bool own, bool ownContent = false)
: this(handle, own ? Ownership.Managed : Ownership.Unmanaged)
{
}
public IEnumerator<T> GetEnumerator()
{
if (Handle == IntPtr.Zero)
+ {
throw new ObjectDisposedException(base.GetType().Name);
+ }
+
IntPtr tmp = MemoryNative.Alloc(Marshal.SizeOf(typeof(IntPtr)));
uint position = 0;
try
{
- while(eina_accessor_data_get(Handle, position, tmp))
+ while (eina_accessor_data_get(Handle, position, tmp))
{
IntPtr data = (IntPtr)Marshal.PtrToStructure(tmp, typeof(IntPtr));
yield return Convert(data);
///<summary>Accessor for Inlists.</summary>
public class AccessorInList<T> : Accessor<T>
{
-
/// <summary>Create a new accessor wrapping the given pointer.</summary>
/// <param name="handle">The native handle to be wrapped.</param>
/// <param name="own">Whether this wrapper owns the native accessor.</param>
- public AccessorInList(IntPtr handle, Ownership own): base(handle, own) {}
+ public AccessorInList(IntPtr handle, Ownership own) : base(handle, own)
+ {
+ }
/// <summary>Convert the native data into managed. This is used when returning the data through a
/// <see cref="System.Collections.Generic.IEnumerator<T>"/>.</summary>
/// <summary>Create a new accessor wrapping the given pointer.</summary>
/// <param name="handle">The native handle to be wrapped.</param>
/// <param name="own">Whether this wrapper owns the native accessor.</param>
- public AccessorInArray(IntPtr handle, Ownership own): base(handle, own) {}
+ public AccessorInArray(IntPtr handle, Ownership own) : base(handle, own)
+ {
+ }
/// <summary>Convert the native data into managed. This is used when returning the data through a
/// <see cref="System.Collections.Generic.IEnumerator<T>"/>.</summary>
using static Eina.TraitFunctions;
using static Eina.ArrayNativeFunctions;
-namespace Eina {
+namespace Eina
+{
public static class ArrayNativeFunctions
{
Own = true;
OwnContent = true;
if (Handle == IntPtr.Zero)
+ {
throw new SEHException("Could not alloc array");
+ }
}
internal bool InternalPush(IntPtr ele)
IntPtr h = Handle;
Handle = IntPtr.Zero;
if (h == IntPtr.Zero)
+ {
return;
+ }
if (OwnContent)
{
int len = (int)eina_array_count_custom_export_mono(h);
- for(int i = 0; i < len; ++i)
+ for (int i = 0; i < len; ++i)
{
NativeFree<T>(eina_array_data_get_custom_export_mono(h, (uint)i));
}
}
if (Own)
+ {
eina_array_free(h);
+ }
}
public void Dispose()
if (OwnContent)
{
int len = Length;
- for(int i = 0; i < len; ++i)
+ for (int i = 0; i < len; ++i)
{
NativeFree<T>(InternalDataGet(i));
}
public int Count()
{
- return (int) eina_array_count_custom_export_mono(Handle);
+ return (int)eina_array_count_custom_export_mono(Handle);
}
public void SetOwnership(bool ownAll)
IntPtr ele = ManagedToNativeAlloc(val);
var r = InternalPush(ele);
if (!r)
+ {
NativeFree<T>(ele);
+ }
+
return r;
}
// public void Add(T val)
// {
// if (!Push(val))
-// throw;
+// {
+// throw;
+// }
// }
public T Pop()
IntPtr ele = InternalPop();
var r = NativeToManaged<T>(ele);
if (OwnContent && ele != IntPtr.Zero)
+ {
NativeFree<T>(ele);
+ }
+
return r;
}
{
IntPtr ele = InternalDataGet(idx); // TODO: check bondaries ??
if (OwnContent && ele != IntPtr.Zero)
+ {
NativeFree<T>(ele);
+ }
+
ele = ManagedToNativeAlloc(val);
InternalDataSet(idx, ele);
}
{
int len = Length;
var managed = new T[len];
- for(int i = 0; i < len; ++i)
+ for (int i = 0; i < len; ++i)
{
managed[i] = DataGet(i);
}
+
return managed;
}
public bool Append(T[] values)
{
- foreach(T v in values)
+ foreach (T v in values)
+ {
if (!Push(v))
+ {
return false;
+ }
+ }
+
return true;
}
public IEnumerator<T> GetEnumerator()
{
int len = Length;
- for(int i = 0; i < len; ++i)
+ for (int i = 0; i < len; ++i)
{
yield return DataGet(i);
}
using System;
using System.Runtime.InteropServices;
-namespace Eina {
+namespace Eina
+{
public class Binbuf : IDisposable
{
public int Length
{
- get { return (int) GetLength(); }
+ get { return (int)GetLength(); }
}
private void InitNew()
Handle = eina_binbuf_new();
Own = true;
if (Handle == IntPtr.Zero)
+ {
throw new SEHException("Could not alloc binbuf");
+ }
}
public Binbuf()
{
IntPtr h = Handle;
Handle = IntPtr.Zero;
- if (Own && h != IntPtr.Zero) {
+ if (Own && h != IntPtr.Zero)
+ {
eina_binbuf_free(Handle);
}
}
{
var ptr = eina_binbuf_string_get(Handle);
if (ptr == IntPtr.Zero)
+ {
return null;
+ }
var size = (int)(this.GetLength());
byte[] mArray = new byte[size];
namespace Eina
{
+
namespace Callbacks
{
}
/// <summary>Wrapper around native memory DllImport'd functions</summary>
-public static class MemoryNative {
+public static class MemoryNative
+{
public static void Free(IntPtr ptr)
{
NativeCustomExportFunctions.efl_mono_native_free(ptr);
public static IntPtr ManagedStringToNativeUtf8Alloc(string managedString)
{
if (managedString == null)
+ {
return IntPtr.Zero;
+ }
byte[] strbuf = Encoding.UTF8.GetBytes(managedString);
IntPtr native = MemoryNative.Alloc(strbuf.Length + 1);
public static string NativeUtf8ToManagedString(IntPtr pNativeData)
{
if (pNativeData == IntPtr.Zero)
+ {
return null;
+ }
int len = 0;
while (Marshal.ReadByte(pNativeData, len) != 0)
+ {
++len;
+ }
byte[] strbuf = new byte[len];
Marshal.Copy(pNativeData, strbuf, 0, strbuf.Length);
}
/// <summary>Enum to handle resource ownership between managed and unmanaged code.</summary>
-public enum Ownership {
+public enum Ownership
+{
/// <summary> The resource is owned by the managed code. It should free the handle on disposal.</summary>
Managed,
/// <summary> The resource is owned by the unmanaged code. It won't be freed on disposal.</summary>
using System;
using System.Runtime.InteropServices;
-namespace Eina {
+namespace Eina
+{
-public class Config {
+public class Config
+{
[DllImport(efl.Libs.Eina)] private static extern int eina_init();
[DllImport(efl.Libs.Eina)] private static extern int eina_shutdown();
- public static void Init() {
+ public static void Init()
+ {
if (eina_init() == 0)
+ {
throw (new Efl.EflException("Failed to initialize Eina"));
+ }
}
- public static int Shutdown() {
+ public static int Shutdown()
+ {
return eina_shutdown();
}
/// Wrapper class for pointers that need some cleanup afterwards
/// like strings.
/// </summary>
-public class DisposableIntPtr : IDisposable {
-
+public class DisposableIntPtr : IDisposable
+{
public IntPtr Handle { get; set; }
private bool ShouldFree;
private bool Disposed;
/// <summary>Wraps a new ptr what will be freed based on the
/// value of shouldFree</summary>
- public DisposableIntPtr(IntPtr ptr, bool shouldFree=false)
+ public DisposableIntPtr(IntPtr ptr, bool shouldFree = false)
{
Handle = ptr;
ShouldFree = shouldFree;
protected virtual void Dispose(bool disposing)
{
- if (!Disposed && ShouldFree) {
+ if (!Disposed && ShouldFree)
+ {
MemoryNative.Free(this.Handle);
}
+
Disposed = true;
}
Dispose(false);
}
}
+
}
using static Eina.InlistNativeFunctions;
using static Eina.NativeCustomExportFunctions;
-namespace Eina {
+namespace Eina
+{
-public enum ElementType { NumericType, StringType, ObjectType };
+public enum ElementType
+{
+ NumericType,
+ StringType,
+ ObjectType
+};
[StructLayout(LayoutKind.Sequential)]
public struct InlistMem
public void NativeFree(IntPtr nat)
{
if (nat != IntPtr.Zero)
+ {
MemoryNative.Free(nat);
+ }
}
public void NativeFreeInlistNodeElement(IntPtr nat)
{
if (nat == IntPtr.Zero)
+ {
return;
+ }
+
var val = Marshal.PtrToStructure<IntPtr>
(nat + Marshal.SizeOf<InlistMem>());
NativeFree(val);
public void NativeFreeInlistNode(IntPtr nat, bool freeElement)
{
if (nat == IntPtr.Zero)
+ {
return;
+ }
+
if (freeElement)
+ {
NativeFreeInlistNodeElement(nat);
+ }
+
MemoryNative.Free(nat);
}
public string NativeToManaged(IntPtr nat)
{
if (nat == IntPtr.Zero)
+ {
return default(string);
+ }
+
return StringConversion.NativeUtf8ToManagedString(nat);
}
Eina.Log.Error("Null pointer for Inlist node.");
return default(string);
}
+
IntPtr ptr_location = nat + Marshal.SizeOf<InlistMem>();
return NativeToManaged(Marshal.ReadIntPtr(ptr_location));
}
public string NativeToManagedInplace(IntPtr nat)
{
if (nat == IntPtr.Zero)
+ {
return default(string);
+ }
+
nat = Marshal.ReadIntPtr(nat);
if (nat == IntPtr.Zero)
+ {
return default(string);
+ }
+
return NativeToManaged(nat);
}
{
IntPtr h = ((Efl.Eo.IWrapper)man).NativeHandle;
if (h == IntPtr.Zero)
+ {
return h;
+ }
+
return Efl.Eo.Globals.efl_ref(h);
}
public void NativeFree(IntPtr nat)
{
if (nat != IntPtr.Zero)
+ {
Efl.Eo.Globals.efl_unref(nat);
+ }
}
public void NativeFreeRef(IntPtr nat, bool unrefs)
{
if (unrefs)
+ {
NativeFree(nat);
+ }
}
public void NativeFreeInlistNodeElement(IntPtr nat)
{
if (nat == IntPtr.Zero)
+ {
return;
+ }
+
var val = Marshal.PtrToStructure<IntPtr>
(nat + Marshal.SizeOf<InlistMem>());
NativeFree(val);
public void NativeFreeInlistNode(IntPtr nat, bool freeElement)
{
if (nat == IntPtr.Zero)
+ {
return;
+ }
+
if (freeElement)
+ {
NativeFreeInlistNodeElement(nat);
+ }
+
MemoryNative.Free(nat);
}
public T NativeToManaged(IntPtr nat)
{
if (nat == IntPtr.Zero)
+ {
return default(T);
- return (T) Activator.CreateInstance(concreteType, Efl.Eo.Globals.efl_ref(nat));
+ }
+
+ return (T)Activator.CreateInstance(concreteType, Efl.Eo.Globals.efl_ref(nat));
}
public T NativeToManagedRef(IntPtr nat)
{
if (nat == IntPtr.Zero)
+ {
return default(T);
+ }
+
return NativeToManaged(nat);
}
Eina.Log.Error("Null pointer for Inlist node.");
return default(T);
}
+
IntPtr ptr_location = nat + Marshal.SizeOf<InlistMem>();
return NativeToManaged(Marshal.ReadIntPtr(ptr_location));
}
public T NativeToManagedInplace(IntPtr nat)
{
if (nat == IntPtr.Zero)
+ {
return default(T);
+ }
+
nat = Marshal.ReadIntPtr(nat);
if (nat == IntPtr.Zero)
+ {
return default(T);
+ }
+
return NativeToManaged(nat);
}
Eina.Log.Error("Null pointer on primitive/struct container.");
return default(T);
}
+
return PrimitiveConversion.PointerToManaged<T>(nat);
}
private int PrimitiveCompareCb(IntPtr ptr1, IntPtr ptr2)
{
- var m1 = (IComparable) NativeToManaged(ptr1);
+ var m1 = (IComparable)NativeToManaged(ptr1);
var m2 = NativeToManaged(ptr2);
return m1.CompareTo(m2);
}
public IntPtr EinaCompareCb()
{
if (dlgt == null)
+ {
dlgt = new Eina_Compare_Cb(PrimitiveCompareCb);
+ }
+
return Marshal.GetFunctionPointerForDelegate(dlgt);
}
public Primitive32ElementTraits()
{
if (int32Traits == null)
+ {
if (typeof(T) == typeof(Int32)) // avoid infinite recursion
+ {
int32Traits = (IBaseElementTraits<Int32>)this;
+ }
else
+ {
int32Traits = TraitFunctions.GetTypeTraits<Int32>();
+ }
+ }
}
public abstract void ManagedToNativeCopyTo(T man, IntPtr mem);
public Primitive64ElementTraits()
{
if (int64Traits == null)
+ {
if (typeof(T) == typeof(Int64)) // avoid infinite recursion
+ {
int64Traits = (IBaseElementTraits<Int64>)this;
+ }
else
+ {
int64Traits = TraitFunctions.GetTypeTraits<Int64>();
+ }
+ }
}
public abstract void ManagedToNativeCopyTo(T man, IntPtr mem);
arr[0] = man;
Marshal.Copy(arr, 0, mem, 1);
}
+
override public int NativeToManagedInlistNode(IntPtr nat)
{
if (nat == IntPtr.Zero)
Eina.Log.Error("Null pointer for Inlist node.");
return default(int);
}
+
IntPtr loc = nat + Marshal.SizeOf<InlistMem>();
var v = new int[1];
Marshal.Copy(loc, v, 0, 1);
arr[0] = man;
Marshal.Copy(arr, 0, mem, 1);
}
+
override public char NativeToManagedInlistNode(IntPtr nat)
{
if (nat == IntPtr.Zero)
Eina.Log.Error("Null pointer for Inlist node.");
return default(char);
}
+
IntPtr loc = nat + Marshal.SizeOf<InlistMem>();
var v = new char[1];
Marshal.Copy(loc, v, 0, 1);
return v[0];
}
}
+
public class LongElementTraits : Primitive64ElementTraits<long>, IBaseElementTraits<long>
{
override public void ManagedToNativeCopyTo(long man, IntPtr mem)
arr[0] = man;
Marshal.Copy(arr, 0, mem, 1);
}
+
override public long NativeToManagedInlistNode(IntPtr nat)
{
if (nat == IntPtr.Zero)
Eina.Log.Error("Null pointer for Inlist node.");
return default(long);
}
+
IntPtr loc = nat + Marshal.SizeOf<InlistMem>();
var v = new long[1];
Marshal.Copy(loc, v, 0, 1);
arr[0] = man;
Marshal.Copy(arr, 0, mem, 1);
}
+
override public short NativeToManagedInlistNode(IntPtr nat)
{
if (nat == IntPtr.Zero)
Eina.Log.Error("Null pointer for Inlist node.");
return default(short);
}
+
IntPtr loc = nat + Marshal.SizeOf<InlistMem>();
var v = new short[1];
Marshal.Copy(loc, v, 0, 1);
arr[0] = man;
Marshal.Copy(arr, 0, mem, 1);
}
+
override public float NativeToManagedInlistNode(IntPtr nat)
{
if (nat == IntPtr.Zero)
Eina.Log.Error("Null pointer for Inlist node.");
return default(float);
}
+
IntPtr loc = nat + Marshal.SizeOf<InlistMem>();
var v = new float[1];
Marshal.Copy(loc, v, 0, 1);
arr[0] = man;
Marshal.Copy(arr, 0, mem, 1);
}
+
override public double NativeToManagedInlistNode(IntPtr nat)
{
if (nat == IntPtr.Zero)
Eina.Log.Error("Null pointer for Inlist node.");
return default(double);
}
+
IntPtr loc = nat + Marshal.SizeOf<InlistMem>();
var v = new double[1];
Marshal.Copy(loc, v, 0, 1);
arr[0] = man;
Marshal.Copy(arr, 0, mem, 1);
}
+
override public byte NativeToManagedInlistNode(IntPtr nat)
{
if (nat == IntPtr.Zero)
Eina.Log.Error("Null pointer for Inlist node.");
return default(byte);
}
+
IntPtr loc = nat + Marshal.SizeOf<InlistMem>();
var v = new byte[1];
Marshal.Copy(loc, v, 0, 1);
public static Eina.ElementType GetElementTypeCode(System.Type type)
{
if (IsEflObject(type))
+ {
return ElementType.ObjectType;
+ }
else if (IsString(type))
+ {
return ElementType.StringType;
+ }
else
+ {
return ElementType.NumericType;
+ }
}
private static IDictionary<System.Type, object> register = new Dictionary<System.Type, object>();
private static System.Type AsEflInstantiableType(System.Type type)
{
if (!IsEflObject(type))
+ {
return null;
+ }
if (type.IsInterface)
{
{
System.Type concrete = AsEflInstantiableType(type);
if (concrete == null || !type.IsAssignableFrom(concrete))
+ {
throw new Exception("Failed to get a suitable concrete class for this type.");
+ }
+
traits = new EflObjectElementTraits<T>(concrete);
}
else if (IsString(type))
+ {
traits = new StringElementTraits();
+ }
else if (type.IsValueType)
{
if (type == typeof(int))
+ {
traits = new IntElementTraits();
+ }
else if (type == typeof(char))
+ {
traits = new CharElementTraits();
+ }
else if (type == typeof(long))
+ {
traits = new LongElementTraits();
+ }
else if (type == typeof(short))
+ {
traits = new ShortElementTraits();
+ }
else if (type == typeof(float))
+ {
traits = new FloatElementTraits();
+ }
else if (type == typeof(double))
+ {
traits = new DoubleElementTraits();
+ }
else if (type == typeof(byte))
+ {
traits = new ByteElementTraits();
+ }
else
+ {
throw new Exception("No traits registered for this type");
+ }
}
else
+ {
throw new Exception("No traits registered for this type");
+ }
register[type] = traits;
return traits;
{
object traits;
if (!register.TryGetValue(typeof(T), out traits))
+ {
traits = RegisterTypeTraits<T>();
- return (IBaseElementTraits<T>) traits;
+ }
+
+ return (IBaseElementTraits<T>)traits;
}
// //
using System;
using System.Runtime.InteropServices;
-namespace Eina {
+namespace Eina
+{
public struct Error : IComparable<Error>
{
public static Error ENOENT = new Error(2);
public static Error ECANCELED = new Error(125);
- public Error(int value) { code = value; }
+ public Error(int value)
+ {
+ code = value;
+ }
+
static public implicit operator Error(int val)
{
return new Error(val);
}
+
static public implicit operator int(Error error)
{
return error.code;
}
+
public int CompareTo(Error err)
{
return code.CompareTo(err.code);
}
+
public override string ToString()
{
return "Eina.Error(" + code + ")";
public static void Raise(Error e)
{
if (e != 0)
+ {
throw (new Efl.EflException(MsgGet(e)));
+ }
}
public static void Clear()
return eina_error_msg_register(msg);
}
}
+
}
public bool OwnKey {get; set;}
public bool OwnValue {get; set;}
- public int Count {
- get {
+ public int Count
+ {
+ get
+ {
return Population();
}
}
IntPtr h = Handle;
Handle = IntPtr.Zero;
if (h == IntPtr.Zero)
+ {
return;
+ }
if (Own)
+ {
eina_hash_free(h);
+ }
}
public void Dispose()
OwnValue = ownValue;
if (ownValue)
+ {
eina_hash_free_cb_set(Handle, EinaFreeCb<TValue>());
+ }
}
public void SetOwnership(bool ownAll)
//NativeFreeRef<TKey>(nk);
FreeNativeIndirection<TKey>(gchnk, ForceRefKey<TKey>());
if (found == IntPtr.Zero)
+ {
throw new KeyNotFoundException();
+ }
return NativeToManaged<TValue>(IndirectNative<TValue>(found, false));
}
val = default(TValue);
return false;
}
+
val = NativeToManaged<TValue>(IndirectNative<TValue>(found, false));
return true;
}
NativeFree<TValue>(nv);
return false;
}
+
if (OwnValue)
+ {
NativeFree<TValue>(old);
+ }
+
return true;
}
return GCHandle.ToIntPtr(gch);
}
- else if(IsEflObject(typeof(T)) && forceRef)
+ else if (IsEflObject(typeof(T)) && forceRef)
{
GCHandle gch = GCHandle.Alloc(new byte[Marshal.SizeOf<IntPtr>()], GCHandleType.Pinned);
IntPtr pin = gch.AddrOfPinnedObject();
return ManagedToNativeAlloc(value);
}
}
+
private static IntPtr GetNativePtr<T>(IntPtr gchptr, bool forceRef)
{
if (forceRef)
return gchptr;
}
}
+
private static void FreeNativeIndirection<T>(IntPtr gchptr, bool forceRef)
{
if (forceRef)
FreeNativeIndirection<TKey>(gchnk, ForceRefKey<TKey>());
FreeNativeIndirection<TValue>(gchnv, false);
if (OwnValue || old != IntPtr.Zero)
+ {
NativeFree<TValue>(old);
+ }
}
public TValue this[TKey key]
}
}
-
using static Eina.TraitFunctions;
using static Eina.InarrayNativeFunctions;
-namespace Eina {
+namespace Eina
+{
public static class InarrayNativeFunctions
{
Own = true;
OwnContent = true;
if (Handle == IntPtr.Zero)
+ {
throw new SEHException("Could not alloc inarray");
+ }
}
public Inarray()
IntPtr h = Handle;
Handle = IntPtr.Zero;
if (h == IntPtr.Zero)
+ {
return;
+ }
if (OwnContent)
{
uint len = eina_inarray_count(h);
- for(uint i = 0; i < len; ++i)
+ for (uint i = 0; i < len; ++i)
{
NativeFreeInplace<T>(eina_inarray_nth(h, i));
}
}
if (Own)
+ {
eina_inarray_free(h);
+ }
}
public void Dispose()
public int Count()
{
- return (int) eina_inarray_count(Handle);
+ return (int)eina_inarray_count(Handle);
}
public void SetOwnership(bool ownAll)
var r = eina_inarray_push(Handle, ind);
if (r == -1)
+ {
NativeFreeInplace<T>(ele);
+ }
+
ResidueFreeInplace<T>(ele);
gch.Free();
return r;
// public void Add(T val)
// {
// if (!Push(val))
-// throw;
+// {
+// throw;
+// }
// }
public T Pop()
IntPtr ele = eina_inarray_pop(Handle);
var r = NativeToManagedInplace<T>(ele);
if (OwnContent && ele != IntPtr.Zero)
+ {
NativeFreeInplace<T>(ele);
+ }
+
return r;
}
var r = eina_inarray_insert_at(Handle, idx, ind);
if (!r)
+ {
NativeFreeInplace<T>(ele);
+ }
+
ResidueFreeInplace<T>(ele);
return r;
}
{
var old = eina_inarray_nth(Handle, idx);
if (old == IntPtr.Zero)
+ {
return false;
+ }
+
if (OwnContent)
+ {
NativeFreeInplace<T>(old);
+ }
+
var ele = IntPtr.Zero;
GCHandle gch = GCHandle.Alloc(ele, GCHandleType.Pinned);
IntPtr ind = gch.AddrOfPinnedObject();
{
IntPtr ele = eina_inarray_nth(Handle, idx);
if (ele == IntPtr.Zero)
+ {
return false;
+ }
+
if (OwnContent)
+ {
NativeFreeInplace<T>(ele);
+ }
return eina_inarray_remove_at(Handle, idx);
}
{
int len = Length;
var managed = new T[len];
- for(int i = 0; i < len; ++i)
+ for (int i = 0; i < len; ++i)
{
managed[i] = At(i);
}
+
return managed;
}
public bool Append(T[] values)
{
- foreach(T v in values)
+ foreach (T v in values)
+ {
if (Push(v) == -1)
+ {
return false;
+ }
+ }
+
return true;
}
public IEnumerator<T> GetEnumerator()
{
int len = Length;
- for(int i = 0; i < len; ++i)
+ for (int i = 0; i < len; ++i)
{
yield return At(i);
}
using static Eina.InlistNativeFunctions;
using Eina.Callbacks;
-namespace Eina {
+namespace Eina
+{
public static class InlistNativeFunctions
{
private IntPtr InternalAt(int idx)
{
if (idx < 0)
+ {
return IntPtr.Zero;
+ }
IntPtr curr = Handle;
for (int n = 0; n != idx && curr != IntPtr.Zero; ++n)
+ {
curr = InternalNext(curr);
+ }
+
return curr;
}
IntPtr h = Handle;
Handle = IntPtr.Zero;
if (h == IntPtr.Zero)
+ {
return;
+ }
if (OwnContent)
{
- for(IntPtr curr = h; curr != IntPtr.Zero; curr = InternalNext(curr))
+ for (IntPtr curr = h; curr != IntPtr.Zero; curr = InternalNext(curr))
{
NativeFreeInlistNodeElement<T>(curr);
}
public int Count()
{
- return (int) eina_inlist_count(Handle);
+ return (int)eina_inlist_count(Handle);
}
public void Clean()
{
IntPtr node = InternalAt(idx);
if (node == IntPtr.Zero)
+ {
throw new IndexOutOfRangeException();
+ }
+
return NativeToManagedInlistNode<T>(node);
}
{
IntPtr old = InternalAt(idx);
if (old == IntPtr.Zero)
+ {
throw new IndexOutOfRangeException();
+ }
IntPtr new_node = ManagedToNativeAllocInlistNode(val);
{
var managed = new T[Count()];
int i = 0;
- for(IntPtr curr = Handle; curr != IntPtr.Zero; ++i, curr = InternalNext(curr))
+ for (IntPtr curr = Handle; curr != IntPtr.Zero; ++i, curr = InternalNext(curr))
{
managed[i] = NativeToManagedInlistNode<T>(curr);
}
+
return managed;
}
public void AppendArray(T[] values)
{
foreach (T v in values)
+ {
Append(v);
+ }
}
public IEnumerator<T> GetEnumerator()
{
- for(IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr))
+ for (IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr))
{
yield return NativeToManagedInlistNode<T>(curr);
}
using static Eina.TraitFunctions;
using static Eina.IteratorNativeFunctions;
-namespace Eina {
+namespace Eina
+{
public static class IteratorNativeFunctions
{
var h = Handle;
Handle = IntPtr.Zero;
if (h == IntPtr.Zero)
+ {
return;
+ }
if (OwnContent)
{
- for(IntPtr data; eina_iterator_next(h, out data);)
+ for (IntPtr data; eina_iterator_next(h, out data);)
{
NativeFree<T>(data);
}
}
if (Own)
+ {
eina_iterator_free(h);
+ }
}
public void Dispose()
res = NativeToManaged<T>(data);
if (OwnContent)
+ {
NativeFree<T>(data);
+ }
return true;
}
public IEnumerator<T> GetEnumerator()
{
- for(T curr; Next(out curr);)
+ for (T curr; Next(out curr);)
{
yield return curr;
}
using static Eina.ListNativeFunctions;
using Eina.Callbacks;
-namespace Eina {
+namespace Eina
+{
public static class ListNativeFunctions
{
IntPtr h = Handle;
Handle = IntPtr.Zero;
if (h == IntPtr.Zero)
+ {
return;
+ }
if (OwnContent)
{
- for(IntPtr curr = h; curr != IntPtr.Zero; curr = InternalNext(curr))
+ for (IntPtr curr = h; curr != IntPtr.Zero; curr = InternalNext(curr))
{
NativeFree<T>(InternalDataGet(curr));
}
}
if (Own)
+ {
eina_list_free(h);
+ }
}
public void Dispose()
public int Count()
{
- return (int) eina_list_count_custom_export_mono(Handle);
+ return (int)eina_list_count_custom_export_mono(Handle);
}
public void Append(T val)
{
IntPtr pos = eina_list_nth_list(Handle, (uint)idx);
if (pos == IntPtr.Zero)
+ {
throw new IndexOutOfRangeException();
+ }
+
if (OwnContent)
+ {
NativeFree<T>(InternalDataGet(pos));
+ }
+
IntPtr ele = ManagedToNativeAlloc(val);
InternalDataSet(pos, ele);
}
{
var managed = new T[Count()];
int i = 0;
- for(IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr), ++i)
+ for (IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr), ++i)
{
managed[i] = NativeToManaged<T>(InternalDataGet(curr));
}
+
return managed;
}
public void AppendArray(T[] values)
{
foreach (T v in values)
+ {
Append(v);
+ }
}
public IEnumerator<T> GetEnumerator()
{
- for(IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr))
+ for (IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr))
{
yield return NativeToManaged<T>(InternalDataGet(curr));
}
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
-namespace Eina { // Manual wrappers around eina functions
+namespace Eina
+{
+// Manual wrappers around eina functions
public class Log
{
static Log()
{
- const String name="mono";
- const String color="\033[32;1m";
+ const String name = "mono";
+ const String color = "\033[32;1m";
// Maybe move this check outside when other eina stuff get support?
domain = eina_log_domain_register(name, color);
if (domain < 0)
- Console.WriteLine("Error: Couldn't register Eina log domain for name {0}.", name);
+ {
+ Console.WriteLine("Error: Couldn't register Eina log domain for name {0}.", name);
+ }
else
- Info($"Registered mono domain with number {domain}");
+ {
+ Info($"Registered mono domain with number {domain}");
+ }
}
private static void EnsureDomainRegistered()
{
if (domain < 0)
- throw new InvalidOperationException("Log domain is not registered.");
+ {
+ throw new InvalidOperationException("Log domain is not registered.");
+ }
}
- public static void Critical(String message, [CallerLineNumber] int line=0, [CallerFilePath] string file=null, [CallerMemberName] string member = null)
+ public static void Critical(String message, [CallerLineNumber] int line = 0, [CallerFilePath] string file = null, [CallerMemberName] string member = null)
{
EnsureDomainRegistered();
eina_log_print(domain, Level.Critical, file, member, line, message);
}
- public static void Error(String message, [CallerLineNumber] int line=0, [CallerFilePath] string file=null, [CallerMemberName] string member = null)
+
+ public static void Error(String message, [CallerLineNumber] int line = 0, [CallerFilePath] string file = null, [CallerMemberName] string member = null)
{
EnsureDomainRegistered();
eina_log_print(domain, Level.Error, file, member, line, message);
}
- public static void Warning(String message, [CallerLineNumber] int line=0, [CallerFilePath] string file=null, [CallerMemberName] string member = null)
+
+ public static void Warning(String message, [CallerLineNumber] int line = 0, [CallerFilePath] string file = null, [CallerMemberName] string member = null)
{
EnsureDomainRegistered();
eina_log_print(domain, Level.Warning, file, member, line, message);
}
- public static void Info(String message, [CallerLineNumber] int line=0, [CallerFilePath] string file=null, [CallerMemberName] string member = null)
+
+ public static void Info(String message, [CallerLineNumber] int line = 0, [CallerFilePath] string file = null, [CallerMemberName] string member = null)
{
EnsureDomainRegistered();
eina_log_print(domain, Level.Info, file, member, line, message);
}
- public static void Debug(String message, [CallerLineNumber] int line=0, [CallerFilePath] string file=null, [CallerMemberName] string member = null)
+
+ public static void Debug(String message, [CallerLineNumber] int line = 0, [CallerFilePath] string file = null, [CallerMemberName] string member = null)
{
EnsureDomainRegistered();
eina_log_print(domain, Level.Debug, file, member, line, message);
return eina_log_level_get();
}
}
+
}
using static Eina.EinaNative.PromiseNativeMethods;
-namespace Eina {
+namespace Eina
+{
-namespace EinaNative {
+namespace EinaNative
+{
static internal class PromiseNativeMethods
{
/// Currently, creating a promise directly uses the Main Loop scheduler the source of notifications (i.e. the
/// future callbacks will be called mainly from a loop iteration).
/// </summary>
- public Promise(CancelCb cancelCb=null)
+ public Promise(CancelCb cancelCb = null)
{
Efl.Loop loop = Efl.App.AppMain;
IntPtr cb_data = IntPtr.Zero;
// A safety clean callback to mark this wrapper as invalid
- CancelCb safetyCb = () => {
+ CancelCb safetyCb = () =>
+ {
Handle = IntPtr.Zero;
if (cancelCb != null)
+ {
cancelCb();
+ }
};
CleanupHandle = GCHandle.Alloc(safetyCb);
private static void NativeCancelCb(IntPtr data, IntPtr dead)
{
if (data == IntPtr.Zero)
+ {
return;
+ }
GCHandle handle = GCHandle.FromIntPtr(data);
CancelCb cb = handle.Target as CancelCb;
if (cb != null)
+ {
cb();
+ }
else
+ {
Eina.Log.Info("Null promise CancelCb found");
+ }
+
handle.Free();
}
private void SanityChecks()
{
if (this.Handle == IntPtr.Zero)
+ {
throw new ObjectDisposedException(GetType().Name);
+ }
}
/// <summary>
/// </summary>
public Future(IntPtr handle)
{
- Handle = ThenRaw(handle, (Eina.Value value) => {
+ Handle = ThenRaw(handle, (Eina.Value value) =>
+ {
Handle = IntPtr.Zero;
return value;
});
/// Optionally a resolved callback may be provided. If so, it will be chained
/// before the returned future.
/// </summary>
- public Future(Promise promise, ResolvedCb cb=null)
+ public Future(Promise promise, ResolvedCb cb = null)
{
IntPtr intermediate = eina_future_new(promise.Handle);
- Handle = ThenRaw(intermediate, (Eina.Value value) => {
+ Handle = ThenRaw(intermediate, (Eina.Value value) =>
+ {
if (cb != null)
+ {
value = cb(value);
+ }
+
Handle = IntPtr.Zero;
return value;
});
private void SanityChecks()
{
if (this.Handle == IntPtr.Zero)
+ {
throw new ObjectDisposedException(GetType().Name);
+ }
}
/// <summary>
desc.data = GCHandle.ToIntPtr(handle);
return eina_future_then_from_desc(previous, desc);
}
+
private static Eina.ValueNative NativeResolvedCb(IntPtr data, Eina.ValueNative value, IntPtr dead_future)
{
GCHandle handle = GCHandle.FromIntPtr(data);
ResolvedCb cb = handle.Target as ResolvedCb;
if (cb != null)
+ {
value = cb(value);
+ }
else
+ {
Eina.Log.Warning("Failed to get future callback.");
+ }
+
handle.Free();
return value;
}
for (int j = 0; j <= i; j++)
{
if (descs[i].data == IntPtr.Zero)
+ {
continue;
+ }
GCHandle handle = GCHandle.FromIntPtr(descs[i].data);
handle.Free();
}
+
Eina.Log.Error($"Failed to create native future description for callbacks. Error: {e.ToString()}");
return null;
}
+
return new Future(eina_future_chain_array(Handle, descs));
}
}
{
Future f = managedObj as Future;
if (f == null)
+ {
return IntPtr.Zero;
+ }
+
return f.Handle;
}
///<summary>Not implemented. The code receiving the native data is in charge of releasing it.</summary>
///<param name="pNativeData">The native pointer to be released.</param>
- public void CleanUpNativeData(IntPtr pNativeData) { }
+ public void CleanUpNativeData(IntPtr pNativeData)
+ {
+ }
///<summary>Not implemented. The runtime takes care of releasing it.</summary>
///<param name="managedObj">The managed object to be cleaned.</param>
- public void CleanUpManagedData(object managedObj) { }
+ public void CleanUpManagedData(object managedObj)
+ {
+ }
///<summary>Size of the native data size returned</summary>
///<returns>The size of the data.</returns>
///<summary>Gets an instance of this marshaller.</summary>
///<param name="cookie">A name that could be used to customize the returned marshaller. Currently not used.</param>
///<returns>The <see cref="Eina.FutureMarshaler"/> instance that will marshall the data.</returns>
- public static ICustomMarshaler GetInstance(string cookie) {
+ public static ICustomMarshaler GetInstance(string cookie)
+ {
if (marshaler == null)
+ {
marshaler = new FutureMarshaler();
+ }
+
return marshaler;
}
using System;
using System.Runtime.InteropServices;
-namespace Eina {
+namespace Eina
+{
public interface ISliceBase
{
public int Length
{
- get { return (int) Len; }
- set { Len = (UIntPtr) value; }
+ get { return (int)Len; }
+ set { Len = (UIntPtr)value; }
}
public Slice(IntPtr mem, UIntPtr len)
public int Length
{
- get { return (int) Len; }
- set { Len = (UIntPtr) value; }
+ get { return (int)Len; }
+ set { Len = (UIntPtr)value; }
}
public RwSlice(IntPtr mem, UIntPtr len)
namespace Eina
{
+
namespace EinaNative
{
+
static internal class StrbufNativeMethods
{
[DllImport(efl.Libs.Eina)]
private bool Disposed;
///<summary>Creates a new Strbuf. By default its lifetime is managed.</summary>
- public Strbuf(Ownership ownership=Ownership.Managed)
+ public Strbuf(Ownership ownership = Ownership.Managed)
{
this.Handle = eina_strbuf_new();
this.Ownership = ownership;
return;
}
- if (!Disposed && (Handle != IntPtr.Zero)) {
+ if (!Disposed && (Handle != IntPtr.Zero))
+ {
eina_strbuf_free(Handle);
}
+
Disposed = true;
}
public void Reset()
{
if (Disposed)
+ {
throw new ObjectDisposedException(base.GetType().Name);
+ }
+
eina_strbuf_reset(Handle);
}
public bool Append(string text)
{
if (Disposed)
+ {
throw new ObjectDisposedException(base.GetType().Name);
+ }
+
return eina_strbuf_append(Handle, text);
}
public bool AppendEscaped(string text)
{
if (Disposed)
+ {
throw new ObjectDisposedException(base.GetType().Name);
+ }
+
return eina_strbuf_append_escaped(Handle, text);
}
public bool Append(char c)
{
if (Disposed)
+ {
throw new ObjectDisposedException(base.GetType().Name);
+ }
+
return eina_strbuf_append_char(Handle, c);
}
public string Steal()
{
if (Disposed)
+ {
throw new ObjectDisposedException(base.GetType().Name);
+ }
+
return eina_strbuf_string_steal(Handle);
}
}
} // namespace eina
-
using System.Runtime.InteropServices;
-namespace Eina {
+namespace Eina
+{
-public class Stringshare {
+public class Stringshare
+{
[DllImport(efl.Libs.Eina)] public static extern System.IntPtr
eina_stringshare_add_length(string str, System.UInt32 slen);
[DllImport(efl.Libs.Eina)] public static extern System.IntPtr
}
}
-
using static Eina.TraitFunctions;
-namespace Eina {
+namespace Eina
+{
-namespace EinaNative {
+namespace EinaNative
+{
// Structs to be passed from/to C when dealing with containers and
// optional values.
}
[SuppressUnmanagedCodeSecurityAttribute]
-static internal class UnsafeNativeMethods {
-
+static internal class UnsafeNativeMethods
+{
[DllImport(efl.Libs.Eina)]
internal static extern IntPtr eina_value_new(IntPtr type);
public class SetItemFailedException : Exception
{
/// <summary> Default constructor.</summary>
- public SetItemFailedException() : base () { }
+ public SetItemFailedException() : base()
+ {
+ }
+
/// <summary> Most commonly used contructor.</summary>
- public SetItemFailedException(string msg) : base(msg) { }
+ public SetItemFailedException(string msg) : base(msg)
+ {
+ }
+
/// <summary> Wraps an inner exception.</summary>
- public SetItemFailedException(string msg, Exception inner) : base(msg, inner) { }
+ public SetItemFailedException(string msg, Exception inner) : base(msg, inner)
+ {
+ }
+
/// <summary> Serializable constructor.</summary>
- protected SetItemFailedException(SerializationInfo info, StreamingContext context) : base(info, context) { }
+ protected SetItemFailedException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
}
/// <summary>Exception for methods that must have been called on a container.</summary>
public class InvalidValueTypeException: Exception
{
/// <summary> Default constructor.</summary>
- public InvalidValueTypeException() : base () { }
+ public InvalidValueTypeException() : base()
+ {
+ }
+
/// <summary> Most commonly used contructor.</summary>
- public InvalidValueTypeException(string msg) : base(msg) { }
+ public InvalidValueTypeException(string msg) : base(msg)
+ {
+ }
+
/// <summary> Wraps an inner exception.</summary>
- public InvalidValueTypeException(string msg, Exception inner) : base(msg, inner) { }
+ public InvalidValueTypeException(string msg, Exception inner) : base(msg, inner)
+ {
+ }
+
/// <summary> Serializable constructor.</summary>
- protected InvalidValueTypeException(SerializationInfo info, StreamingContext context) : base(info, context) { }
+ protected InvalidValueTypeException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
}
/// <summary>Managed-side Enum to represent Eina_Value_Type constants</summary>
-public enum ValueType {
+public enum ValueType
+{
/// <summary>Signed 8 bit integer. Same as 'sbyte'</summary>
SByte,
/// <summary>Unsigned 8 bit integer. Same as 'byte'</summary>
Empty,
}
-static class ValueTypeMethods {
+static class ValueTypeMethods
+{
public static bool IsNumeric(this ValueType val)
{
- switch (val) {
+ switch (val)
+ {
case ValueType.SByte:
case ValueType.Byte:
case ValueType.Short:
public static bool IsString(this ValueType val)
{
- switch(val) {
+ switch (val)
+ {
case ValueType.String:
return true;
default:
public static bool IsContainer(this ValueType val)
{
- switch(val) {
+ switch (val)
+ {
case ValueType.Array:
case ValueType.List:
case ValueType.Hash:
/// <summary>Returns the Marshal.SizeOf for the given ValueType native structure.</summary>
public static int MarshalSizeOf(this ValueType val)
{
- switch (val) {
+ switch (val)
+ {
case ValueType.Array:
return Marshal.SizeOf(typeof(EinaNative.Value_Array));
case ValueType.List:
}
}
}
+
static class ValueTypeBridge
{
private static Dictionary<ValueType, IntPtr> ManagedToNative = new Dictionary<ValueType, IntPtr>();
public static ValueType GetManaged(IntPtr native)
{
if (!TypesLoaded)
+ {
LoadTypes();
+ }
return NativeToManaged[native];
}
public static IntPtr GetNative(ValueType valueType)
{
if (!TypesLoaded)
+ {
LoadTypes();
+ }
return ManagedToNative[valueType];
}
internal IntPtr Handle { get; set;}
+
/// <summary> Whether this wrapper owns (can free) the native value. </summary>
public Ownership Ownership { get; protected set;}
+
private bool Disposed;
+
/// <summary> Whether this is an Optional value (meaning it can have a value or not). </summary>
- public bool Optional {
- get {
+ public bool Optional
+ {
+ get
+ {
return GetValueType() == Eina.ValueType.Optional;
}
+
/* protected set {
// Should we expose this?
// Something like {
// }
} */
}
+
/// <summary> Whether this wrapper is actually empty/uninitialized (zeroed). This is different from an empty optional value. </summary>
- public bool Empty {
- get {
+ public bool Empty
+ {
+ get
+ {
SanityChecks();
return GetValueType() == Eina.ValueType.Empty;
}
}
/// <summary> Whether this optional value is empty. </summary>
- public bool OptionalEmpty {
- get {
+ public bool OptionalEmpty
+ {
+ get
+ {
OptionalSanityChecks();
bool empty;
if (!eina_value_optional_empty_is_wrapper(this.Handle, out empty))
+ {
throw new System.InvalidOperationException("Couldn't get the empty information");
+ }
else
+ {
return empty;
+ }
}
}
}
// Constructor to be used by the "FromContainerDesc" methods.
- private Value() {
+ private Value()
+ {
this.Handle = Alloc();
this.Ownership = Ownership.Managed;
}
- public Value(IntPtr handle, Ownership ownership=Ownership.Managed) {
+ public Value(IntPtr handle, Ownership ownership = Ownership.Managed)
+ {
this.Handle = handle;
this.Ownership = ownership;
}
public Value(ValueType type)
{
if (type.IsContainer())
+ {
throw new ArgumentException("To use container types you must provide a subtype");
+ }
this.Handle = Alloc();
if (this.Handle == IntPtr.Zero)
+ {
throw new OutOfMemoryException("Failed to allocate memory for Eina.Value");
+ }
// Initialize to EINA_VALUE_EMPTY before performing any other operation on this value.
MemoryNative.Memset(this.Handle, 0, eina_value_sizeof());
}
/// <summary>Constructor for container values, like Array, Hash.</summary>
- public Value(ValueType containerType, ValueType subtype, uint step=0)
+ public Value(ValueType containerType, ValueType subtype, uint step = 0)
{
if (!containerType.IsContainer())
+ {
throw new ArgumentException("First type must be a container type.");
+ }
this.Handle = Alloc();
this.Ownership = Ownership.Managed;
{
Handle = Alloc();
if (!eina_value_copy(v.Handle, this.Handle))
+ {
throw new System.InvalidOperationException("Failed to copy value to managed memory.");
+ }
Disposed = false;
Ownership = Ownership.Managed;
public Value(ValueNative value)
{
IntPtr tmp = IntPtr.Zero;
- try {
+ try
+ {
this.Handle = Alloc();
if (value.Type == IntPtr.Zero) // Got an EINA_VALUE_EMPTY by value.
+ {
MemoryNative.Memset(this.Handle, 0, Marshal.SizeOf(typeof(ValueNative)));
+ }
else
{
// We allocate this intermediate ValueNative using malloc to allow freeing with
// Copy is used to deep copy the pointed payload (e.g. strings) inside this struct, so we can own this value.
if (!eina_value_copy(tmp, this.Handle))
+ {
throw new System.InvalidOperationException("Failed to copy value to managed memory.");
+ }
}
- } catch {
+ }
+ catch
+ {
Free(this.Handle);
throw;
- } finally {
+ }
+ finally
+ {
if (tmp != IntPtr.Zero)
+ {
MemoryNative.Free(tmp);
+ }
}
this.Ownership = Ownership.Managed;
public Value(byte x) : this(ValueType.Byte)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Type-specific constructor, for convenience.</summary>
public Value(sbyte x) : this(ValueType.SByte)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Type-specific constructor, for convenience.</summary>
public Value(short x) : this(ValueType.Short)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Type-specific constructor, for convenience.</summary>
public Value(ushort x) : this(ValueType.UShort)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Type-specific constructor, for convenience.</summary>
public Value(int x) : this(ValueType.Int32)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Type-specific constructor, for convenience.</summary>
public Value(uint x) : this(ValueType.UInt32)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Type-specific constructor, for convenience.</summary>
public Value(long x) : this(ValueType.Long)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Type-specific constructor, for convenience.</summary>
public Value(ulong x) : this(ValueType.ULong)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Type-specific constructor, for convenience.</summary>
public Value(float x) : this(ValueType.Float)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Type-specific constructor, for convenience.</summary>
public Value(double x) : this(ValueType.Double)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Type-specific constructor, for convenience.</summary>
public Value(string x) : this(ValueType.String)
{
if (!Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
}
/// <summary>Implicit conversion from managed value to native struct representation.</summary>
{
var v = new Eina.Value(ValueType.Byte);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
byte b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
{
var v = new Eina.Value(ValueType.SByte);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
sbyte b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
{
var v = new Eina.Value(ValueType.Short);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
short b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
{
var v = new Eina.Value(ValueType.UShort);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
ushort b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
{
var v = new Eina.Value(ValueType.Int32);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
int b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
{
var v = new Eina.Value(ValueType.UInt32);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
uint b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
{
var v = new Eina.Value(ValueType.Long);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
long b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
{
var v = new Eina.Value(ValueType.ULong);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
ulong b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
{
var v = new Eina.Value(ValueType.Float);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
float b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
{
var v = new Eina.Value(ValueType.Double);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
double b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
{
var v = new Eina.Value(ValueType.String);
if (!v.Set(x))
+ {
throw new InvalidOperationException("Couldn't set value.");
+ }
+
return v;
}
{
string b;
if (!v.Get(out b))
+ {
throw new InvalidOperationException("Couldn't get value.");
+ }
+
return b;
}
/// <summary>Actually free the wrapped eina value. Can be called from Dispose() or through the GC.</summary>
protected virtual void Dispose(bool disposing)
{
- if (this.Ownership == Ownership.Unmanaged) {
+ if (this.Ownership == Ownership.Unmanaged)
+ {
Disposed = true;
return;
}
- if (!Disposed && (Handle != IntPtr.Zero)) {
+ if (!Disposed && (Handle != IntPtr.Zero))
+ {
// No need to call flush as eina_value_free already calls it for us.
Free(this.Handle);
}
+
Disposed = true;
}
}
/// <summary>Returns the native handle wrapped by this object.</summary>
- public IntPtr NativeHandle {
- get {
+ public IntPtr NativeHandle
+ {
+ get
+ {
if (Disposed)
+ {
throw new ObjectDisposedException(base.GetType().Name);
+ }
+
return this.Handle;
}
}
public bool Setup(ValueType type)
{
if (Disposed)
+ {
throw new ObjectDisposedException(base.GetType().Name);
+ }
// Can't call setup with Empty value type (would give an eina error)
if (type == Eina.ValueType.Empty)
{
// Need to cleanup as it may point to payload outside the underlying Eina_Value (like arrays and strings).
if (!Empty)
+ {
eina_value_flush_wrapper(this.Handle);
+ }
MemoryNative.Memset(this.Handle, 0, eina_value_sizeof());
}
if (type.IsContainer())
+ {
throw new ArgumentException("To setup a container you must provide a subtype.");
+ }
return eina_value_setup_wrapper(this.Handle, ValueTypeBridge.GetNative(type));
}
- public bool Setup(ValueType containerType, ValueType subtype, uint step=0) {
+ public bool Setup(ValueType containerType, ValueType subtype, uint step = 0)
+ {
IntPtr native_subtype = ValueTypeBridge.GetNative(subtype);
bool ret = false;
- switch (containerType) {
+ switch (containerType)
+ {
case ValueType.Array:
ret = eina_value_array_setup_wrapper(this.Handle, native_subtype, step);
break;
private void SanityChecks()
{
if (Disposed)
+ {
throw new ObjectDisposedException(GetType().Name);
+ }
}
- private void ContainerSanityChecks(int targetIndex=-1)
+ private void ContainerSanityChecks(int targetIndex = -1)
{
SanityChecks();
uint size = 0;
ValueType type = GetValueType();
if (!type.IsContainer())
+ {
throw new InvalidValueTypeException("Value type must be a container");
+ }
if (targetIndex == -1) // Some methods (e.g. append) don't care about size
+ {
return;
+ }
- switch (type) {
+ switch (type)
+ {
case ValueType.Array:
size = eina_value_array_count_wrapper(this.Handle);
break;
}
if (targetIndex >= size)
+ {
throw new System.ArgumentOutOfRangeException(
$"Index {targetIndex} is larger than max array index {size-1}");
+ }
}
private void OptionalSanityChecks()
ValueType type = GetValueType();
if (!type.IsOptional())
+ {
throw new InvalidValueTypeException("Value is not an Optional one");
+ }
}
/// <summary>Get a ValueNative struct with the *value* pointed by this Eina.Value.</summary>
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.Byte),
ref value);
+ }
if (!GetValueType().IsNumeric())
+ {
throw (new ArgumentException(
"Trying to set numeric value on a non-numeric Eina.Value"));
+ }
+
return eina_value_set_wrapper_uchar(this.Handle, value);
}
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.SByte),
ref value);
+ }
if (!GetValueType().IsNumeric())
+ {
throw (new ArgumentException(
"Trying to set numeric value on a non-numeric Eina.Value"));
+ }
+
return eina_value_set_wrapper_char(this.Handle, value);
}
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.Short),
ref value);
+ }
if (!GetValueType().IsNumeric())
+ {
throw (new ArgumentException(
"Trying to set numeric value on a non-numeric Eina.Value"));
+ }
+
return eina_value_set_wrapper_short(this.Handle, value);
}
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.UShort),
ref value);
+ }
if (!GetValueType().IsNumeric())
+ {
throw (new ArgumentException(
"Trying to set numeric value on a non-numeric Eina.Value"));
+ }
+
return eina_value_set_wrapper_ushort(this.Handle, value);
}
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.UInt32),
ref value);
+ }
if (!GetValueType().IsNumeric())
+ {
throw (new ArgumentException(
"Trying to set numeric value on a non-numeric Eina.Value"));
+ }
+
return eina_value_set_wrapper_uint(this.Handle, value);
}
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.Int32),
ref value);
+ }
if (!GetValueType().IsNumeric())
+ {
throw (new ArgumentException(
"Trying to set numeric value on a non-numeric Eina.Value"));
+ }
+
return eina_value_set_wrapper_int(this.Handle, value);
}
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.ULong),
ref value);
+ }
if (!GetValueType().IsNumeric())
+ {
throw (new ArgumentException(
"Trying to set numeric value on a non-numeric Eina.Value"));
+ }
+
return eina_value_set_wrapper_ulong(this.Handle, value);
}
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.Long),
ref value);
+ }
if (!GetValueType().IsNumeric())
+ {
throw (new ArgumentException(
"Trying to set numeric value on a non-numeric Eina.Value"));
+ }
+
return eina_value_set_wrapper_long(this.Handle, value);
}
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.Float),
ref value);
+ }
if (!GetValueType().IsNumeric())
+ {
throw (new ArgumentException(
"Trying to set numeric value on a non-numeric Eina.Value"));
+ }
return eina_value_set_wrapper_float(this.Handle, value);
}
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.Double),
ref value);
+ }
if (!GetValueType().IsNumeric())
+ {
throw (new ArgumentException(
"Trying to set numeric value on a non-numeric Eina.Value"));
+ }
+
return eina_value_set_wrapper_double(this.Handle, value);
}
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.String),
ref value);
+ }
if (!GetValueType().IsString())
+ {
throw (new ArgumentException(
"Trying to set non-string value on a string Eina.Value"));
+ }
+
// No need to worry about ownership as eina_value_set will copy the passed string.
return eina_value_set_wrapper_string(this.Handle, value);
}
int error_code = value;
if (this.Optional)
+ {
return eina_value_optional_pset(this.Handle,
ValueTypeBridge.GetNative(ValueType.Error),
ref error_code);
+ }
return eina_value_set_wrapper_int(this.Handle, error_code);
}
IntPtr ptr_val = MemoryNative.Alloc(subtype.MarshalSizeOf());
IntPtr native_type = ValueTypeBridge.GetNative(subtype);
- try {
- switch (subtype) {
+ try
+ {
+ switch (subtype)
+ {
// PSet on Container types require an Eina_Value_<Container>, which is the structure
// that contains subtype, etc.
case ValueType.Array:
EinaNative.Value_Array value_array;
if (!eina_value_get_wrapper(value.Handle, out value_array))
+ {
return false;
+ }
+
Marshal.StructureToPtr(value_array, ptr_val, false);
break;
case ValueType.List:
EinaNative.Value_List value_list;
if (!eina_value_get_wrapper(value.Handle, out value_list))
+ {
return false;
+ }
+
Marshal.StructureToPtr(value_list, ptr_val, false);
break;
default:
}
return eina_value_optional_pset(this.Handle, native_type, ptr_val);
- } finally {
+ }
+ finally
+ {
MemoryNative.Free(ptr_val);
}
}
{
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pget(this.Handle, out value);
+ }
else
+ {
return eina_value_get_wrapper(this.Handle, out value);
+ }
}
/// <summary>Gets the currently stored value as a sbyte.</summary>
{
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pget(this.Handle, out value);
+ }
else
+ {
return eina_value_get_wrapper(this.Handle, out value);
+ }
}
/// <summary>Gets the currently stored value as a short.</summary>
{
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pget(this.Handle, out value);
+ }
else
+ {
return eina_value_get_wrapper(this.Handle, out value);
+ }
}
/// <summary>Gets the currently stored value as an ushort.</summary>
{
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pget(this.Handle, out value);
+ }
else
+ {
return eina_value_get_wrapper(this.Handle, out value);
+ }
}
/// <summary>Gets the currently stored value as an int.</summary>
{
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pget(this.Handle, out value);
+ }
else
+ {
return eina_value_get_wrapper(this.Handle, out value);
+ }
}
/// <summary>Gets the currently stored value as an uint.</summary>
{
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pget(this.Handle, out value);
+ }
else
+ {
return eina_value_get_wrapper(this.Handle, out value);
+ }
}
/// <summary>Gets the currently stored value as a long.</summary>
{
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pget(this.Handle, out value);
+ }
else
+ {
return eina_value_get_wrapper(this.Handle, out value);
+ }
}
/// <summary>Gets the currently stored value as an ulong.</summary>
{
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pget(this.Handle, out value);
+ }
else
+ {
return eina_value_get_wrapper(this.Handle, out value);
+ }
}
/// <summary>Gets the currently stored value as a float.</summary>
{
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pget(this.Handle, out value);
+ }
else
+ {
return eina_value_get_wrapper(this.Handle, out value);
+ }
}
/// <summary>Gets the currently stored value as a double.</summary>
{
SanityChecks();
if (this.Optional)
+ {
return eina_value_optional_pget(this.Handle, out value);
+ }
else
+ {
return eina_value_get_wrapper(this.Handle, out value);
+ }
}
/// <summary>Gets the currently stored value as a string.</summary>
{
SanityChecks();
IntPtr output = IntPtr.Zero;
- if (this.Optional) {
- if (!eina_value_optional_pget(this.Handle, out output)) {
+ if (this.Optional)
+ {
+ if (!eina_value_optional_pget(this.Handle, out output))
+ {
value = String.Empty;
return false;
}
- } else if (!eina_value_get_wrapper(this.Handle, out output)) {
+ }
+ else if (!eina_value_get_wrapper(this.Handle, out output))
+ {
value = String.Empty;
return false;
}
+
value = StringConversion.NativeUtf8ToManagedString(output);
return true;
}
bool ret;
int intermediate; // It seems out doesn't play well with implicit operators...
if (this.Optional)
+ {
ret = eina_value_optional_pget(this.Handle, out intermediate);
+ }
else
+ {
ret = eina_value_get_wrapper(this.Handle, out intermediate);
+ }
value = intermediate;
value = null;
if (!this.Optional)
+ {
throw new InvalidValueTypeException("Values can only be retreived");
+ }
IntPtr nativeType = eina_value_optional_type_get_wrapper(this.Handle);
ValueType managedType = ValueTypeBridge.GetManaged(nativeType);
- switch (managedType) {
+ switch (managedType)
+ {
case ValueType.Array:
Eina.EinaNative.Value_Array array_desc;
if (!eina_value_optional_pget(this.Handle, out array_desc))
+ {
return false;
+ }
+
value = Value.FromArrayDesc(array_desc);
break;
case ValueType.List:
Eina.EinaNative.Value_List list_desc;
if (!eina_value_optional_pget(this.Handle, out list_desc))
+ {
return false;
+ }
+
value = Value.FromListDesc(list_desc);
break;
}
public ValueType GetValueType()
{
if (Disposed)
+ {
throw new ObjectDisposedException(base.GetType().Name);
+ }
+
IntPtr native_type = eina_value_type_get_wrapper(this.Handle);
return ValueTypeBridge.GetManaged(native_type);
}
public bool ConvertTo(Value target)
{
if (target == null)
+ {
return false;
+ }
SanityChecks();
public int CompareTo(Value other)
{
if (other == null)
+ {
return 1;
+ }
+
SanityChecks();
other.SanityChecks();
return eina_value_compare_wrapper(this.Handle, other.Handle);
public override bool Equals(object obj)
{
if (obj == null)
+ {
return false;
+ }
Value v = obj as Value;
if (v == null)
+ {
return false;
+ }
return this.Equals(v);
}
public bool Equals(Value other)
{
- try {
+ try
+ {
return this.CompareTo(other) == 0;
- } catch (ObjectDisposedException) {
+ }
+ catch (ObjectDisposedException)
+ {
return false;
}
}
public static bool operator==(Value x, Value y)
{
if (object.ReferenceEquals(x, null))
+ {
return object.ReferenceEquals(y, null);
+ }
return x.Equals(y);
}
public static bool operator!=(Value x, Value y)
{
if (object.ReferenceEquals(x, null))
+ {
return !object.ReferenceEquals(y, null);
+ }
+
return !x.Equals(y);
}
public static bool operator>(Value x, Value y)
{
if (object.ReferenceEquals(x, null) || object.ReferenceEquals(y, null))
+ {
return false;
+ }
+
return x.CompareTo(y) > 0;
}
public static bool operator<(Value x, Value y)
{
if (object.ReferenceEquals(x, null) || object.ReferenceEquals(y, null))
+ {
return false;
+ }
+
return x.CompareTo(y) < 0;
}
}
// Container methods methods
- public int Count() {
+ public int Count()
+ {
ContainerSanityChecks();
- switch(GetValueType()) {
+ switch (GetValueType())
+ {
case ValueType.Array:
return (int)eina_value_array_count_wrapper(this.Handle);
case ValueType.List:
return (int)eina_value_list_count_wrapper(this.Handle);
}
+
return -1;
}
- public bool Append(object o) {
+
+ public bool Append(object o)
+ {
ContainerSanityChecks();
- switch (GetValueSubType()) {
+ switch (GetValueSubType())
+ {
case ValueType.SByte:
{
sbyte b = Convert.ToSByte(o);
return eina_value_container_append_wrapper_char(this.Handle, b);
}
+
case ValueType.Byte:
{
byte b = Convert.ToByte(o);
short b = Convert.ToInt16(o);
return eina_value_container_append_wrapper_short(this.Handle, b);
}
+
case ValueType.UShort:
{
ushort b = Convert.ToUInt16(o);
int x = Convert.ToInt32(o);
return eina_value_container_append_wrapper_int(this.Handle, x);
}
+
case ValueType.UInt32:
{
uint x = Convert.ToUInt32(o);
long x = Convert.ToInt64(o);
return eina_value_container_append_wrapper_long(this.Handle, x);
}
+
case ValueType.ULong:
case ValueType.UInt64:
{
float x = Convert.ToSingle(o);
return eina_value_container_append_wrapper_float(this.Handle, x);
}
+
case ValueType.Double:
{
double x = Convert.ToDouble(o);
return eina_value_container_append_wrapper_string(this.Handle, x);
}
}
+
return false;
}
public object this[int i]
{
- get {
+ get
+ {
ContainerSanityChecks(i);
- switch (GetValueSubType()) {
+ switch (GetValueSubType())
+ {
case ValueType.SByte:
{
sbyte ret = default(sbyte);
eina_value_container_get_wrapper(this.Handle, i, out ret);
return ret;
}
+
case ValueType.Byte:
{
byte ret = default(byte);
eina_value_container_get_wrapper(this.Handle, i, out ret);
return ret;
}
+
case ValueType.UShort:
{
ushort ret = default(ushort);
eina_value_container_get_wrapper(this.Handle, i, out ret);
return ret;
}
+
case ValueType.UInt32:
{
uint ret = default(uint);
eina_value_container_get_wrapper(this.Handle, i, out ret);
return ret;
}
+
case ValueType.ULong:
case ValueType.UInt64:
{
eina_value_container_get_wrapper(this.Handle, i, out ret);
return ret;
}
+
case ValueType.Double:
{
double ret = default(double);
eina_value_container_get_wrapper(this.Handle, i, out ptr);
return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
}
+
default:
throw new InvalidOperationException("Subtype not supported.");
}
}
- set {
+ set
+ {
ContainerSanityChecks(i);
- switch (GetValueSubType()) {
+ switch (GetValueSubType())
+ {
case ValueType.SByte:
{
sbyte v = Convert.ToSByte(value);
eina_value_container_set_wrapper_char(this.Handle, i, v);
+ break;
}
- break;
+
case ValueType.Byte:
{
byte v = Convert.ToByte(value);
eina_value_container_set_wrapper_uchar(this.Handle, i, v);
+ break;
}
- break;
case ValueType.Short:
{
short x = Convert.ToInt16(value);
eina_value_container_set_wrapper_short(this.Handle, i, x);
+ break;
}
- break;
+
case ValueType.UShort:
{
ushort x = Convert.ToUInt16(value);
eina_value_container_set_wrapper_ushort(this.Handle, i, x);
+ break;
}
- break;
case ValueType.Int32:
{
int x = Convert.ToInt32(value);
eina_value_container_set_wrapper_int(this.Handle, i, x);
+ break;
}
- break;
+
case ValueType.UInt32:
{
uint x = Convert.ToUInt32(value);
eina_value_container_set_wrapper_uint(this.Handle, i, x);
+ break;
}
- break;
case ValueType.Long:
case ValueType.Int64:
{
long x = Convert.ToInt64(value);
eina_value_container_set_wrapper_long(this.Handle, i, x);
+ break;
}
- break;
+
case ValueType.ULong:
case ValueType.UInt64:
{
ulong x = Convert.ToUInt64(value);
eina_value_container_set_wrapper_ulong(this.Handle, i, x);
+ break;
}
- break;
case ValueType.Float:
{
float x = Convert.ToSingle(value);
eina_value_container_set_wrapper_float(this.Handle, i, x);
+ break;
}
- break;
+
case ValueType.Double:
{
double x = Convert.ToDouble(value);
eina_value_container_set_wrapper_double(this.Handle, i, x);
+ break;
}
- break;
case ValueType.String:
{
string x = Convert.ToString(value);
eina_value_container_set_wrapper_string(this.Handle, i, x);
+ break;
}
- break;
}
}
}
IntPtr native_subtype = IntPtr.Zero;
- switch (GetValueType()) {
+ switch (GetValueType())
+ {
case ValueType.Array:
native_subtype = eina_value_array_subtype_get_wrapper(this.Handle);
break;
native_subtype = eina_value_list_subtype_get_wrapper(this.Handle);
break;
}
+
return ValueTypeBridge.GetManaged(native_subtype);
}
}
/// <summary> Custom marshaler to convert value pointers to managed values and back,
/// without changing ownership.</summary>
-public class ValueMarshaler : ICustomMarshaler {
-
+public class ValueMarshaler : ICustomMarshaler
+{
/// <summary>Creates a managed value from a C pointer, whitout taking ownership of it.</summary>
- public object MarshalNativeToManaged(IntPtr pNativeData) {
+ public object MarshalNativeToManaged(IntPtr pNativeData)
+ {
return new Value(pNativeData, Ownership.Unmanaged);
}
/// <summary>Retrieves the C pointer from a given managed value,
/// keeping the managed ownership.</summary>
- public IntPtr MarshalManagedToNative(object managedObj) {
- try {
+ public IntPtr MarshalManagedToNative(object managedObj)
+ {
+ try
+ {
Value v = (Value)managedObj;
return v.Handle;
- } catch (InvalidCastException) {
+ }
+ catch (InvalidCastException)
+ {
return IntPtr.Zero;
}
}
- public void CleanUpNativeData(IntPtr pNativeData) {
+ public void CleanUpNativeData(IntPtr pNativeData)
+ {
}
- public void CleanUpManagedData(object managedObj) {
+ public void CleanUpManagedData(object managedObj)
+ {
}
- public int GetNativeDataSize() {
+ public int GetNativeDataSize()
+ {
return -1;
}
- public static ICustomMarshaler GetInstance(string cookie) {
- if (marshaler == null) {
+ public static ICustomMarshaler GetInstance(string cookie)
+ {
+ if (marshaler == null)
+ {
marshaler = new ValueMarshaler();
}
+
return marshaler;
}
+
static private ValueMarshaler marshaler;
}
/// <summary> Custom marshaler to convert value pointers to managed values and back,
/// also transferring the ownership to the other side.</summary>
-public class ValueMarshalerOwn : ICustomMarshaler {
+public class ValueMarshalerOwn : ICustomMarshaler
+{
/// <summary>Creates a managed value from a C pointer, taking the ownership.</summary>
- public object MarshalNativeToManaged(IntPtr pNativeData) {
+ public object MarshalNativeToManaged(IntPtr pNativeData)
+ {
return new Value(pNativeData, Ownership.Managed);
}
/// <summary>Retrieves the C pointer from a given managed value,
/// transferring the ownership to the unmanaged side, which should release it
/// when not needed. </summary>
- public IntPtr MarshalManagedToNative(object managedObj) {
- try {
+ public IntPtr MarshalManagedToNative(object managedObj)
+ {
+ try
+ {
Value v = (Value)managedObj;
v.ReleaseOwnership();
return v.Handle;
- } catch (InvalidCastException) {
+ }
+ catch (InvalidCastException)
+ {
return IntPtr.Zero;
}
}
- public void CleanUpNativeData(IntPtr pNativeData) {
+ public void CleanUpNativeData(IntPtr pNativeData)
+ {
}
- public void CleanUpManagedData(object managedObj) {
+ public void CleanUpManagedData(object managedObj)
+ {
}
- public int GetNativeDataSize() {
+ public int GetNativeDataSize()
+ {
return -1;
}
- public static ICustomMarshaler GetInstance(string cookie) {
- if (marshaler == null) {
+ public static ICustomMarshaler GetInstance(string cookie)
+ {
+ if (marshaler == null)
+ {
marshaler = new ValueMarshalerOwn();
}
+
return marshaler;
}
+
static private ValueMarshalerOwn marshaler;
}
+
}
using static eldbus.EldbusMessageNativeFunctions;
-namespace eldbus {
+namespace eldbus
+{
public static class Timeout
{
{
return new ObjectPath(str);
}
+
public static implicit operator string(ObjectPath path)
{
return path.value;
{
return new SignatureString(str);
}
+
public static implicit operator string(SignatureString sig)
{
return sig.value;
{
return new UnixFd(fd);
}
+
public static implicit operator Int32(UnixFd unix_fd)
{
return unix_fd.value;
public static class Argument
{
- public class ByteType { public const char Code = 'y'; public const string Signature = "y"; }
- public class BooleanType { public const char Code = 'b'; public const string Signature = "b"; }
- public class Int16Type { public const char Code = 'n'; public const string Signature = "n"; }
- public class UInt16Type { public const char Code = 'q'; public const string Signature = "q"; }
- public class Int32Type { public const char Code = 'i'; public const string Signature = "i"; }
- public class UInt32Type { public const char Code = 'u'; public const string Signature = "u"; }
- public class Int64Type { public const char Code = 'x'; public const string Signature = "x"; }
- public class UInt64Type { public const char Code = 't'; public const string Signature = "t"; }
- public class DoubleType { public const char Code = 'd'; public const string Signature = "d"; }
- public class StringType { public const char Code = 's'; public const string Signature = "s"; }
- public class ObjectPathType { public const char Code = 'o'; public const string Signature = "o"; }
- public class SignatureType { public const char Code = 'g'; public const string Signature = "g"; }
- public class ArrayType { public const char Code = 'a'; public const string Signature = "a"; }
- public class StructType { public const char Code = 'r'; public const string Signature = "r"; }
- public class VariantType { public const char Code = 'v'; public const string Signature = "v"; }
- public class DictEntryType { public const char Code = 'e'; public const string Signature = "e"; }
- public class UnixFdType { public const char Code = 'h'; public const string Signature = "h"; }
+ public class ByteType
+ {
+ public const char Code = 'y';
+ public const string Signature = "y";
+ }
+
+ public class BooleanType
+ {
+ public const char Code = 'b';
+ public const string Signature = "b";
+ }
+
+ public class Int16Type
+ {
+ public const char Code = 'n';
+ public const string Signature = "n";
+ }
+
+ public class UInt16Type
+ {
+ public const char Code = 'q';
+ public const string Signature = "q";
+ }
+
+ public class Int32Type
+ {
+ public const char Code = 'i';
+ public const string Signature = "i";
+ }
+
+ public class UInt32Type
+ {
+ public const char Code = 'u';
+ public const string Signature = "u";
+ }
+
+ public class Int64Type
+ {
+ public const char Code = 'x';
+ public const string Signature = "x";
+ }
+
+ public class UInt64Type
+ {
+ public const char Code = 't';
+ public const string Signature = "t";
+ }
+
+ public class DoubleType
+ {
+ public const char Code = 'd';
+ public const string Signature = "d";
+ }
+
+ public class StringType
+ {
+ public const char Code = 's';
+ public const string Signature = "s";
+ }
+
+ public class ObjectPathType
+ {
+ public const char Code = 'o';
+ public const string Signature = "o";
+ }
+
+ public class SignatureType
+ {
+ public const char Code = 'g';
+ public const string Signature = "g";
+ }
+
+ public class ArrayType
+ {
+ public const char Code = 'a';
+ public const string Signature = "a";
+ }
+
+ public class StructType
+ {
+ public const char Code = 'r';
+ public const string Signature = "r";
+ }
+
+ public class VariantType
+ {
+ public const char Code = 'v';
+ public const string Signature = "v";
+ }
+
+ public class DictEntryType
+ {
+ public const char Code = 'e';
+ public const string Signature = "e";
+ }
+
+ public class UnixFdType
+ {
+ public const char Code = 'h';
+ public const string Signature = "h";
+ }
// public static readonly ByteType ByteT = new ByteType();
// public static readonly BooleanType BooleanT = new BooleanType();
public void AppendTo(eldbus.Message msg)
{
if (!InternalAppendTo(msg))
+ {
throw new SEHException("Eldbus: could not append basic type to eldbus.Message");
+ }
}
public void AppendTo(eldbus.MessageIterator iter)
{
if (!InternalAppendTo(iter))
+ {
throw new SEHException("Eldbus: could not append basic type to eldbus.MessageIterator");
+ }
}
public abstract char TypeCode {get;}
value = arg;
}
- public override char TypeCode { get { return Argument.ByteType.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.ByteType.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
protected override bool InternalAppendTo(eldbus.Message msg)
{
value = Convert.ToInt32(arg);
}
- public override char TypeCode { get { return Argument.BooleanType.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.BooleanType.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
protected override bool InternalAppendTo(eldbus.Message msg)
{
value = arg;
}
- public override char TypeCode { get { return Argument.Int16Type.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.Int16Type.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
protected override bool InternalAppendTo(eldbus.Message msg)
{
value = arg;
}
- public override char TypeCode { get { return Argument.UInt16Type.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.UInt16Type.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
protected override bool InternalAppendTo(eldbus.Message msg)
{
value = arg;
}
- public override char TypeCode { get { return Argument.Int32Type.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.Int32Type.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
protected override bool InternalAppendTo(eldbus.Message msg)
{
value = arg;
}
- public override char TypeCode { get { return Argument.UInt32Type.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.UInt32Type.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
protected override bool InternalAppendTo(eldbus.Message msg)
{
value = arg;
}
- public override char TypeCode { get { return Argument.Int64Type.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.Int64Type.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
protected override bool InternalAppendTo(eldbus.Message msg)
{
value = arg;
}
- public override char TypeCode { get { return Argument.UInt64Type.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.UInt64Type.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
protected override bool InternalAppendTo(eldbus.Message msg)
{
value = arg;
}
- public override char TypeCode { get { return Argument.DoubleType.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.DoubleType.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
protected override bool InternalAppendTo(eldbus.Message msg)
{
public class StringMessageArgument : StringLikeMessageArgument
{
- public StringMessageArgument(string arg)
- : base(arg)
- {}
+ public StringMessageArgument(string arg) : base(arg)
+ {
+ }
+
+ public override char TypeCode
+ {
+ get { return Argument.StringType.Code; }
+ }
- public override char TypeCode { get { return Argument.StringType.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
}
public class ObjectPathMessageArgument : StringLikeMessageArgument
{
- public ObjectPathMessageArgument(ObjectPath arg)
- : base(arg.value)
- {}
+ public ObjectPathMessageArgument(ObjectPath arg) : base(arg.value)
+ {
+ }
- public override char TypeCode { get { return Argument.ObjectPathType.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.ObjectPathType.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
}
public class SignatureMessageArgument : StringLikeMessageArgument
{
- public SignatureMessageArgument(SignatureString arg)
- : base(arg.value)
- {}
+ public SignatureMessageArgument(SignatureString arg) : base(arg.value)
+ {
+ }
+
+ public override char TypeCode
+ {
+ get { return Argument.SignatureType.Code; }
+ }
- public override char TypeCode { get { return Argument.SignatureType.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
}
public class UnixFdMessageArgument : BasicMessageArgument
value = arg.value;
}
- public override char TypeCode { get { return Argument.UnixFdType.Code; } }
- public override string Signature { get { return Argument.ByteType.Signature; } }
+ public override char TypeCode
+ {
+ get { return Argument.UnixFdType.Code; }
+ }
+
+ public override string Signature
+ {
+ get { return Argument.ByteType.Signature; }
+ }
protected override bool InternalAppendTo(eldbus.Message msg)
{
public static void RaiseNullHandle()
{
if (NullHandleError == 0)
+ {
NullHandleError = Eina.Error.Register("Eldbus: null handle");
+ }
+
Eina.Error.Raise(NullHandleError);
}
public static Eldbus_Message_Cb GetMessageCbWrapper()
{
if (message_cb_wrapper == null)
+ {
message_cb_wrapper = new Eldbus_Message_Cb(MessageCbWrapper);
+ }
+
return message_cb_wrapper;
}
msg = new eldbus.Message(msg_hdl, false);
pending = new eldbus.Pending(pending_hdl, false);
}
- catch(Exception e)
+ catch (Exception e)
{
Eina.Log.Error("Eldbus: could not convert Eldbus_Message_Cb parameters. Exception: " + e.ToString());
return;
{
dlgt(msg, pending);
}
- catch(Exception e)
+ catch (Exception e)
{
Eina.Log.Error("Eldbus: Eldbus_Message_Cb delegate error. Exception: " + e.ToString());
}
}
}
-
-
using System;
using System.Runtime.InteropServices;
-namespace eldbus {
+namespace eldbus
+{
public static class Config
{
public static void Init()
{
if (eldbus_init() == 0)
+ {
throw new Efl.EflException("Failed to initialize Eldbus");
+ }
}
public static void Shutdown()
using static eldbus.EldbusConnectionNativeFunctions;
-namespace eldbus {
-
+namespace eldbus
+{
public static class EldbusConnectionNativeFunctions
{
IntPtr h = Handle;
Handle = IntPtr.Zero;
if (h == IntPtr.Zero)
+ {
return;
+ }
if (Own)
+ {
eldbus_connection_unref(h);
+ }
}
public void Dispose()
CheckHandle();
if (msg == null)
+ {
throw new ArgumentNullException("msg");
+ }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
IntPtr cb_data = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt));
var pending_hdl = eldbus_connection_send(Handle, msg.Handle, cb_wrapper, cb_data, timeout);
- if(pending_hdl == IntPtr.Zero)
+ if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_connection_send");
+ }
msg.Ref();
CheckHandle();
var ptr = eldbus_connection_unique_name_get(Handle);
if (ptr == IntPtr.Zero)
+ {
return null;
+ }
+
return Eina.StringConversion.NativeUtf8ToManagedString(ptr);
}
CheckHandle();
if (bus == null)
+ {
throw new ArgumentNullException("bus");
+ }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
IntPtr cb_data = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt));
var pending_hdl = eldbus_name_request(Handle, bus, flags, cb_wrapper, cb_data);
- if(pending_hdl == IntPtr.Zero)
+ if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_name_request");
+ }
return new eldbus.Pending(pending_hdl, false);
}
CheckHandle();
if (bus == null)
+ {
throw new ArgumentNullException("bus");
+ }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
IntPtr cb_data = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt));
var pending_hdl = eldbus_name_release(Handle, bus, cb_wrapper, cb_data);
- if(pending_hdl == IntPtr.Zero)
+ if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_name_release");
+ }
return new eldbus.Pending(pending_hdl, false);
}
CheckHandle();
if (bus == null)
+ {
throw new ArgumentNullException("bus");
+ }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
IntPtr cb_data = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt));
var pending_hdl = eldbus_name_owner_get(Handle, bus, cb_wrapper, cb_data);
- if(pending_hdl == IntPtr.Zero)
+ if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_name_owner_get");
+ }
return new eldbus.Pending(pending_hdl, false);
}
CheckHandle();
if (bus == null)
+ {
throw new ArgumentNullException("bus");
+ }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
IntPtr cb_data = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt));
var pending_hdl = eldbus_name_owner_has(Handle, bus, cb_wrapper, cb_data);
- if(pending_hdl == IntPtr.Zero)
+ if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_name_owner_has");
+ }
return new eldbus.Pending(pending_hdl, false);
}
var pending_hdl = eldbus_names_list(Handle, cb_wrapper, cb_data);
- if(pending_hdl == IntPtr.Zero)
+ if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_names_list");
+ }
return new eldbus.Pending(pending_hdl, false);
}
var pending_hdl = eldbus_names_activatable_list(Handle, cb_wrapper, cb_data);
- if(pending_hdl == IntPtr.Zero)
+ if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_names_activatable_list");
+ }
return new eldbus.Pending(pending_hdl, false);
}
var pending_hdl = eldbus_hello(Handle, cb_wrapper, cb_data);
- if(pending_hdl == IntPtr.Zero)
+ if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_hello");
+ }
return new eldbus.Pending(pending_hdl, false);
}
CheckHandle();
if (bus == null)
+ {
throw new ArgumentNullException("bus");
+ }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
IntPtr cb_data = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt));
var pending_hdl = eldbus_name_start(Handle, bus, flags, cb_wrapper, cb_data);
- if(pending_hdl == IntPtr.Zero)
+ if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_name_start");
+ }
return new eldbus.Pending(pending_hdl, false);
}
using static eldbus.EldbusMessageNativeFunctions;
-namespace eldbus {
+namespace eldbus
+{
public static class EldbusMessageNativeFunctions
{
IntPtr h = Handle;
Handle = IntPtr.Zero;
if (h == IntPtr.Zero)
+ {
return;
+ }
if (Own)
+ {
eldbus_message_unref(h);
+ }
}
public void Dispose()
{
var ptr = eldbus_message_method_call_new(dest, path, iface, method);
if (ptr == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Message' object from eldbus_message_method_call_new");
+ }
+
return new eldbus.Message(ptr, true);
}
{
var ptr = eldbus_message_signal_new(path, _interface, name);
if (ptr == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Message' object from eldbus_message_signal_new");
+ }
+
return new eldbus.Message(ptr, true);
}
CheckHandle();
var ptr = eldbus_message_error_new(Handle, error_name, error_msg);
if (ptr == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Message' object from eldbus_message_error_new");
+ }
+
return new eldbus.Message(ptr, false);
}
CheckHandle();
var ptr = eldbus_message_method_return_new(Handle);
if (ptr == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Message' object from eldbus_message_method_return_new");
+ }
+
return new eldbus.Message(ptr, false);
}
CheckHandle();
var ptr = eldbus_message_iter_get(Handle);
if (ptr == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `MessageIterator' object from eldbus_message_iter_get");
+ }
+
return new eldbus.MessageIterator(ptr, IntPtr.Zero);
}
}
IntPtr new_iter = IntPtr.Zero;
if (signature[0] == 'v')
+ {
new_iter = eldbus_message_iter_container_new(Handle, 'v', signature.Substring(1));
+ }
else if (!eldbus_message_iter_arguments_append(Handle, signature, out new_iter))
+ {
throw new SEHException("Eldbus: could not append container type");
+ }
if (new_iter == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `MessageIterator' object from eldbus_message_iter_arguments_append");
+ }
return new eldbus.MessageIterator(new_iter, Handle);
}
IntPtr new_iter = eldbus_message_iter_container_new(Handle, type, contained_signature);
if (new_iter == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `MessageIterator' object from eldbus_message_iter_container_new");
+ }
return new eldbus.MessageIterator(new_iter, Handle);
}
CheckHandle();
if (Parent == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: can not close MessageIterator open container without a parent");
+ }
if (!eldbus_message_iter_container_close(Parent, Handle))
+ {
throw new SEHException("Eldbus: could not close MessageIterator");
+ }
Handle = IntPtr.Zero;
Parent = IntPtr.Zero;
IntPtr hdl = IntPtr.Zero;
bool r = eldbus_message_iter_get_and_next(Handle, typecode, out hdl);
if (hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get argument");
+ }
+
iter = new eldbus.MessageIterator(hdl, Handle);
return r;
CheckHandle();
IntPtr hdl = IntPtr.Zero;
if (!eldbus_message_iter_arguments_get(Handle, signatue, out hdl) || hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get argument");
+ }
+
iter = new eldbus.MessageIterator(hdl, Handle);
return Next();
CheckHandle();
IntPtr hdl = IntPtr.Zero;
if (!eldbus_message_iter_arguments_get(Handle, signatue, out hdl) || hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get argument");
+ }
+
iter = new eldbus.MessageIterator(hdl, Handle);
}
CheckHandle();
if (!eldbus_message_iter_fixed_array_get(Handle, type_code, out value, out n_elements))
+ {
throw new SEHException("Eldbus: could not get fixed array");
+ }
}
public void GetFixedArray(out byte[] array)
}
}
-
using IntPtr = System.IntPtr;
-namespace eldbus {
-
+namespace eldbus
+{
public static class EldbusObjectNativeFunctions
{
public Object(eldbus.Connection conn, string bus, string path)
{
if (conn == null)
+ {
throw new System.ArgumentNullException("conn");
+ }
+
if (bus == null)
+ {
throw new System.ArgumentNullException("bus");
+ }
+
if (path == null)
+ {
throw new System.ArgumentNullException("path");
+ }
var handle = eldbus_object_get(conn.Handle, bus, path);
if (handle == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Object' object from eldbus_object_get");
+ }
InitNew(handle, true);
}
IntPtr h = Handle;
Handle = IntPtr.Zero;
if (h == IntPtr.Zero)
+ {
return;
+ }
if (Own)
+ {
eldbus_object_unref(h);
+ }
}
public void Dispose()
var conn = eldbus_object_connection_get(Handle);
if (conn == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Connection' object from eldbus_object_connection_get");
+ }
return new eldbus.Connection(conn, false);
}
CheckHandle();
if (msg == null)
+ {
throw new System.ArgumentNullException("msg");
+ }
IntPtr cb_wrapper = dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr();
IntPtr cb_data = dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt);
var pending_hdl = eldbus_object_send(Handle, msg.Handle, cb_wrapper, cb_data, timeout);
if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_object_send");
+ }
return new eldbus.Pending(pending_hdl, false);
}
var hdl = eldbus_object_method_call_new(Handle, _interface, member);
if (hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Message' object from eldbus_object_method_call_new");
+ }
return new eldbus.Message(hdl, false);
}
var pending_hdl = eldbus_object_peer_ping(Handle, cb_wrapper, cb_data);
if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_object_peer_ping");
+ }
return new eldbus.Pending(pending_hdl, false);
}
var pending_hdl = eldbus_object_peer_machine_id_get(Handle, cb_wrapper, cb_data);
if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_object_peer_machine_id_get");
+ }
return new eldbus.Pending(pending_hdl, false);
}
var pending_hdl = eldbus_object_introspect(Handle, cb_wrapper, cb_data);
if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_object_introspect");
+ }
return new eldbus.Pending(pending_hdl, false);
}
var pending_hdl = eldbus_object_managed_objects_get(Handle, cb_wrapper, cb_data);
if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_object_managed_objects_get");
+ }
return new eldbus.Pending(pending_hdl, false);
}
-
}
-
}
using static eldbus.EldbusPendingNativeFunctions;
-namespace eldbus {
+namespace eldbus
+{
public static class EldbusPendingNativeFunctions
{
}
}
-
using static eldbus.EldbusProxyNativeFunctions;
-namespace eldbus {
+namespace eldbus
+{
public static class EldbusProxyNativeFunctions
{
IntPtr h = Handle;
Handle = IntPtr.Zero;
if (h == IntPtr.Zero)
+ {
return;
+ }
if (Own)
+ {
eldbus_proxy_unref(h);
+ }
}
public void Dispose()
CheckHandle();
var ptr = eldbus_proxy_object_get(Handle);
if (ptr == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Object' object from eldbus_proxy_object_get");
+ }
+
return new eldbus.Object(ptr, false);
}
CheckHandle();
if (member == null)
+ {
throw new ArgumentNullException("member");
+ }
var ptr = eldbus_proxy_method_call_new(Handle, member);
if (ptr == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Message' object from eldbus_proxy_method_call_new");
+ }
+
return new eldbus.Message(ptr, false);
}
CheckHandle();
if (msg == null)
+ {
throw new ArgumentNullException("msg");
+ }
IntPtr cb_wrapper = dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr();
IntPtr cb_data = dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt);
var pending_hdl = eldbus_proxy_send(Handle, msg.Handle, cb_wrapper, cb_data, timeout);
if (pending_hdl == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Pending' object from eldbus_proxy_send");
+ }
return new eldbus.Pending(pending_hdl, false);
}
CheckHandle();
var ptr = eldbus_proxy_send_and_block(Handle, msg.Handle, timeout);
if (ptr == IntPtr.Zero)
+ {
throw new SEHException("Eldbus: could not get `Message' object from eldbus_proxy_send_and_block");
+ }
+
return new eldbus.Message(ptr, true);
}
}
}
-
using static eldbus.EldbusServiceNativeFunctions;
-namespace eldbus {
+namespace eldbus
+{
public static class EldbusServiceNativeFunctions
{
}
}
-
using System;
using System.Runtime.InteropServices;
-namespace Efl { namespace Eo {
+namespace Efl
+{
+
+namespace Eo
+{
///<summary>Class to load functions pointers from a native module.
///
private static FunctionLoadResult<T> LazyInitialization(NativeModule module, string functionName)
{
if (module.Module == IntPtr.Zero)
+ {
return new FunctionLoadResult<T>(FunctionLoadResultKind.LibraryNotFound);
+ }
else
{
IntPtr funcptr = FunctionInterop.LoadFunctionPointer(module.Module, functionName);
if (funcptr == IntPtr.Zero)
+ {
return new FunctionLoadResult<T>(FunctionLoadResultKind.FunctionNotFound);
+ }
else
+ {
return new FunctionLoadResult<T>(Marshal.GetDelegateForFunctionPointer<T>(funcptr));
+ }
}
}
///<param name="moduleName">The name of the module containing the function.</param>
///<param name="functionName">The name of the function to search for.</param>
public FunctionWrapper(string moduleName, string functionName)
- : this (new NativeModule(moduleName), functionName)
+ : this(new NativeModule(moduleName), functionName)
{
}
}
///<summary>The outcome of the function load process.</summary>
-public enum FunctionLoadResultKind {
+public enum FunctionLoadResultKind
+{
///<summary>Function was loaded successfully.</summary>
Success,
///<summary>Library was not found.</summary>
///Throws InvalidOperationException if trying to access while not loaded.</summary>
public T Delegate
{
- get {
+ get
+ {
if (_Delegate == null)
+ {
throw new InvalidOperationException($"Trying to get Delegate while not loaded. Load result: {Kind}");
+ }
+
return _Delegate;
}
}
}
}
-} }
+}
+
+}
using System;
using System.Runtime.InteropServices;
-namespace Efl { namespace Eo {
+namespace Efl
+{
+
+namespace Eo
+{
public partial class FunctionInterop
{
}
}
-} }
+}
+
+}
using System;
using System.Runtime.InteropServices;
-namespace Efl { namespace Eo {
+namespace Efl
+{
+
+namespace Eo
+{
public partial class FunctionInterop
{
=> FunctionInterop.GetProcAddress(nativeLibraryHandle, functionName);
}
-} }
+}
+
+}
using System;
-namespace Efl { namespace Eo {
+namespace Efl
+{
+
+namespace Eo
+{
///<summary>Wraps a native module that was opened with dlopen/LoadLibrary.</summary>
public partial class NativeModule : IDisposable
}
}
-} }
+}
+
+}
using System;
using System.Runtime.InteropServices;
-namespace Efl { namespace Eo {
+namespace Efl
+{
+
+namespace Eo
+{
public partial class NativeModule
{
}
}
}
+
return r;
}
}
+}
-
-
-} }
+}
using System;
using System.Runtime.InteropServices;
-namespace Efl { namespace Eo {
+namespace Efl
+{
+
+namespace Eo
+{
public class partial NativeModule
{
public static extern IntPtr LoadLibrary(string libFilename);
}
+}
-
-
-} }
+}
using static Eina.NativeCustomExportFunctions;
using EoG = Efl.Eo.Globals;
-namespace Efl { namespace Eo {
+namespace Efl
+{
-public class Globals {
+namespace Eo
+{
+public class Globals
+{
/// <summary>Represents the type of the native Efl_Class.</summary>
- public enum EflClassType {
+ public enum EflClassType
+ {
/// <summary>Regular EFL classes.</summary>
Regular = 0,
/// <summary>Non-instantiable efl classes (i.e. Abstracts).</summary>
[DllImport(efl.Libs.Evil)] public static extern IntPtr dlerror();
public delegate bool efl_event_callback_priority_add_delegate(
- System.IntPtr obj,
- IntPtr desc,
- short priority,
- Efl.EventCb cb,
- System.IntPtr data);
+ System.IntPtr obj,
+ IntPtr desc,
+ short priority,
+ Efl.EventCb cb,
+ System.IntPtr data);
[DllImport(efl.Libs.Eo)] public static extern bool efl_event_callback_priority_add(
- System.IntPtr obj,
- IntPtr desc,
- short priority,
- Efl.EventCb cb,
- System.IntPtr data);
+ System.IntPtr obj,
+ IntPtr desc,
+ short priority,
+ Efl.EventCb cb,
+ System.IntPtr data);
public delegate bool efl_event_callback_del_delegate(
- System.IntPtr obj,
- IntPtr desc,
- Efl.EventCb cb,
- System.IntPtr data);
+ System.IntPtr obj,
+ IntPtr desc,
+ Efl.EventCb cb,
+ System.IntPtr data);
[DllImport(efl.Libs.Eo)] public static extern bool efl_event_callback_del(
- System.IntPtr obj,
- IntPtr desc,
- Efl.EventCb cb,
- System.IntPtr data);
+ System.IntPtr obj,
+ IntPtr desc,
+ Efl.EventCb cb,
+ System.IntPtr data);
public const int RTLD_NOW = 2;
{
return v.Value;
}
+
public static U GetParamHelper<U>(U v)
{
return v;
}
+
public static bool ParamHelperCheck<T>(Nullable<T> v) where T : struct
{
return v.HasValue;
}
+
public static bool ParamHelperCheck<U>(U v)
{
return v != null;
description.class_destructor = IntPtr.Zero;
class_initializer init = (IntPtr kls) =>
- {
- return Globals.class_initializer_call(kls, type);
- };
+ {
+ return Globals.class_initializer_call(kls, type);
+ };
description.class_initializer = Marshal.GetFunctionPointerForDelegate(init);
Eina.Log.Debug($"Going to register new class named {class_name}");
IntPtr klass = EoG.call_efl_class_new(description_ptr, base_klass, interface_list);
- if(klass == IntPtr.Zero)
+ if (klass == IntPtr.Zero)
+ {
Eina.Log.Error("klass was not registered");
+ }
else
+ {
Eina.Log.Debug("Registered class successfully");
+ }
+
return klass;
}
+
public static List<IntPtr> get_efl_interfaces(System.Type type)
{
System.Type base_type = type.BaseType;
{
if (!System.Array.Exists(base_ifaces, element => element == iface))
{
- var attrs = System.Attribute.GetCustomAttributes(iface);
- foreach (var attr in attrs)
- {
- if (attr is Efl.Eo.NativeClass) {
- ifaces_lst.Add(((Efl.Eo.NativeClass)attr).GetEflClass());
- break;
- }
- }
+ var attrs = System.Attribute.GetCustomAttributes(iface);
+ foreach (var attr in attrs)
+ {
+ if (attr is Efl.Eo.NativeClass)
+ {
+ ifaces_lst.Add(((Efl.Eo.NativeClass)attr).GetEflClass());
+ break;
+ }
+ }
}
}
+
return ifaces_lst;
}
+
private static Efl.Eo.NativeClass get_native_class(System.Type type)
{
var attrs = System.Attribute.GetCustomAttributes(type);
foreach (var attr in attrs)
{
- if (attr is Efl.Eo.NativeClass) {
+ if (attr is Efl.Eo.NativeClass)
+ {
return (Efl.Eo.NativeClass)attr;
}
}
+
return null;
}
+
public static byte class_initializer_call(IntPtr klass, System.Type type)
{
Eina.Log.Debug($"called with 0x{klass.ToInt64():x} {type}");
if (!System.Array.Exists(base_interfaces, element => element == iface))
{
var nc = get_native_class(iface);
- if(nc != null)
+ if (nc != null)
{
var moredescs = nc.GetEoOps(type);
Eina.Log.Debug($"adding {moredescs.Count} more descs to registration");
}
}
- IntPtr descs_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(descs[0])*count);
+ IntPtr descs_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(descs[0]) * count);
IntPtr ptr = descs_ptr;
- for(int i = 0; i != count; ++i)
+ for (int i = 0; i != count; ++i)
{
Marshal.StructureToPtr(descs[i], ptr, false);
ptr = IntPtr.Add(ptr, Marshal.SizeOf(descs[0]));
}
+
Efl_Object_Ops ops;
ops.descs = descs_ptr;
ops.count = (UIntPtr)count;
//EoKlass = klass;
}
else
+ {
Eina.Log.Debug("nativeClass == null");
+ }
return 1;
}
+
public static IntPtr call_efl_class_new(IntPtr desc, IntPtr bk, List<IntPtr> il = null)
{
IntPtr nul = IntPtr.Zero;
int iface_list_count = (il == null ? 0 : il.Count);
- switch(iface_list_count)
- {
- default: return nul;
- case 0: return EoG.efl_class_new(desc, bk, nul);
- case 1: return EoG.efl_class_new(desc, bk, il[0], nul);
- case 2: return EoG.efl_class_new(desc, bk, il[0], il[1], nul);
- case 3: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], nul);
- case 4: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], nul);
- case 5: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], nul);
- case 6: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], nul);
- case 7: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], nul);
- case 8: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], nul);
- case 9: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], nul);
- case 10: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], nul);
- case 11: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], nul);
- case 12: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], nul);
- case 13: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], nul);
- case 14: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], nul);
- case 15: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], nul);
- case 16: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], nul);
- case 17: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], nul);
- case 18: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], nul);
- case 19: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], nul);
- case 20: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], nul);
- case 21: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], nul);
- case 22: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], nul);
- case 23: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], nul);
- case 24: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], nul);
- case 25: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], nul);
- case 26: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], nul);
- case 27: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], nul);
- case 28: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], nul);
- case 29: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], nul);
- case 30: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], nul);
- case 31: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], nul);
- case 32: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], nul);
- case 33: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], nul);
- case 34: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], nul);
- case 35: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], nul);
- case 36: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], nul);
- case 37: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], nul);
- case 38: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], nul);
- case 39: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], nul);
- case 40: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], nul);
- case 41: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], nul);
- case 42: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], nul);
- case 43: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], nul);
- case 44: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], nul);
- case 45: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], nul);
- case 46: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], il[45], nul);
- case 47: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], il[45], il[46], nul);
- case 48: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], il[45], il[46], il[47], nul);
+ switch (iface_list_count)
+ {
+ default: return nul;
+ case 0: return EoG.efl_class_new(desc, bk, nul);
+ case 1: return EoG.efl_class_new(desc, bk, il[0], nul);
+ case 2: return EoG.efl_class_new(desc, bk, il[0], il[1], nul);
+ case 3: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], nul);
+ case 4: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], nul);
+ case 5: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], nul);
+ case 6: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], nul);
+ case 7: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], nul);
+ case 8: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], nul);
+ case 9: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], nul);
+ case 10: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], nul);
+ case 11: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], nul);
+ case 12: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], nul);
+ case 13: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], nul);
+ case 14: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], nul);
+ case 15: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], nul);
+ case 16: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], nul);
+ case 17: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], nul);
+ case 18: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], nul);
+ case 19: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], nul);
+ case 20: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], nul);
+ case 21: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], nul);
+ case 22: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], nul);
+ case 23: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], nul);
+ case 24: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], nul);
+ case 25: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], nul);
+ case 26: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], nul);
+ case 27: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], nul);
+ case 28: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], nul);
+ case 29: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], nul);
+ case 30: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], nul);
+ case 31: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], nul);
+ case 32: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], nul);
+ case 33: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], nul);
+ case 34: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], nul);
+ case 35: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], nul);
+ case 36: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], nul);
+ case 37: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], nul);
+ case 38: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], nul);
+ case 39: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], nul);
+ case 40: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], nul);
+ case 41: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], nul);
+ case 42: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], nul);
+ case 43: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], nul);
+ case 44: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], nul);
+ case 45: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], nul);
+ case 46: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], il[45], nul);
+ case 47: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], il[45], il[46], nul);
+ case 48: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], il[45], il[46], il[47], nul);
}
}
+
public static IntPtr instantiate_start(IntPtr klass, Efl.Object parent)
{
Eina.Log.Debug($"Instantiating from klass 0x{klass.ToInt64():x}");
System.IntPtr parent_ptr = System.IntPtr.Zero;
- if(parent != null)
+ if (parent != null)
+ {
parent_ptr = parent.NativeHandle;
+ }
System.IntPtr eo = Efl.Eo.Globals._efl_add_internal_start("file", 0, klass, parent_ptr, 1, 0);
if (eo == System.IntPtr.Zero)
return eo;
}
- public static IntPtr instantiate_end(IntPtr eo) {
+ public static IntPtr instantiate_end(IntPtr eo)
+ {
Eina.Log.Debug("calling efl_add_internal_end");
eo = Efl.Eo.Globals._efl_add_end(eo, 1, 0);
Eina.Log.Debug($"efl_add_end returned eo 0x{eo.ToInt64():x}");
return eo;
}
+
public static void data_set(Efl.Eo.IWrapper obj)
{
- Eina.Log.Debug($"Calling data_scope_get with obj {obj.NativeHandle.ToInt64():x} and klass {obj.NativeClass.ToInt64():x}");
- IntPtr pd = Efl.Eo.Globals.efl_data_scope_get(obj.NativeHandle, obj.NativeClass);
- {
- GCHandle gch = GCHandle.Alloc(obj);
- EolianPD epd;
- epd.pointer = GCHandle.ToIntPtr(gch);
- Marshal.StructureToPtr(epd, pd, false);
- }
+ Eina.Log.Debug($"Calling data_scope_get with obj {obj.NativeHandle.ToInt64():x} and klass {obj.NativeClass.ToInt64():x}");
+ IntPtr pd = Efl.Eo.Globals.efl_data_scope_get(obj.NativeHandle, obj.NativeClass);
+ {
+ GCHandle gch = GCHandle.Alloc(obj);
+ EolianPD epd;
+ epd.pointer = GCHandle.ToIntPtr(gch);
+ Marshal.StructureToPtr(epd, pd, false);
+ }
}
+
public static Efl.Eo.IWrapper data_get(IntPtr pd)
{
EolianPD epd = (EolianPD)Marshal.PtrToStructure(pd, typeof(EolianPD));
- if(epd.pointer != IntPtr.Zero)
+ if (epd.pointer != IntPtr.Zero)
{
GCHandle gch = GCHandle.FromIntPtr(epd.pointer);
return (Efl.Eo.IWrapper)gch.Target;
}
else
+ {
return null;
+ }
}
public static void free_dict_values(Dictionary<String, IntPtr> dict)
{
- foreach(IntPtr ptr in dict.Values)
+ foreach (IntPtr ptr in dict.Values)
{
Eina.MemoryNative.Free(ptr);
}
public static void free_stringshare_values(Dictionary<String, IntPtr> dict)
{
- foreach(IntPtr ptr in dict.Values)
+ foreach (IntPtr ptr in dict.Values)
{
Eina.Stringshare.eina_stringshare_del(ptr);
}
// Flag to be passed to the cancell callback
bool fulfilled = false;
- future.Then((Eina.Value received) => {
- lock (future)
+ future.Then((Eina.Value received) =>
+ {
+ lock (future)
+ {
+ // Convert an failed Future to a failed Task.
+ if (received.GetValueType() == Eina.ValueType.Error)
{
- // Convert an failed Future to a failed Task.
- if (received.GetValueType() == Eina.ValueType.Error)
+ Eina.Error err;
+ received.Get(out err);
+ if (err == Eina.Error.ECANCELED)
{
- Eina.Error err;
- received.Get(out err);
- if (err == Eina.Error.ECANCELED)
- tcs.SetCanceled();
- else
- tcs.TrySetException(new Efl.FutureException(received));
+ tcs.SetCanceled();
}
else
{
- // Will mark the returned task below as completed.
- tcs.SetResult(received);
+ tcs.TrySetException(new Efl.FutureException(received));
}
- fulfilled = true;
- return received;
}
+ else
+ {
+ // Will mark the returned task below as completed.
+ tcs.SetResult(received);
+ }
+
+ fulfilled = true;
+ return received;
+ }
});
// Callback to be called when the token is cancelled.
- token.Register(() => {
- lock (future)
+ token.Register(() =>
+ {
+ lock (future)
+ {
+ // Will trigger the Then callback above with an Eina.Error
+ if (!fulfilled)
{
- // Will trigger the Then callback above with an Eina.Error
- if (!fulfilled)
- future.Cancel();
+ future.Cancel();
}
+ }
});
return tcs.Task;
{
get;
}
+
/// <summary>Pointer to internal Eo class.</summary>
IntPtr NativeClass
{
{
System.Type t;
if (Efl.Eo.ClassRegister.typeFromKlass.TryGetValue(klass, out t))
+ {
return t;
+ }
// If it isn't on the dictionary then it is a Native binding class
IntPtr namePtr = Efl.Eo.Globals.efl_class_name_get(klass);
- if (namePtr == IntPtr.Zero) {
+ if (namePtr == IntPtr.Zero)
+ {
throw new System.InvalidOperationException($"Could not get Native class name. Handle: {klass}");
}
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
if (assembly == curr_asm)
+ {
continue;
+ }
t = assembly.GetType(name);
if (t != null)
+ {
break;
+ }
}
- if (t == null) {
+
+ if (t == null)
+ {
throw new System.InvalidOperationException($"Could not find the C# binding class for the EFL class: {name}");
}
}
+
AddToKlassTypeBiDictionary(klass, t); // Cache it in the dictionary
return t;
}
{
IntPtr klass;
if (klassFromType.TryGetValue(objectType, out klass))
+ {
return klass;
+ }
// Check if it is a Native binding class
klass = GetNativeKlassPtr(objectType);
- if (klass != IntPtr.Zero) {
+ if (klass != IntPtr.Zero)
+ {
// Add to the dictionary cache
AddToKlassTypeBiDictionary(klass, objectType);
return klass;
// Unregistered Inherited class, let's register it
IntPtr baseKlass = GetNativeBaseKlassPtr(objectType);
if (baseKlass == IntPtr.Zero)
+ {
throw new System.InvalidOperationException($"Could not get base C# binding class for Inherited type: {objectType.FullName}");
+ }
+
return RegisterKlass(baseKlass, objectType);
}
{
IntPtr klass;
if (klassFromType.TryGetValue(objectType, out klass))
+ {
return klass;
+ }
return RegisterKlass(baseKlass, objectType);
}
private static IntPtr RegisterKlass(IntPtr baseKlass, System.Type objectType)
{
- lock (klassAllocLock) {
+ lock (klassAllocLock)
+ {
IntPtr newKlass = Efl.Eo.Globals.register_class(objectType.FullName, baseKlass, objectType);
- if (newKlass == IntPtr.Zero) {
+ if (newKlass == IntPtr.Zero)
+ {
throw new System.InvalidOperationException($"Failed to register class '{objectType.FullName}'");
}
+
AddToKlassTypeBiDictionary(newKlass, objectType);
return newKlass;
}
{
var ptr = GetNativeKlassPtr(t);
if (ptr != IntPtr.Zero)
+ {
return ptr;
+ }
}
+
throw new System.InvalidOperationException($"Class '{objectType.FullName}' is not an Efl object");
}
private static IntPtr GetNativeKlassPtr(System.Type objectType)
{
if (objectType == null)
+ {
return IntPtr.Zero;
+ }
if (objectType.IsInterface)
{
objectType = assembly.GetType(objectType.FullName + "Concrete");
if (objectType == null)
+ {
return IntPtr.Zero;
+ }
}
var method = objectType.GetMethod("GetEflClassStatic",
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
if (method == null)
+ {
return IntPtr.Zero;
- return (IntPtr) (method.Invoke(null, null));
+ }
+
+ return (IntPtr)(method.Invoke(null, null));
}
public static void AddToKlassTypeBiDictionary(IntPtr klassPtr, System.Type objectType)
Eina.Log.Debug("MarshalTest.GetInstace cookie " + cookie);
return new MarshalTest<T, U>();
}
+
public void CleanUpManagedData(object ManagedObj)
{
//Eina.Log.Warning("MarshalTest.CleanUpManagedData not implemented");
Eina.Log.Debug("MarshalTest.MarshallManagedToNative");
var r = ((IWrapper)ManagedObj).NativeHandle;
if (typeof(U) == typeof(OwnTag))
+ {
Efl.Eo.Globals.efl_ref(r);
+ }
+
return r;
}
{
Eina.Log.Debug("MarshalTest.MarshalNativeToManaged");
if (typeof(U) != typeof(OwnTag))
+ {
Efl.Eo.Globals.efl_ref(pNativeData);
+ }
+
return Activator.CreateInstance(typeof(T), new System.Object[] {pNativeData});
-// return null;
+ //return null;
}
}
Eina.Log.Debug("MarshalTest.GetInstance cookie " + cookie);
return new MarshalEflClass();
}
+
public void CleanUpManagedData(object ManagedObj)
{
}
{
Eina.Log.Debug("MarshalTest.MarshallManagedToNative");
if (ManagedObj == null)
+ {
return IntPtr.Zero;
- var t = (System.Type) ManagedObj;
+ }
+
+ var t = (System.Type)ManagedObj;
return Efl.Eo.ClassRegister.GetKlass(t);
}
{
Eina.Log.Debug("MarshalTest.MarshalNativeToManaged");
if (pNativeData == IntPtr.Zero)
+ {
return null;
+ }
+
return Efl.Eo.ClassRegister.GetManagedType(pNativeData);
}
}
-public class StringPassOwnershipMarshaler : ICustomMarshaler {
- public object MarshalNativeToManaged(IntPtr pNativeData) {
+public class StringPassOwnershipMarshaler : ICustomMarshaler
+{
+ public object MarshalNativeToManaged(IntPtr pNativeData)
+ {
var ret = Eina.StringConversion.NativeUtf8ToManagedString(pNativeData);
Eina.MemoryNative.Free(pNativeData);
return ret;
}
- public IntPtr MarshalManagedToNative(object managedObj) {
+ public IntPtr MarshalManagedToNative(object managedObj)
+ {
return Eina.MemoryNative.StrDup((string)managedObj);
}
- public void CleanUpNativeData(IntPtr pNativeData) {
+ public void CleanUpNativeData(IntPtr pNativeData)
+ {
// No need to cleanup. C will take care of it.
}
- public void CleanUpManagedData(object managedObj) {
+ public void CleanUpManagedData(object managedObj)
+ {
}
- public int GetNativeDataSize() {
+ public int GetNativeDataSize()
+ {
return -1;
}
- public static ICustomMarshaler GetInstance(string cookie) {
- if (marshaler == null) {
+ public static ICustomMarshaler GetInstance(string cookie)
+ {
+ if (marshaler == null)
+ {
marshaler = new StringPassOwnershipMarshaler();
}
+
return marshaler;
}
+
static private StringPassOwnershipMarshaler marshaler;
}
-public class StringKeepOwnershipMarshaler: ICustomMarshaler {
- public object MarshalNativeToManaged(IntPtr pNativeData) {
+public class StringKeepOwnershipMarshaler: ICustomMarshaler
+{
+ public object MarshalNativeToManaged(IntPtr pNativeData)
+ {
return Eina.StringConversion.NativeUtf8ToManagedString(pNativeData);
}
- public IntPtr MarshalManagedToNative(object managedObj) {
+ public IntPtr MarshalManagedToNative(object managedObj)
+ {
return Eina.StringConversion.ManagedStringToNativeUtf8Alloc((string)managedObj);
}
- public void CleanUpNativeData(IntPtr pNativeData) {
+ public void CleanUpNativeData(IntPtr pNativeData)
+ {
// No need to free. The Native side will keep the ownership.
}
- public void CleanUpManagedData(object managedObj) {
+ public void CleanUpManagedData(object managedObj)
+ {
}
- public int GetNativeDataSize() {
+ public int GetNativeDataSize()
+ {
return -1;
}
- public static ICustomMarshaler GetInstance(string cookie) {
- if (marshaler == null) {
+ public static ICustomMarshaler GetInstance(string cookie)
+ {
+ if (marshaler == null)
+ {
marshaler = new StringKeepOwnershipMarshaler();
}
+
return marshaler;
}
+
static private StringKeepOwnershipMarshaler marshaler;
}
-public class StringsharePassOwnershipMarshaler : ICustomMarshaler {
- public object MarshalNativeToManaged(IntPtr pNativeData) {
+public class StringsharePassOwnershipMarshaler : ICustomMarshaler
+{
+ public object MarshalNativeToManaged(IntPtr pNativeData)
+ {
var ret = Eina.StringConversion.NativeUtf8ToManagedString(pNativeData);
Eina.Stringshare.eina_stringshare_del(pNativeData);
return ret;
}
- public IntPtr MarshalManagedToNative(object managedObj) {
+ public IntPtr MarshalManagedToNative(object managedObj)
+ {
return Eina.Stringshare.eina_stringshare_add((string)managedObj);
}
- public void CleanUpNativeData(IntPtr pNativeData) {
+ public void CleanUpNativeData(IntPtr pNativeData)
+ {
// No need to free as it's for own() parameters.
}
- public void CleanUpManagedData(object managedObj) {
+ public void CleanUpManagedData(object managedObj)
+ {
}
- public int GetNativeDataSize() {
+ public int GetNativeDataSize()
+ {
return -1;
}
- public static ICustomMarshaler GetInstance(string cookie) {
- if (marshaler == null) {
+ public static ICustomMarshaler GetInstance(string cookie)
+ {
+ if (marshaler == null)
+ {
marshaler = new StringsharePassOwnershipMarshaler();
}
+
return marshaler;
}
+
static private StringsharePassOwnershipMarshaler marshaler;
}
-public class StringshareKeepOwnershipMarshaler : ICustomMarshaler {
- public object MarshalNativeToManaged(IntPtr pNativeData) {
+public class StringshareKeepOwnershipMarshaler : ICustomMarshaler
+{
+ public object MarshalNativeToManaged(IntPtr pNativeData)
+ {
return Eina.StringConversion.NativeUtf8ToManagedString(pNativeData);
}
- public IntPtr MarshalManagedToNative(object managedObj) {
+ public IntPtr MarshalManagedToNative(object managedObj)
+ {
return Eina.Stringshare.eina_stringshare_add((string)managedObj);
}
- public void CleanUpNativeData(IntPtr pNativeData) {
+ public void CleanUpNativeData(IntPtr pNativeData)
+ {
// No need to free, as the native side will keep ownership.
}
- public void CleanUpManagedData(object managedObj) {
+ public void CleanUpManagedData(object managedObj)
+ {
}
- public int GetNativeDataSize() {
+ public int GetNativeDataSize()
+ {
return -1;
}
- public static ICustomMarshaler GetInstance(string cookie) {
- if (marshaler == null) {
+ public static ICustomMarshaler GetInstance(string cookie)
+ {
+ if (marshaler == null)
+ {
marshaler = new StringshareKeepOwnershipMarshaler();
}
+
return marshaler;
}
+
static private StringshareKeepOwnershipMarshaler marshaler;
}
-public class StrbufPassOwnershipMarshaler : ICustomMarshaler {
- public object MarshalNativeToManaged(IntPtr pNativeData) {
+public class StrbufPassOwnershipMarshaler : ICustomMarshaler
+{
+ public object MarshalNativeToManaged(IntPtr pNativeData)
+ {
return new Eina.Strbuf(pNativeData, Eina.Ownership.Managed);
}
- public IntPtr MarshalManagedToNative(object managedObj) {
+ public IntPtr MarshalManagedToNative(object managedObj)
+ {
Eina.Strbuf buf = managedObj as Eina.Strbuf;
buf.ReleaseOwnership();
return buf.Handle;
}
- public void CleanUpNativeData(IntPtr pNativeData) {
+ public void CleanUpNativeData(IntPtr pNativeData)
+ {
// No need to cleanup. C will take care of it.
}
- public void CleanUpManagedData(object managedObj) {
+ public void CleanUpManagedData(object managedObj)
+ {
}
- public int GetNativeDataSize() {
+ public int GetNativeDataSize()
+ {
return -1;
}
- public static ICustomMarshaler GetInstance(string cookie) {
- if (marshaler == null) {
+ public static ICustomMarshaler GetInstance(string cookie)
+ {
+ if (marshaler == null)
+ {
marshaler = new StrbufPassOwnershipMarshaler();
}
+
return marshaler;
}
+
static private StrbufPassOwnershipMarshaler marshaler;
}
-public class StrbufKeepOwnershipMarshaler: ICustomMarshaler {
- public object MarshalNativeToManaged(IntPtr pNativeData) {
+public class StrbufKeepOwnershipMarshaler: ICustomMarshaler
+{
+ public object MarshalNativeToManaged(IntPtr pNativeData)
+ {
return new Eina.Strbuf(pNativeData, Eina.Ownership.Unmanaged);
}
- public IntPtr MarshalManagedToNative(object managedObj) {
+ public IntPtr MarshalManagedToNative(object managedObj)
+ {
Eina.Strbuf buf = managedObj as Eina.Strbuf;
return buf.Handle;
}
- public void CleanUpNativeData(IntPtr pNativeData) {
+ public void CleanUpNativeData(IntPtr pNativeData)
+ {
// No need to free. The Native side will keep the ownership.
}
- public void CleanUpManagedData(object managedObj) {
+ public void CleanUpManagedData(object managedObj)
+ {
}
- public int GetNativeDataSize() {
+ public int GetNativeDataSize()
+ {
return -1;
}
- public static ICustomMarshaler GetInstance(string cookie) {
- if (marshaler == null) {
+ public static ICustomMarshaler GetInstance(string cookie)
+ {
+ if (marshaler == null)
+ {
marshaler = new StrbufKeepOwnershipMarshaler();
}
+
return marshaler;
}
+
static private StrbufKeepOwnershipMarshaler marshaler;
}
-
-
} // namespace eo
/// <summary>General exception for errors inside the binding.</summary>
public FutureException(Eina.Value value) : base("Future failed.")
{
if (value.GetValueType() != Eina.ValueType.Error)
+ {
throw new ArgumentException("FutureException must receive an Eina.Value with Eina.Error.");
+ }
+
Eina.Error err;
value.Get(out err);
Error = err;
}
#pragma warning disable 0169
+
public struct EvasObjectBoxLayout
{
IntPtr o;
IntPtr priv;
IntPtr user_data;
};
+
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
public struct EvasObjectBoxData
{
}
-public struct EvasObjectBoxOption {
+
+public struct EvasObjectBoxOption
+{
IntPtr obj;
[MarshalAsAttribute(UnmanagedType.U1)] bool max_reached;
[MarshalAsAttribute(UnmanagedType.U1)] bool min_reached;
Evas.Coord alloc_size;
};
+
#pragma warning restore 0169
-namespace Efl {
+namespace Efl
+{
[StructLayout(LayoutKind.Sequential)]
-public struct EventDescription {
+public struct EventDescription
+{
public IntPtr Name;
[MarshalAs(UnmanagedType.U1)] public bool Unfreezable;
[MarshalAs(UnmanagedType.U1)] public bool Legacy_is;
{
IntPtr data = Efl.Eo.FunctionInterop.LoadFunctionPointer(module, name);
- if (data == IntPtr.Zero) {
+ if (data == IntPtr.Zero)
+ {
string error = Eina.StringConversion.NativeUtf8ToManagedString(Efl.Eo.Globals.dlerror());
throw new Exception(error);
}
+
descriptions.Add(name, data);
}
+
return descriptions[name];
}
};
public delegate void EventCb(System.IntPtr data, ref Event.NativeStruct evt);
[StructLayout(LayoutKind.Sequential)]
-public struct TextCursorCursor {
+public struct TextCursorCursor
+{
IntPtr obj;
UIntPtr pos; // UIntPtr to automatically change size_t between 32/64
IntPtr node;
}
[StructLayout(LayoutKind.Sequential)]
-public struct TextAnnotateAnnotation {
+public struct TextAnnotateAnnotation
+{
IntPtr list;
IntPtr obj;
IntPtr start_node;
public delegate void SignalCb(IntPtr data, IntPtr obj, IntPtr emission, IntPtr source);
-namespace Access {
+namespace Access
+{
public delegate IntPtr ReadingInfoCb(System.IntPtr data, ref Efl.Canvas.Object obj);
public delegate bool GestureCb(System.IntPtr data, ref Efl.Access.GestureInfo info, ref Efl.Canvas.Object obj);
-public struct ReadingInfoTypeMask {
+public struct ReadingInfoTypeMask
+{
private uint mask;
public static implicit operator ReadingInfoTypeMask(uint x)
}
}
-public struct ActionData {
+public struct ActionData
+{
public IntPtr name;
public IntPtr action;
public IntPtr param;
} // namespace Efl
-namespace Evas {
+namespace Evas
+{
-public struct Coord {
+public struct Coord
+{
int val;
- public Coord(int value) { val = value; }
- static public implicit operator Coord(int val) {
+ public Coord(int value)
+ {
+ val = value;
+ }
+
+ static public implicit operator Coord(int val)
+ {
return new Coord(val);
}
- static public implicit operator int(Coord coord) {
+
+ static public implicit operator int(Coord coord)
+ {
return coord.val;
}
}
/* Copied from Evas_Legacy.h */
public enum TextStyleType
{
- ///<summary> plain, standard text.</summary>
- Plain = 0,
- ///<summary> text with shadow underneath.</summary>
- Shadow,
- ///<summary> text with an outline.</summary>
- Outline,
- ///<summary> text with a soft outline.</summary>
- SoftOutline,
- ///<summary> text with a glow effect.</summary>
- Glow,
- ///<summary> text with both outline and shadow effects.</summary>
- OutlineShadow,
- ///<summary> text with (far) shadow underneath.</summary>
- FarShadow,
- ///<summary> text with outline and soft shadow effects combined.</summary>
- OutlineSoftShadow,
- ///<summary> text with (soft) shadow underneath.</summary>
- SoftShadow,
- ///<summary> text with (far soft) shadow underneath.</summary>
- FarSoftShadow,
-
- // Shadow direction modifiers
- ///<summary> shadow growing to bottom right.</summary>
- ShadowDirectionBottomRight = 0 /* 0 >> 4 */,
- ///<summary> shadow growing to the bottom.</summary>
- ShadowDirectionBottom= 16 /* 1 >> 4 */,
- ///<summary> shadow growing to bottom left.</summary>
- ShadowDirectionBottomLeft = 32 /* 2 >> 4 */,
- ///<summary> shadow growing to the left.</summary>
- ShadowDirectionLeft = 48 /* 3 >> 4 */,
- ///<summary> shadow growing to top left.</summary>
- ShadowDirectionTopLeft = 64 /* 4 >> 4 */,
- ///<summary> shadow growing to the top.</summary>
- ShadowDirectionTop = 80 /* 5 >> 4 */,
- ///<summary> shadow growing to top right.</summary>
- ShadowDirectionTopRight = 96 /* 6 >> 4 */,
- ///<summary> shadow growing to the right.</summary>
- ShadowDirectionRight = 112 /* 7 >> 4 */
+ ///<summary> plain, standard text.</summary>
+ Plain = 0,
+ ///<summary> text with shadow underneath.</summary>
+ Shadow,
+ ///<summary> text with an outline.</summary>
+ Outline,
+ ///<summary> text with a soft outline.</summary>
+ SoftOutline,
+ ///<summary> text with a glow effect.</summary>
+ Glow,
+ ///<summary> text with both outline and shadow effects.</summary>
+ OutlineShadow,
+ ///<summary> text with (far) shadow underneath.</summary>
+ FarShadow,
+ ///<summary> text with outline and soft shadow effects combined.</summary>
+ OutlineSoftShadow,
+ ///<summary> text with (soft) shadow underneath.</summary>
+ SoftShadow,
+ ///<summary> text with (far soft) shadow underneath.</summary>
+ FarSoftShadow,
+
+ // Shadow direction modifiers
+ ///<summary> shadow growing to bottom right.</summary>
+ ShadowDirectionBottomRight = 0 /* 0 >> 4 */,
+ ///<summary> shadow growing to the bottom.</summary>
+ ShadowDirectionBottom = 16 /* 1 >> 4 */,
+ ///<summary> shadow growing to bottom left.</summary>
+ ShadowDirectionBottomLeft = 32 /* 2 >> 4 */,
+ ///<summary> shadow growing to the left.</summary>
+ ShadowDirectionLeft = 48 /* 3 >> 4 */,
+ ///<summary> shadow growing to top left.</summary>
+ ShadowDirectionTopLeft = 64 /* 4 >> 4 */,
+ ///<summary> shadow growing to the top.</summary>
+ ShadowDirectionTop = 80 /* 5 >> 4 */,
+ ///<summary> shadow growing to top right.</summary>
+ ShadowDirectionTopRight = 96 /* 6 >> 4 */,
+ ///<summary> shadow growing to the right.</summary>
+ ShadowDirectionRight = 112 /* 7 >> 4 */
};
} // namespace Evas
public delegate int Eina_Compare_Cb(IntPtr a, IntPtr b);
public delegate void ElmInterfaceScrollableCb(IntPtr obj, IntPtr data);
public delegate void ElmInterfaceScrollableMinLimitCb(IntPtr obj,
- [MarshalAsAttribute(UnmanagedType.U1)]bool w,
- [MarshalAsAttribute(UnmanagedType.U1)]bool h);
+ [MarshalAsAttribute(UnmanagedType.U1)]bool w,
+ [MarshalAsAttribute(UnmanagedType.U1)]bool h);
public delegate void ElmInterfaceScrollableResizeCb(IntPtr obj, Evas.Coord w, Evas.Coord h);
[return: MarshalAsAttribute(UnmanagedType.U1)]
public delegate bool ElmMultibuttonentryItemFilterCb(IntPtr obj, IntPtr item_label, IntPtr item_data, IntPtr data);