1/*
2 * Copyright (c) 2009-2012 Petri Lehtinen <petri@digip.org>
3 *
4 * Jansson is free software; you can redistribute it and/or modify
5 * it under the terms of the MIT license. See LICENSE for details.
6 */
7
8#ifndef STRBUFFER_H
9#define STRBUFFER_H
10
11typedef struct {
12 char *value;
13 size_t length; /* bytes used */
14 size_t size; /* bytes allocated */
15} strbuffer_t;
16
17int strbuffer_init(strbuffer_t *strbuff);
18void strbuffer_close(strbuffer_t *strbuff);
19
20void strbuffer_clear(strbuffer_t *strbuff);
21
22const char *strbuffer_value(const strbuffer_t *strbuff);
23char *strbuffer_steal_value(strbuffer_t *strbuff);
24
25int strbuffer_append(strbuffer_t *strbuff, const char *string);
26int strbuffer_append_byte(strbuffer_t *strbuff, char byte);
27int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size);
28
29char strbuffer_pop(strbuffer_t *strbuff);
30
31#endif
32