This is Unofficial EPICS BASE Doxygen Site
yajl_buf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef __YAJL_BUF_H__
18 #define __YAJL_BUF_H__
19 
20 #include "yajl_common.h"
21 #include "yajl_alloc.h"
22 
23 /*
24  * Implementation/performance notes. If this were moved to a header
25  * only implementation using #define's where possible we might be
26  * able to sqeeze a little performance out of the guy by killing function
27  * call overhead. YMMV.
28  */
29 
34 typedef struct yajl_buf_t * yajl_buf;
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /* allocate a new buffer */
42 
43 /* free the buffer */
44 void yajl_buf_free(yajl_buf buf);
45 
46 /* append a number of bytes to the buffer */
47 void yajl_buf_append(yajl_buf buf, const void * data, size_t len);
48 
49 /* empty the buffer */
50 void yajl_buf_clear(yajl_buf buf);
51 
52 /* get a pointer to the beginning of the buffer */
53 const unsigned char * yajl_buf_data(yajl_buf buf);
54 
55 /* get the length of the buffer */
56 size_t yajl_buf_len(yajl_buf buf);
57 
58 /* truncate the buffer */
59 void yajl_buf_truncate(yajl_buf buf, size_t len);
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 #endif
void yajl_buf_truncate(yajl_buf buf, size_t len)
Definition: yajl_buf.c:103
const unsigned char * yajl_buf_data(yajl_buf buf)
Definition: yajl_buf.c:92
void yajl_buf_free(yajl_buf buf)
Definition: yajl_buf.c:68
unsigned char * data
Definition: yajl_buf.c:28
Memory allocation macros for yajl.
struct yajl_buf_t * yajl_buf
Definition: yajl_buf.h:34
yajl_buf yajl_buf_alloc(yajl_alloc_funcs *alloc)
Definition: yajl_buf.c:56
Common routines and macros used by other YAJL APIs.
void yajl_buf_clear(yajl_buf buf)
Definition: yajl_buf.c:86
void yajl_buf_append(yajl_buf buf, const void *data, size_t len)
Definition: yajl_buf.c:75
size_t yajl_buf_len(yajl_buf buf)
Definition: yajl_buf.c:97
size_t len
Definition: yajl_buf.c:26
yajl_alloc_funcs * alloc
Definition: yajl_buf.c:29