1 /* $Id: dict.h,v 1.4 2005-05-01 20:43:11 adam Exp $
2 Copyright (C) 1995-2005
5 This file is part of the Zebra server.
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
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
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 \brief Zebra dictionary
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.
34 #include <yaz/yconfig.h>
35 #include <idzebra/bfile.h>
40 * \brief Dictionary type
42 * Most dictionary functions operatate on a Dict type (object).
44 typedef struct Dict_struct *Dict;
46 typedef unsigned Dict_ptr;
47 typedef unsigned char Dict_char;
50 Dict dict_open (BFiles bfs, const char *name, int cache, int rw,
51 int compact_flag, int page_size);
54 int dict_close (Dict dict);
57 int dict_insert (Dict dict, const char *p, int userlen, void *userinfo);
60 int dict_delete (Dict dict, const char *p);
63 int dict_delete_subtree (Dict dict, const char *p, void *client,
64 int (*f)(const char *info, void *client));
66 char *dict_lookup (Dict dict, const char *p);
69 int dict_lookup_ec (Dict dict, char *p, int range, int (*f)(char *name));
72 int dict_lookup_grep (Dict dict, const char *p, int range, void *client,
73 int *max_pos, int init_pos,
74 int (*f)(char *name, const char *info, void *client));
77 int dict_strcmp (const Dict_char *s1, const Dict_char *s2);
80 int dict_strncmp (const Dict_char *s1, const Dict_char *s2, size_t n);
83 int dict_strlen (const Dict_char *s);
86 int dict_scan (Dict dict, char *str,
87 int *before, int *after, void *client,
88 int (*f)(char *name, const char *info, int pos, void *client));
91 void dict_grep_cmap (Dict dict, void *vp,
92 const char **(*cmap)(void *vp,
93 const char **from, int len));
96 int dict_copy_compact (BFiles bfs, const char *from, const char *to);