50 #include <sys/types.h> 60 #define UCX_BUFFER_DEFAULT 0x00 65 #define UCX_BUFFER_AUTOFREE 0x01 70 #define UCX_BUFFER_AUTOEXTEND 0x02 128 size_t start,
size_t length,
int flags);
137 #define ucx_buffer_clone(src,flags) \ 138 ucx_buffer_extract(src, 0, (src)->capacity, flags) 229 #define ucx_buffer_clear(buffer) memset((buffer)->space, 0, (buffer)->size); \ 230 (buffer)->size = 0; (buffer)->pos = 0; 332 #define ucx_buffer_to_sstr(buffer) sstrn((buffer)->space, (buffer)->size) int flags
Flag register for buffer features.
Definition: buffer.h:88
int ucx_buffer_seek(UcxBuffer *buffer, off_t offset, int whence)
Moves the position of the buffer.
Definition: buffer.c:90
size_t ucx_buffer_read(void *ptr, size_t size, size_t nitems, UcxBuffer *buffer)
Reads data from a UcxBuffer.
Definition: buffer.c:189
int ucx_buffer_shift_left(UcxBuffer *buffer, size_t shift)
Shifts the buffer to the left.
Definition: buffer.c:244
Main UCX Header providing most common definitions.
int ucx_buffer_extend(UcxBuffer *buffer, size_t additional_bytes)
Extends the capacity of the buffer.
Definition: buffer.c:126
void ucx_buffer_free(UcxBuffer *buffer)
Destroys a buffer.
Definition: buffer.c:59
size_t pos
Current position of the buffer.
Definition: buffer.h:77
size_t ucx_buffer_write(const void *ptr, size_t size, size_t nitems, UcxBuffer *buffer)
Writes data to a UcxBuffer.
Definition: buffer.c:152
size_t capacity
Current capacity (i.e.
Definition: buffer.h:79
char * space
A pointer to the buffer contents.
Definition: buffer.h:75
int ucx_buffer_eof(UcxBuffer *buffer)
Tests, if the buffer position has exceeded the buffer capacity.
Definition: buffer.c:122
UCX Buffer.
Definition: buffer.h:73
size_t ucx_buffer_puts(UcxBuffer *buffer, const char *str)
Writes a string to a buffer.
Definition: buffer.c:240
int ucx_buffer_putc(UcxBuffer *buffer, int c)
Writes a character to a buffer.
Definition: buffer.c:210
int ucx_buffer_shift(UcxBuffer *buffer, off_t shift)
Shifts the contents of the buffer by the given offset.
Definition: buffer.c:289
UcxBuffer * ucx_buffer_new(void *space, size_t capacity, int flags)
Creates a new buffer.
Definition: buffer.c:35
UcxBuffer * ucx_buffer_extract(UcxBuffer *src, size_t start, size_t length, int flags)
Creates a new buffer and fills it with extracted content from another buffer.
Definition: buffer.c:66
size_t size
Current size of the buffer content.
Definition: buffer.h:81
int ucx_buffer_getc(UcxBuffer *buffer)
Gets a character from a buffer.
Definition: buffer.c:230
int ucx_buffer_shift_right(UcxBuffer *buffer, size_t shift)
Shifts the buffer to the right.
Definition: buffer.c:260