summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno da Silva Belo <brunodasilvabelo@gmail.com>2019-10-14 11:36:25 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-14 11:40:19 -0300
commite4385c084cd726667817742fb21d318a38a21acc (patch)
tree315926c20e90e4cf7e8868666c21b40996f71622
parent3be9b6a12977b8cb550ab1f44b74d5e86b251014 (diff)
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
-rw-r--r--src/bindings/mono/eina_mono/eina_error.cs87
1 files 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
7{ 7{
8 8
9/// <summary>Error codes from native Eina methods. 9/// <summary>Error codes from native Eina methods.
10/// 10/// <para>Since EFL 1.23.</para>
11/// Since EFL 1.23.
12/// </summary> 11/// </summary>
13public struct Error : IComparable<Error> 12public struct Error : IComparable<Error>
14{ 13{
15 int code; 14 int code;
16 15
16 /// <summary>
17 /// The error's message.
18 /// <para>Since EFL 1.23.</para>
19 /// </summary>
17 public string Message 20 public string Message
18 { 21 {
19 get { return MsgGet(this); } 22 get { return MsgGet(this); }
20 } 23 }
21 24
25 /// <summary>
26 /// Unhandled Exception error identifier.
27 /// <para>Since EFL 1.23.</para>
28 /// </summary>
22 public static Error UNHANDLED_EXCEPTION; 29 public static Error UNHANDLED_EXCEPTION;
23 30
31 /// <summary>
32 /// No error identifier.
33 /// <para>Since EFL 1.23.</para>
34 /// </summary>
24 public static Error NO_ERROR = new Error(0); 35 public static Error NO_ERROR = new Error(0);
36 /// <summary>
37 /// Permission error identifier.
38 /// <para>Since EFL 1.23.</para>
39 /// </summary>
25 public static Error EPERM = new Error(1); 40 public static Error EPERM = new Error(1);
41 /// <summary>
42 /// No entity error identifier.
43 /// <para>Since EFL 1.23.</para>
44 /// </summary>
26 public static Error ENOENT = new Error(2); 45 public static Error ENOENT = new Error(2);
46 /// <summary>
47 /// Cancelled error identifier.
48 /// <para>Since EFL 1.23.</para>
49 /// </summary>
27 public static Error ECANCELED = new Error(125); 50 public static Error ECANCELED = new Error(125);
28 51
52 /// <summary>
53 /// Constructor.
54 /// <para>Since EFL 1.23.</para>
55 /// </summary>
56 /// <param name="value">The value of the error.</param>
29 public Error(int value) 57 public Error(int value)
30 { 58 {
31 code = value; 59 code = value;
32 } 60 }
33 61
62 /// <summary>
63 /// Error identifier conversion from int.
64 /// <para>Since EFL 1.23.</para>
65 /// </summary>
66 /// <param name="val">Value to be converted to Error</param>
34 static public implicit operator Error(int val) 67 static public implicit operator Error(int val)
35 { 68 {
36 return new Error(val); 69 return new Error(val);
37 } 70 }
38 71
72 /// <summary>
73 /// Int conversion from Error.
74 /// <para>Since EFL 1.23.</para>
75 /// </summary>
76 /// <param name="error">Error identifier to be converted to int</param>
39 static public implicit operator int(Error error) 77 static public implicit operator int(Error error)
40 { 78 {
41 return error.code; 79 return error.code;
42 } 80 }
43 81
82 /// <summary>
83 /// Compare two Errors.
84 /// <para>Since EFL 1.23.</para>
85 /// </summary>
86 /// <param name="err">Error to be compared with</param>
87 /// <returns>True with the Errors is equal, False otherwise.</returns>
44 public int CompareTo(Error err) 88 public int CompareTo(Error err)
45 { 89 {
46 return code.CompareTo(err.code); 90 return code.CompareTo(err.code);
47 } 91 }
48 92
93 /// <summary>
94 /// Transform the object to a string representing the object.
95 /// <para>Since EFL 1.23.</para>
96 /// </summary>
97 /// <returns>The string representing the value of this.</returns>
49 public override string ToString() 98 public override string ToString()
50 { 99 {
51 return "Eina.Error(" + code + ")"; 100 return "Eina.Error(" + code + ")";
@@ -61,16 +110,32 @@ public struct Error : IComparable<Error>
61 [DllImport(efl.Libs.Eina)] static extern void eina_error_set(Error error); 110 [DllImport(efl.Libs.Eina)] static extern void eina_error_set(Error error);
62 [DllImport(efl.Libs.Eina)] static extern IntPtr eina_error_msg_get(Error error); 111 [DllImport(efl.Libs.Eina)] static extern IntPtr eina_error_msg_get(Error error);
63 112
113 /// <summary>
114 /// Sets the last error.
115 /// <para>Since EFL 1.23.</para>
116 /// </summary>
117 /// <param name="error">The error identifier.</param>
64 public static void Set(Error error) 118 public static void Set(Error error)
65 { 119 {
66 eina_error_set(error); 120 eina_error_set(error);
67 } 121 }
68 122
123 /// <summary>
124 /// Returns the last set error.
125 /// <para>Since EFL 1.23.</para>
126 /// </summary>
127 /// <returns>The last error or NO_ERROR identifier.</returns>
69 public static Error Get() 128 public static Error Get()
70 { 129 {
71 return eina_error_get(); 130 return eina_error_get();
72 } 131 }
73 132
133 /// <summary>
134 /// Returns the description of the given error identifier.
135 /// <para>Since EFL 1.23.</para>
136 /// </summary>
137 /// <param name="error">Error identifier.</param>
138 /// <returns>The description of the error.</returns>
74 public static String MsgGet(Error error) 139 public static String MsgGet(Error error)
75 { 140 {
76 IntPtr cstr = eina_error_msg_get(error); 141 IntPtr cstr = eina_error_msg_get(error);
@@ -78,7 +143,9 @@ public struct Error : IComparable<Error>
78 } 143 }
79 144
80 /// <summary>Raises an exception if an unhandled exception occurred before switching 145 /// <summary>Raises an exception if an unhandled exception occurred before switching
81 /// back to the native code. For example, in an event handler.</summary> 146 /// back to the native code. For example, in an event handler.
147 /// <para>Since EFL 1.23.</para>
148 /// </summary>
82 public static void RaiseIfUnhandledException() 149 public static void RaiseIfUnhandledException()
83 { 150 {
84 Error e = Get(); 151 Error e = Get();
@@ -89,6 +156,10 @@ public struct Error : IComparable<Error>
89 } 156 }
90 } 157 }
91 158
159 /// <summary>
160 /// Raises an exception.
161 /// <para>Since EFL 1.23.</para>
162 /// </summary>
92 public static void Raise(Error e) 163 public static void Raise(Error e)
93 { 164 {
94 if (e != 0) 165 if (e != 0)
@@ -97,11 +168,21 @@ public struct Error : IComparable<Error>
97 } 168 }
98 } 169 }
99 170
171 /// <summary>
172 /// Set identifier to a NO_ERROR.
173 /// <para>Since EFL 1.23.</para>
174 /// </summary>
100 public static void Clear() 175 public static void Clear()
101 { 176 {
102 Set(0); 177 Set(0);
103 } 178 }
104 179
180 /// <summary>
181 /// Registers a new error type.
182 /// <para>Since EFL 1.23.</para>
183 /// </summary>
184 /// <param name="msg"> The description of the error.</param>
185 /// <returns>The unique number identifier for this error.</returns>
105 public static Error Register(string msg) 186 public static Error Register(string msg)
106 { 187 {
107 return eina_error_msg_register(msg); 188 return eina_error_msg_register(msg);