summaryrefslogtreecommitdiff
path: root/src/bindings/mono/eina_mono/eina_binbuf.cs
diff options
context:
space:
mode:
authorBruno da Silva Belo <brunodasilvabelo@gmail.com>2019-09-30 23:14:46 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-09-30 23:15:27 -0300
commit33f5167089402c0ff52f13619e648ff267a07f42 (patch)
tree7bd237f00e37bb3ae86af538ac5fa5b0a24f2bcc /src/bindings/mono/eina_mono/eina_binbuf.cs
parent0194ba8420fde2bbcfce0ea35adb200c76b7fc00 (diff)
mono_docs:adding and updating eina_binbuf.cs.
Summary: Generating docs and setting to 1.23. Reviewers: lauromoura, felipealmeida Reviewed By: felipealmeida Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8293 Differential Revision: https://phab.enlightenment.org/D10252
Diffstat (limited to 'src/bindings/mono/eina_mono/eina_binbuf.cs')
-rw-r--r--src/bindings/mono/eina_mono/eina_binbuf.cs106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/bindings/mono/eina_mono/eina_binbuf.cs b/src/bindings/mono/eina_mono/eina_binbuf.cs
index e5dc817..3dcda65 100644
--- a/src/bindings/mono/eina_mono/eina_binbuf.cs
+++ b/src/bindings/mono/eina_mono/eina_binbuf.cs
@@ -6,6 +6,9 @@ using System.Runtime.InteropServices;
6namespace Eina 6namespace Eina
7{ 7{
8 8
9/// <summary>
10/// A Generic buffer designed to be a mutable string (SINCE EFL 1.23).
11/// </summary>
9public class Binbuf : IDisposable 12public class Binbuf : IDisposable
10{ 13{
11 [DllImport(efl.Libs.Eina)] public static extern IntPtr 14 [DllImport(efl.Libs.Eina)] public static extern IntPtr
@@ -39,9 +42,12 @@ public class Binbuf : IDisposable
39 [DllImport(efl.Libs.Eina)] public static extern Eina.Slice 42 [DllImport(efl.Libs.Eina)] public static extern Eina.Slice
40 eina_binbuf_slice_get(IntPtr buf); 43 eina_binbuf_slice_get(IntPtr buf);
41 44
45 /// <summary>Pointer to the native buffer.</summary>
42 public IntPtr Handle {get;set;} = IntPtr.Zero; 46 public IntPtr Handle {get;set;} = IntPtr.Zero;
47 ///<summary>Whether this wrapper owns the native buffer.</summary>
43 public bool Own {get;set;} 48 public bool Own {get;set;}
44 49
50 /// <summary> Length of the buffer.</summary>
45 public int Length 51 public int Length
46 { 52 {
47 get { return (int)GetLength(); } 53 get { return (int)GetLength(); }
@@ -57,6 +63,9 @@ public class Binbuf : IDisposable
57 } 63 }
58 } 64 }
59 65
66 /// <summary>
67 /// Create a new buffer.
68 /// </summary>
60 public Binbuf() 69 public Binbuf()
61 { 70 {
62 InitNew(); 71 InitNew();
@@ -76,6 +85,10 @@ public class Binbuf : IDisposable
76 } 85 }
77 } 86 }
78 87
88 /// <summary>
89 /// Create a new buffer with elements.
90 /// </summary>
91 ///// <param name="bb">Elements to initialize the new buffer.</param>
79 public Binbuf(Binbuf bb) 92 public Binbuf(Binbuf bb)
80 { 93 {
81 InitNew(); 94 InitNew();
@@ -86,6 +99,11 @@ public class Binbuf : IDisposable
86 } 99 }
87 } 100 }
88 101
102 /// <summary>
103 /// Create a new buffer.
104 /// </summary>
105 ///// <param name="handle">The native handle to be wrapped.</param>
106 ///// <param name="own">Whether this wrapper owns the native handle.</param>
89 public Binbuf(IntPtr handle, bool own) 107 public Binbuf(IntPtr handle, bool own)
90 { 108 {
91 Handle = handle; 109 Handle = handle;
@@ -97,6 +115,9 @@ public class Binbuf : IDisposable
97 Dispose(false); 115 Dispose(false);
98 } 116 }
99 117
118 /// <summary>Disposes of this wrapper, releasing the native buffer if owned.</summary>
119 /// <param name="disposing">True if this was called from <see cref="Dispose()"/> public method. False if
120 /// called from the C# finalizer.</param>
100 protected virtual void Dispose(bool disposing) 121 protected virtual void Dispose(bool disposing)
101 { 122 {
102 IntPtr h = Handle; 123 IntPtr h = Handle;
@@ -114,17 +135,23 @@ public class Binbuf : IDisposable
114 } 135 }
115 } 136 }
116 137
138 /// <summary>Releases the native resources held by this instance.</summary>
117 public void Dispose() 139 public void Dispose()
118 { 140 {
119 Dispose(true); 141 Dispose(true);
120 GC.SuppressFinalize(this); 142 GC.SuppressFinalize(this);
121 } 143 }
122 144
145 /// <summary>Releases the native resources held by this instance.</summary>
123 public void Free() 146 public void Free()
124 { 147 {
125 Dispose(); 148 Dispose();
126 } 149 }
127 150
151 /// <summary>
152 /// Releases the native buffer.
153 /// </summary>
154 /// <returns>The native buffer.</returns>
128 public IntPtr Release() 155 public IntPtr Release()
129 { 156 {
130 IntPtr h = Handle; 157 IntPtr h = Handle;
@@ -132,61 +159,127 @@ public class Binbuf : IDisposable
132 return h; 159 return h;
133 } 160 }
134 161
162 /// <summary>
163 /// Resets the buffer.
164 /// </summary>
135 public void Reset() 165 public void Reset()
136 { 166 {
137 eina_binbuf_reset(Handle); 167 eina_binbuf_reset(Handle);
138 } 168 }
139 169
170 /// <summary>
171 /// Appends a string of inputed buffer's length to the buffer, reallocating as necessary.
172 /// </summary>
173 ///// <param name="str">The string buffer.</param>
174 /// <returns>true on success, false if data could not be appended.</returns>
140 public bool Append(byte[] str) 175 public bool Append(byte[] str)
141 { 176 {
142 return 0 != eina_binbuf_append_length(Handle, str, (UIntPtr)(str.Length)); 177 return 0 != eina_binbuf_append_length(Handle, str, (UIntPtr)(str.Length));
143 } 178 }
144 179
180 /// <summary>
181 /// Appends a string of exact length to the buffer, reallocating as necessary.
182 /// </summary>
183 ///// <param name="str">The string buffer.</param>
184 ///// <param name="length">The exact length to use.</param>
185 /// <returns>true on success, false if data could not be appended.</returns>
145 public bool Append(byte[] str, uint length) 186 public bool Append(byte[] str, uint length)
146 { 187 {
147 return 0 != eina_binbuf_append_length(Handle, str, (UIntPtr)length); 188 return 0 != eina_binbuf_append_length(Handle, str, (UIntPtr)length);
148 } 189 }
149 190
191 /// <summary>
192 /// Appends a Binbuf to the buffer.
193 /// </summary>
194 ///// <param name="bb">The buffer to be appended.</param>
195 /// <returns>true on success, false if data could not be appended.</returns>
150 public bool Append(Binbuf bb) 196 public bool Append(Binbuf bb)
151 { 197 {
152 return 0 != eina_binbuf_append_buffer(Handle, bb.Handle); 198 return 0 != eina_binbuf_append_buffer(Handle, bb.Handle);
153 } 199 }
154 200
201 /// <summary>
202 /// Appends a character to the buffer, reallocating as necessary.
203 /// </summary>
204 ///// <param name="c">The char to appended.</param>
205 /// <returns>true on success, false if data could not be appended.</returns>
155 public bool Append(byte c) 206 public bool Append(byte c)
156 { 207 {
157 return 0 != eina_binbuf_append_char(Handle, c); 208 return 0 != eina_binbuf_append_char(Handle, c);
158 } 209 }
159 210
211 /// <summary>
212 /// Appends a slice to the buffer, reallocating as necessary.
213 /// </summary>
214 ///// <param name="slice">The slice to appended.</param>
215 /// <returns>true on success, false if data could not be appended.</returns>
160 public bool Append(Eina.Slice slice) 216 public bool Append(Eina.Slice slice)
161 { 217 {
162 return 0 != eina_binbuf_append_slice(Handle, slice); 218 return 0 != eina_binbuf_append_slice(Handle, slice);
163 } 219 }
164 220
221 /// <summary>
222 /// Inserts a string of inputed buffer's length into the buffer, reallocating as necessary.
223 /// </summary>
224 ///// <param name="str">The string buffer.</param>
225 ///// <param name="pos">The position to insert the string.</param>
226 /// <returns>true on success, false if data could not be appended.</returns>
165 public bool Insert(byte[] str, uint pos) 227 public bool Insert(byte[] str, uint pos)
166 { 228 {
167 return 0 != eina_binbuf_insert_length(Handle, str, (UIntPtr)(str.Length), (UIntPtr)pos); 229 return 0 != eina_binbuf_insert_length(Handle, str, (UIntPtr)(str.Length), (UIntPtr)pos);
168 } 230 }
169 231
232 /// <summary>
233 /// Inserts a string of exact length into the buffer, reallocating as necessary.
234 /// </summary>
235 ///// <param name="str">The string buffer.</param>
236 ///// <param name="length">The exact length to use.</param>
237 ///// <param name="pos">The position to insert the string.</param>
238 /// <returns>true on success, false if data could not be appended.</returns>
170 public bool Insert(byte[] str, uint length, uint pos) 239 public bool Insert(byte[] str, uint length, uint pos)
171 { 240 {
172 return 0 != eina_binbuf_insert_length(Handle, str, (UIntPtr)length, (UIntPtr)pos); 241 return 0 != eina_binbuf_insert_length(Handle, str, (UIntPtr)length, (UIntPtr)pos);
173 } 242 }
174 243
244 /// <summary>
245 /// Inserts a character into the buffer, reallocating as necessary.
246 /// </summary>
247 ///// <param name="c">The char to appended.</param>
248 ///// <param name="pos">The position to insert the string.</param>
249 /// <returns>true on success, false if data could not be appended.</returns>
175 public bool Insert(byte c, uint pos) 250 public bool Insert(byte c, uint pos)
176 { 251 {
177 return 0 != eina_binbuf_insert_char(Handle, c, (UIntPtr)pos); 252 return 0 != eina_binbuf_insert_char(Handle, c, (UIntPtr)pos);
178 } 253 }
179 254
255 /// <summary>
256 /// Inserts a slice into the buffer, reallocating as necessary.
257 /// </summary>
258 ///// <param name="slice">The slice to appended.</param>
259 ///// <param name="pos">The position to insert the string.</param>
260 /// <returns>true on success, false if data could not be appended.</returns>
180 public bool Insert(Eina.Slice slice, uint pos) 261 public bool Insert(Eina.Slice slice, uint pos)
181 { 262 {
182 return 0 != eina_binbuf_insert_slice(Handle, slice, (UIntPtr)pos); 263 return 0 != eina_binbuf_insert_slice(Handle, slice, (UIntPtr)pos);
183 } 264 }
184 265
266 /// <summary>
267 /// Removes a slice of the buffer.
268 /// </summary>
269 ///// <param name="start">The initial (inclusive) slice position to start
270 ///// removing, in bytes.</param>
271 ///// <param name="end">The final (non-inclusive) slice position to finish
272 ///// removing, in bytes..</param>
273 /// <returns>true on success, false on failure.</returns>
185 public bool Remove(uint start, uint end) 274 public bool Remove(uint start, uint end)
186 { 275 {
187 return 0 != eina_binbuf_remove(Handle, (UIntPtr)start, (UIntPtr)end); 276 return 0 != eina_binbuf_remove(Handle, (UIntPtr)start, (UIntPtr)end);
188 } 277 }
189 278
279 /// <summary>
280 /// Retrieves a string to the contents of the buffer.
281 /// </summary>
282 /// <returns>The string that is contained in buffer.</returns>
190 public byte[] GetBytes() 283 public byte[] GetBytes()
191 { 284 {
192 var ptr = eina_binbuf_string_get(Handle); 285 var ptr = eina_binbuf_string_get(Handle);
@@ -201,21 +294,34 @@ public class Binbuf : IDisposable
201 return mArray; 294 return mArray;
202 } 295 }
203 296
297 /// <summary>
298 /// Retrieves a string to the contents of the buffer.
299 /// </summary>
300 /// <returns>The string that is contained in buffer.</returns>
204 public IntPtr GetStringNative() 301 public IntPtr GetStringNative()
205 { 302 {
206 return eina_binbuf_string_get(Handle); 303 return eina_binbuf_string_get(Handle);
207 } 304 }
208 305
306 /// <summary>
307 /// Frees the buffer.
308 /// </summary>
209 public void FreeString() 309 public void FreeString()
210 { 310 {
211 eina_binbuf_string_free(Handle); 311 eina_binbuf_string_free(Handle);
212 } 312 }
213 313
314 /// <summary>
315 /// Retrieves the length of the buffer's contents.
316 /// </summary>
214 public UIntPtr GetLength() 317 public UIntPtr GetLength()
215 { 318 {
216 return eina_binbuf_length_get(Handle); 319 return eina_binbuf_length_get(Handle);
217 } 320 }
218 321
322 /// <summary>
323 /// Gets a slice of the buffer's contents.
324 /// </summary>
219 Eina.Slice GetSlice() 325 Eina.Slice GetSlice()
220 { 326 {
221 return eina_binbuf_slice_get(Handle); 327 return eina_binbuf_slice_get(Handle);