ICC fix
[m6w6/libmemcached] / libmemcached / string.h
1 /* LibMemcached
2 * Copyright (C) 2006-2009 Brian Aker
3 * All rights reserved.
4 *
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
7 *
8 * Summary: String structure used for libmemcached.
9 *
10 */
11
12 #ifndef __MEMCACHED_STRING_H__
13 #define __MEMCACHED_STRING_H__
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 struct memcached_string_st {
20 memcached_st *root;
21 char *end;
22 char *string;
23 size_t current_size;
24 size_t block_size;
25 struct {
26 bool is_allocated:1;
27 bool is_initialized:1;
28 } options;
29 };
30
31 #define memcached_string_length(A) (size_t)((A)->end - (A)->string)
32 #define memcached_string_set_length(A, B) (A)->end= (A)->string + B
33 #define memcached_string_size(A) (A)->current_size
34 #define memcached_string_value(A) (A)->string
35
36 LIBMEMCACHED_API
37 memcached_string_st *memcached_string_create(memcached_st *ptr,
38 memcached_string_st *string,
39 size_t initial_size);
40 LIBMEMCACHED_API
41 memcached_return_t memcached_string_check(memcached_string_st *string, size_t need);
42
43 LIBMEMCACHED_API
44 char *memcached_string_c_copy(memcached_string_st *string);
45
46 LIBMEMCACHED_API
47 memcached_return_t memcached_string_append_character(memcached_string_st *string,
48 char character);
49 LIBMEMCACHED_API
50 memcached_return_t memcached_string_append(memcached_string_st *string,
51 const char *value, size_t length);
52 LIBMEMCACHED_API
53 memcached_return_t memcached_string_reset(memcached_string_st *string);
54
55 LIBMEMCACHED_API
56 void memcached_string_free(memcached_string_st *string);
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif /* __MEMCACHED_STRING_H__ */