Merge
[awesomized/libmemcached] / libmemcached / memcached_string.h
1 /*
2 * Summary: String structure used for libmemcached.
3 *
4 * Copy: See Copyright for the status of this software.
5 *
6 * Author: Brian Aker
7 */
8
9 #ifndef __MEMCACHED_STRING_H__
10 #define __MEMCACHED_STRING_H__
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 struct memcached_string_st {
17 memcached_st *root;
18 memcached_allocated is_allocated;
19 char *end;
20 size_t current_size;
21 size_t block_size;
22 char *string;
23 };
24
25 #define memcached_string_length(A) (size_t)((A)->end - (A)->string)
26 #define memcached_string_set_length(A, B) (A)->end= (A)->string + B
27 #define memcached_string_size(A) (A)->current_size
28 #define memcached_string_value(A) (A)->string
29
30 memcached_string_st *memcached_string_create(memcached_st *ptr,
31 memcached_string_st *string,
32 size_t initial_size);
33 memcached_return memcached_string_check(memcached_string_st *string, size_t need);
34 char *memcached_string_c_copy(memcached_string_st *string);
35 memcached_return memcached_string_append_character(memcached_string_st *string,
36 char character);
37 memcached_return memcached_string_append(memcached_string_st *string,
38 char *value, size_t length);
39 size_t memcached_string_backspace(memcached_string_st *string, size_t remove);
40 memcached_return memcached_string_reset(memcached_string_st *string);
41 void memcached_string_free(memcached_string_st *string);
42
43 #ifdef __cplusplus
44 }
45 #endif
46
47 #endif /* __MEMCACHED_STRING_H__ */