root/cherokee/trunk/cherokee/avl.h

Revision 1569, 2.6 kB (checked in by alo, 4 months ago)

--

Line 
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 /* Cherokee
4  *
5  * Authors:
6  *      Alvaro Lopez Ortega <alvaro@alobbs.com>
7  *
8  * Copyright (C) 2001-2008 Alvaro Lopez Ortega
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of version 2 of the GNU General Public
12  * License as published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22  * USA
23  */
24
25 #if !defined (CHEROKEE_INSIDE_CHEROKEE_H) && !defined (CHEROKEE_COMPILATION)
26 # error "Only <cherokee/cherokee.h> can be included directly, this file may disappear or change contents."
27 #endif
28
29 #ifndef CHEROKEE_AVL_H
30 #define CHEROKEE_AVL_H
31
32 #include <cherokee/buffer.h>
33
34
35 CHEROKEE_BEGIN_DECLS
36
37 typedef struct cherokee_avl_node cherokee_avl_node_t;
38
39 typedef struct {
40         cherokee_avl_node_t *root;
41         cherokee_boolean_t   case_insensitive;
42 } cherokee_avl_t;
43
44 #define AVL(a) ((cherokee_avl_t *)(a))
45
46 typedef ret_t (* cherokee_avl_while_func_t)      (cherokee_buffer_t *key, void *value, void *param);
47
48 ret_t cherokee_avl_new       (cherokee_avl_t **avl);
49 ret_t cherokee_avl_free      (cherokee_avl_t  *avl, cherokee_func_free_t free_func);
50
51 ret_t cherokee_avl_init      (cherokee_avl_t  *avl);
52 ret_t cherokee_avl_mrproper  (cherokee_avl_t  *avl, cherokee_func_free_t free_func);
53
54 ret_t cherokee_avl_add       (cherokee_avl_t *avl, cherokee_buffer_t *key, void  *value);
55 ret_t cherokee_avl_del       (cherokee_avl_t *avl, cherokee_buffer_t *key, void **value);
56 ret_t cherokee_avl_get       (cherokee_avl_t *avl, cherokee_buffer_t *key, void **value);
57
58 ret_t cherokee_avl_add_ptr   (cherokee_avl_t *avl, const char *key, void  *value);
59 ret_t cherokee_avl_del_ptr   (cherokee_avl_t *avl, const char *key, void **value);
60 ret_t cherokee_avl_get_ptr   (cherokee_avl_t *avl, const char *key, void **value);
61
62 ret_t cherokee_avl_len       (cherokee_avl_t *avl, size_t *len);
63 ret_t cherokee_avl_while     (cherokee_avl_t *avl, cherokee_avl_while_func_t func, void *param, cherokee_buffer_t **key, void **value);
64
65 ret_t cherokee_avl_set_case  (cherokee_avl_t *avl, cherokee_boolean_t case_sensitive);
66 ret_t cherokee_avl_check     (cherokee_avl_t *avl);
67 ret_t cherokee_avl_print     (cherokee_avl_t *avl);
68
69 CHEROKEE_END_DECLS
70
71 #endif /* CHEROKEE_AVL_H */
Note: See TracBrowser for help on using the browser.