| 127 * If the #CX_BUFFER_FREE_CONTENTS feature is enabled, the contents of the buffer |
127 * If the #CX_BUFFER_FREE_CONTENTS feature is enabled, the contents of the buffer |
| 128 * are also freed. |
128 * are also freed. |
| 129 * |
129 * |
| 130 * @param buffer the buffer to destroy |
130 * @param buffer the buffer to destroy |
| 131 */ |
131 */ |
| 132 void cxBufferDestroy(CxBuffer buffer); |
132 void cxBufferDestroy(CxBuffer *buffer); |
| 133 |
133 |
| 134 /** |
134 /** |
| 135 * Creates a new buffer and fills it with content copied from another buffer. |
135 * Creates a new buffer and fills it with content copied from another buffer. |
| 136 * |
136 * |
| 137 * \note The #CX_BUFFER_FREE_CONTENTS feature is enforced for the new buffer. |
137 * \note The #CX_BUFFER_FREE_CONTENTS feature is enforced for the new buffer. |
| 140 * @param start the start position of extraction |
140 * @param start the start position of extraction |
| 141 * @param length the count of bytes to extract (must not be zero) |
141 * @param length the count of bytes to extract (must not be zero) |
| 142 * @param flags features for the new buffer (#CX_BUFFER_FREE_CONTENTS will always be enabled) |
142 * @param flags features for the new buffer (#CX_BUFFER_FREE_CONTENTS will always be enabled) |
| 143 * @return a new buffer containing the extraction |
143 * @return a new buffer containing the extraction |
| 144 */ |
144 */ |
| 145 CxBuffer cxBufferExtract( |
145 CxBuffer *cxBufferExtract( |
| 146 CxBuffer src, |
146 CxBuffer *src, |
| 147 size_t start, |
147 size_t start, |
| 148 size_t length, |
148 size_t length, |
| 149 int flags |
149 int flags |
| 150 ); |
150 ); |
| 151 |
151 |
| 205 * @param shift the shift offset |
205 * @param shift the shift offset |
| 206 * @return 0 on success, non-zero if a required auto-extension fails |
206 * @return 0 on success, non-zero if a required auto-extension fails |
| 207 * @see cxBufferShift() |
207 * @see cxBufferShift() |
| 208 */ |
208 */ |
| 209 int cxBufferShiftRight( |
209 int cxBufferShiftRight( |
| 210 CxBuffer buffer, |
210 CxBuffer *buffer, |
| 211 size_t shift |
211 size_t shift |
| 212 ); |
212 ); |
| 213 |
213 |
| 214 /** |
214 /** |
| 215 * Shifts the buffer to the left. |
215 * Shifts the buffer to the left. |
| 269 * |
269 * |
| 270 * @param buffer the buffer to test |
270 * @param buffer the buffer to test |
| 271 * @return non-zero, if the current buffer position has exceeded the last |
271 * @return non-zero, if the current buffer position has exceeded the last |
| 272 * available byte of the buffer. |
272 * available byte of the buffer. |
| 273 */ |
273 */ |
| 274 int cxBufferEof(CxBuffer buffer); |
274 int cxBufferEof(CxBuffer *buffer); |
| 275 |
275 |
| 276 |
276 |
| 277 /** |
277 /** |
| 278 * Ensures that the buffer has a minimum capacity. |
278 * Ensures that the buffer has a minimum capacity. |
| 279 * |
279 * |
| 282 * @param buffer the buffer |
282 * @param buffer the buffer |
| 283 * @param capacity the minimum required capacity for this buffer |
283 * @param capacity the minimum required capacity for this buffer |
| 284 * @return 0 on success or a non-zero value on failure |
284 * @return 0 on success or a non-zero value on failure |
| 285 */ |
285 */ |
| 286 int cxBufferMinimumCapacity( |
286 int cxBufferMinimumCapacity( |
| 287 CxBuffer buffer, |
287 CxBuffer *buffer, |
| 288 size_t capacity |
288 size_t capacity |
| 289 ); |
289 ); |
| 290 |
290 |
| 291 /** |
291 /** |
| 292 * Writes data to a CxBuffer. |
292 * Writes data to a CxBuffer. |
| 354 * The current position of the buffer is increased after a successful read. |
354 * The current position of the buffer is increased after a successful read. |
| 355 * |
355 * |
| 356 * @param buffer the buffer to read from |
356 * @param buffer the buffer to read from |
| 357 * @return the character or \c EOF, if the end of the buffer is reached |
357 * @return the character or \c EOF, if the end of the buffer is reached |
| 358 */ |
358 */ |
| 359 int cxBufferGet(CxBuffer buffer); |
359 int cxBufferGet(CxBuffer *buffer); |
| 360 |
360 |
| 361 /** |
361 /** |
| 362 * Writes a string to a buffer. |
362 * Writes a string to a buffer. |
| 363 * |
363 * |
| 364 * @param buffer the buffer |
364 * @param buffer the buffer |
| 365 * @param str the zero-terminated string |
365 * @param str the zero-terminated string |
| 366 * @return the number of bytes written |
366 * @return the number of bytes written |
| 367 */ |
367 */ |
| 368 size_t cxBufferPutString( |
368 size_t cxBufferPutString( |
| 369 CxBuffer buffer, |
369 CxBuffer *buffer, |
| 370 const char *str |
370 const char *str |
| 371 ); |
371 ); |
| 372 |
372 |
| 373 #ifdef __cplusplus |
373 #ifdef __cplusplus |
| 374 } |
374 } |