]> mj.ucw.cz Git - libucw.git/blob - ucw/bbuf.h
ABI: Symbol renames for libucw and libcharset
[libucw.git] / ucw / bbuf.h
1 /*
2  *      UCW Library -- A simple growing buffer for byte-sized items.
3  *
4  *      (c) 2004 Martin Mares <mj@ucw.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU Lesser General Public License.
8  */
9
10 #ifndef _UCW_BBUF_H
11 #define _UCW_BBUF_H
12
13 #ifdef CONFIG_UCW_CLEAN_ABI
14 #define bb_printf ucw_bb_printf
15 #define bb_printf_at ucw_bb_printf_at
16 #define bb_vprintf ucw_bb_vprintf
17 #define bb_vprintf_at ucw_bb_vprintf_at
18 #endif
19
20 #define GBUF_TYPE       byte
21 #define GBUF_PREFIX(x)  bb_##x
22 #include <ucw/gbuf.h>
23
24 /**
25  * printf() into a growing buffer with `va_list` arguments.
26  * Generates a `'\0'`-terminated string at the beginning of the buffer
27  * and returns pointer to it.
28  *
29  * See @bb_printf().
30  **/
31 char *bb_vprintf(bb_t *bb, const char *fmt, va_list args);
32 /**
33  * printf() into a growing buffer.
34  * Generates a `'\0'`-terminated string at the beginning of the buffer
35  * and returns pointer to it.
36  *
37  * See @bb_vprintf().
38  **/
39 char *bb_printf(bb_t *bb, const char *fmt, ...);
40 /**
41  * Like @bb_vprintf(), but it does not start at the beginning of the
42  * buffer, but @ofs bytes further.
43  *
44  * Returns pointer to the new string (eg. @ofs bytes after the
45  * beginning of buffer).
46  **/
47 char *bb_vprintf_at(bb_t *bb, uns ofs, const char *fmt, va_list args);
48 /**
49  * Like @bb_vprintf_at(), but it takes individual arguments.
50  **/
51 char *bb_printf_at(bb_t *bb, uns ofs, const char *fmt, ...);
52
53 #endif