summaryrefslogtreecommitdiff
path: root/src/bindings/mono/eina_mono/eina_list.cs
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2019-04-02 16:51:05 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-04-02 16:57:52 +0200
commit0d37e8ff4989c2c95a392df67b23c889a8cd9406 (patch)
treec82b358784fa6589b4f8c179579d848b671a5432 /src/bindings/mono/eina_mono/eina_list.cs
parent731db8b64403c06c36a27c6a73b13c4b04a9aacd (diff)
mono: fix space and brace warnings of StyleCop
Summary: The following warning rules of StyleCop are checked. Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011 Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513 Indentation is also applied. Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8485
Diffstat (limited to 'src/bindings/mono/eina_mono/eina_list.cs')
-rw-r--r--src/bindings/mono/eina_mono/eina_list.cs24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/bindings/mono/eina_mono/eina_list.cs b/src/bindings/mono/eina_mono/eina_list.cs
index 8ad4a2f..fe95650 100644
--- a/src/bindings/mono/eina_mono/eina_list.cs
+++ b/src/bindings/mono/eina_mono/eina_list.cs
@@ -8,7 +8,8 @@ using static Eina.TraitFunctions;
8using static Eina.ListNativeFunctions; 8using static Eina.ListNativeFunctions;
9using Eina.Callbacks; 9using Eina.Callbacks;
10 10
11namespace Eina { 11namespace Eina
12{
12 13
13public static class ListNativeFunctions 14public static class ListNativeFunctions
14{ 15{
@@ -175,18 +176,22 @@ public class List<T> : IEnumerable<T>, IDisposable
175 IntPtr h = Handle; 176 IntPtr h = Handle;
176 Handle = IntPtr.Zero; 177 Handle = IntPtr.Zero;
177 if (h == IntPtr.Zero) 178 if (h == IntPtr.Zero)
179 {
178 return; 180 return;
181 }
179 182
180 if (OwnContent) 183 if (OwnContent)
181 { 184 {
182 for(IntPtr curr = h; curr != IntPtr.Zero; curr = InternalNext(curr)) 185 for (IntPtr curr = h; curr != IntPtr.Zero; curr = InternalNext(curr))
183 { 186 {
184 NativeFree<T>(InternalDataGet(curr)); 187 NativeFree<T>(InternalDataGet(curr));
185 } 188 }
186 } 189 }
187 190
188 if (Own) 191 if (Own)
192 {
189 eina_list_free(h); 193 eina_list_free(h);
194 }
190 } 195 }
191 196
192 public void Dispose() 197 public void Dispose()
@@ -221,7 +226,7 @@ public class List<T> : IEnumerable<T>, IDisposable
221 226
222 public int Count() 227 public int Count()
223 { 228 {
224 return (int) eina_list_count_custom_export_mono(Handle); 229 return (int)eina_list_count_custom_export_mono(Handle);
225 } 230 }
226 231
227 public void Append(T val) 232 public void Append(T val)
@@ -274,9 +279,15 @@ public class List<T> : IEnumerable<T>, IDisposable
274 { 279 {
275 IntPtr pos = eina_list_nth_list(Handle, (uint)idx); 280 IntPtr pos = eina_list_nth_list(Handle, (uint)idx);
276 if (pos == IntPtr.Zero) 281 if (pos == IntPtr.Zero)
282 {
277 throw new IndexOutOfRangeException(); 283 throw new IndexOutOfRangeException();
284 }
285
278 if (OwnContent) 286 if (OwnContent)
287 {
279 NativeFree<T>(InternalDataGet(pos)); 288 NativeFree<T>(InternalDataGet(pos));
289 }
290
280 IntPtr ele = ManagedToNativeAlloc(val); 291 IntPtr ele = ManagedToNativeAlloc(val);
281 InternalDataSet(pos, ele); 292 InternalDataSet(pos, ele);
282 } 293 }
@@ -314,17 +325,20 @@ public class List<T> : IEnumerable<T>, IDisposable
314 { 325 {
315 var managed = new T[Count()]; 326 var managed = new T[Count()];
316 int i = 0; 327 int i = 0;
317 for(IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr), ++i) 328 for (IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr), ++i)
318 { 329 {
319 managed[i] = NativeToManaged<T>(InternalDataGet(curr)); 330 managed[i] = NativeToManaged<T>(InternalDataGet(curr));
320 } 331 }
332
321 return managed; 333 return managed;
322 } 334 }
323 335
324 public void AppendArray(T[] values) 336 public void AppendArray(T[] values)
325 { 337 {
326 foreach (T v in values) 338 foreach (T v in values)
339 {
327 Append(v); 340 Append(v);
341 }
328 } 342 }
329 343
330 344
@@ -340,7 +354,7 @@ public class List<T> : IEnumerable<T>, IDisposable
340 354
341 public IEnumerator<T> GetEnumerator() 355 public IEnumerator<T> GetEnumerator()
342 { 356 {
343 for(IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr)) 357 for (IntPtr curr = Handle; curr != IntPtr.Zero; curr = InternalNext(curr))
344 { 358 {
345 yield return NativeToManaged<T>(InternalDataGet(curr)); 359 yield return NativeToManaged<T>(InternalDataGet(curr));
346 } 360 }