Make dict_str{cmp,ncmp,len} internal
[idzebra-moved-to-github.git] / include / idzebra / dict.h
1 /* $Id: dict.h,v 1.7 2006-08-29 09:27:56 adam Exp $
2    Copyright (C) 1995-2006
3    Index Data ApS
4
5 This file is part of the Zebra server.
6
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
11
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
21 */
22
23 /** \file dict.h
24     \brief Zebra dictionary
25     
26     The dictionary is a hash that maps a string to a value.
27     The value is opaque and is defined as a sequence of bytes
28     with a length in the range 0 to 255.
29 */
30
31 #ifndef DICT_H
32 #define DICT_H
33
34 #include <yaz/yconfig.h>
35 #include <idzebra/bfile.h>
36
37 YAZ_BEGIN_CDECL
38
39 /** \var Dict
40  * \brief Dictionary type
41  *
42  * Most dictionary functions operatate on a Dict type (object).
43  */
44 typedef struct Dict_struct *Dict;
45
46 typedef unsigned Dict_ptr;
47
48 YAZ_EXPORT 
49 Dict dict_open (BFiles bfs, const char *name, int cache, int rw,
50                       int compact_flag, int page_size);
51
52 YAZ_EXPORT
53 int dict_close (Dict dict);
54
55 YAZ_EXPORT
56 int dict_insert (Dict dict, const char *p, int userlen, void *userinfo);
57
58 YAZ_EXPORT
59 int dict_delete (Dict dict, const char *p);
60
61 YAZ_EXPORT
62 int dict_delete_subtree (Dict dict, const char *p, void *client,
63                                 int (*f)(const char *info, void *client));
64 YAZ_EXPORT
65 char *dict_lookup (Dict dict, const char *p);
66
67 YAZ_EXPORT
68 int dict_lookup_ec (Dict dict, char *p, int range, int (*f)(char *name));
69
70 YAZ_EXPORT
71 int dict_lookup_grep (Dict dict, const char *p, int range, void *client,
72                       int *max_pos, int init_pos,
73                       int (*f)(char *name, const char *info, void *client));
74
75 YAZ_EXPORT
76 int dict_scan (Dict dict, char *str, 
77                int *before, int *after, void *client,
78                int (*f)(char *name, const char *info, int pos, void *client));
79
80 YAZ_EXPORT 
81 void dict_grep_cmap (Dict dict, void *vp,
82                      const char **(*cmap)(void *vp,
83                                           const char **from, int len));
84
85 YAZ_EXPORT
86 int dict_copy_compact (BFiles bfs, const char *from, const char *to);
87
88 YAZ_END_CDECL
89    
90 #endif
91 /*
92  * Local variables:
93  * c-basic-offset: 4
94  * indent-tabs-mode: nil
95  * End:
96  * vim: shiftwidth=4 tabstop=8 expandtab
97  */
98