From e4385c084cd726667817742fb21d318a38a21acc Mon Sep 17 00:00:00 2001 From: Bruno da Silva Belo Date: Mon, 14 Oct 2019 11:36:25 -0300 Subject: [PATCH] csharp: updating eina_error docs. Reviewers: felipealmeida, lauromoura, segfaultxavi, woohyun Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8293 Differential Revision: https://phab.enlightenment.org/D10323 --- src/bindings/mono/eina_mono/eina_error.cs | 87 ++++++++++++++++++++++- 1 file changed, 84 insertions(+), 3 deletions(-) diff --git a/src/bindings/mono/eina_mono/eina_error.cs b/src/bindings/mono/eina_mono/eina_error.cs index a1b4f1e9d9..8292295e9d 100644 --- a/src/bindings/mono/eina_mono/eina_error.cs +++ b/src/bindings/mono/eina_mono/eina_error.cs @@ -7,45 +7,94 @@ namespace Eina { /// Error codes from native Eina methods. -/// -/// Since EFL 1.23. +/// Since EFL 1.23. /// public struct Error : IComparable { int code; + /// + /// The error's message. + /// Since EFL 1.23. + /// public string Message { get { return MsgGet(this); } } + /// + /// Unhandled Exception error identifier. + /// Since EFL 1.23. + /// public static Error UNHANDLED_EXCEPTION; + /// + /// No error identifier. + /// Since EFL 1.23. + /// public static Error NO_ERROR = new Error(0); + /// + /// Permission error identifier. + /// Since EFL 1.23. + /// public static Error EPERM = new Error(1); + /// + /// No entity error identifier. + /// Since EFL 1.23. + /// public static Error ENOENT = new Error(2); + /// + /// Cancelled error identifier. + /// Since EFL 1.23. + /// public static Error ECANCELED = new Error(125); + /// + /// Constructor. + /// Since EFL 1.23. + /// + /// The value of the error. public Error(int value) { code = value; } + /// + /// Error identifier conversion from int. + /// Since EFL 1.23. + /// + /// Value to be converted to Error static public implicit operator Error(int val) { return new Error(val); } + /// + /// Int conversion from Error. + /// Since EFL 1.23. + /// + /// Error identifier to be converted to int static public implicit operator int(Error error) { return error.code; } + /// + /// Compare two Errors. + /// Since EFL 1.23. + /// + /// Error to be compared with + /// True with the Errors is equal, False otherwise. public int CompareTo(Error err) { return code.CompareTo(err.code); } + /// + /// Transform the object to a string representing the object. + /// Since EFL 1.23. + /// + /// The string representing the value of this. public override string ToString() { return "Eina.Error(" + code + ")"; @@ -61,16 +110,32 @@ public struct Error : IComparable [DllImport(efl.Libs.Eina)] static extern void eina_error_set(Error error); [DllImport(efl.Libs.Eina)] static extern IntPtr eina_error_msg_get(Error error); + /// + /// Sets the last error. + /// Since EFL 1.23. + /// + /// The error identifier. public static void Set(Error error) { eina_error_set(error); } + /// + /// Returns the last set error. + /// Since EFL 1.23. + /// + /// The last error or NO_ERROR identifier. public static Error Get() { return eina_error_get(); } + /// + /// Returns the description of the given error identifier. + /// Since EFL 1.23. + /// + /// Error identifier. + /// The description of the error. public static String MsgGet(Error error) { IntPtr cstr = eina_error_msg_get(error); @@ -78,7 +143,9 @@ public struct Error : IComparable } /// Raises an exception if an unhandled exception occurred before switching - /// back to the native code. For example, in an event handler. + /// back to the native code. For example, in an event handler. + /// Since EFL 1.23. + /// public static void RaiseIfUnhandledException() { Error e = Get(); @@ -89,6 +156,10 @@ public struct Error : IComparable } } + /// + /// Raises an exception. + /// Since EFL 1.23. + /// public static void Raise(Error e) { if (e != 0) @@ -97,11 +168,21 @@ public struct Error : IComparable } } + /// + /// Set identifier to a NO_ERROR. + /// Since EFL 1.23. + /// public static void Clear() { Set(0); } + /// + /// Registers a new error type. + /// Since EFL 1.23. + /// + /// The description of the error. + /// The unique number identifier for this error. public static Error Register(string msg) { return eina_error_msg_register(msg);