00001
00002
00003 #ifndef _U_LIBU_BUF_H_
00004 #define _U_LIBU_BUF_H_
00005
00006 #include <stdlib.h>
00007 #include <unistd.h>
00008 #include <stdio.h>
00009 #include <stdarg.h>
00010
00011 #ifdef __cplusplus
00012 extern "C" {
00013 #endif
00014
00015 struct u_buf_s
00016 {
00017 char *data;
00018 size_t size, len;
00019 };
00020
00021 typedef struct u_buf_s u_buf_t;
00022
00023 int u_buf_append(u_buf_t *buf, const void *data, size_t size);
00024 int u_buf_clear(u_buf_t *buf);
00025 int u_buf_detach(u_buf_t *buf);
00026 int u_buf_set(u_buf_t *buf, const void *data, size_t size);
00027 int u_buf_load(u_buf_t *buf, const char *fqn);
00028 int u_buf_free(u_buf_t *buf);
00029 int u_buf_create(u_buf_t **pbuf);
00030 int u_buf_reserve(u_buf_t *buf, size_t size);
00031 void* u_buf_ptr(u_buf_t *buf);
00032 size_t u_buf_len(u_buf_t *buf);
00033 size_t u_buf_size(u_buf_t *buf);
00034 int u_buf_printf(u_buf_t *ubuf, const char *fmt, ...);
00035
00036 #ifdef __cplusplus
00037 }
00038 #endif
00039
00040 #endif