Debian Codegraph @

lib/fieldtrie.h

raw
1 /* dctrl-tools - Debian control file inspection tools
2 Copyright © 2003, 2004 Antti-Juhani Kaijanaho
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef FIELDTRIE_H
20 #define FIELDTRIE_H
21
22 #include <limits.h>
23 #include <stddef.h>
24 #include <stdbool.h>
25
26 struct field_attr {
27 char const *const name;
28 const size_t namelen;
29 const size_t inx;
30 _Bool is_show_field; /* whether this field is (globally) selected
31 for showing */
32 size_t backup_field; /* index to field whose value should be
33 used if this field is empty, or
34 (size_t)-1 */
35 };
36
37 void fieldtrie_init(void);
38
39 // case-insensitive
40 struct field_attr *fieldtrie_insert(char const *);
41 struct field_attr *fieldtrie_insert_n(char const * s, size_t slen);
42
43 // case-insensitive
44 struct field_attr *fieldtrie_lookup(char const *, size_t n);
45
46 struct field_attr *fieldtrie_get(size_t inx);
47
48 //void fieldtrie_clear(void);
49
50 size_t fieldtrie_count(void);
51
52 #endif /* FIELDTRIE_H */