1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
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 3 of the License, or
7 (at your option) any later version.
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.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Sets of value labels.
19 struct val_labs represents a mapping from `union value's to
20 strings. The `union value's in the mapping all have the same
21 width. If this width is numeric or short string, the mapping
22 may contain any number of entries; long string mappings are
25 #ifndef DATA_VALUE_LABELS_H
26 #define DATA_VALUE_LABELS_H 1
30 #include <data/value.h>
32 /* One value label. */
39 /* Creating and destroying sets of value labels. */
40 struct val_labs *val_labs_create (int width);
41 struct val_labs *val_labs_clone (const struct val_labs *);
42 void val_labs_clear (struct val_labs *);
43 void val_labs_destroy (struct val_labs *);
45 /* Looking up value labels. */
46 char *val_labs_find (const struct val_labs *, union value);
48 /* Basic properties. */
49 size_t val_labs_count (const struct val_labs *);
50 bool val_labs_can_set_width (const struct val_labs *, int new_width);
51 void val_labs_set_width (struct val_labs *, int new_width);
53 /* Adding value labels. */
54 bool val_labs_add (struct val_labs *, union value, const char *);
55 void val_labs_replace (struct val_labs *, union value, const char *);
56 bool val_labs_remove (struct val_labs *, union value);
58 /* Iterating through value labels. */
59 struct val_labs_iterator;
60 struct val_lab *val_labs_first (const struct val_labs *,
61 struct val_labs_iterator **);
62 struct val_lab *val_labs_first_sorted (const struct val_labs *,
63 struct val_labs_iterator **);
64 struct val_lab *val_labs_next (const struct val_labs *,
65 struct val_labs_iterator **);
66 void val_labs_done (struct val_labs_iterator **);
68 #endif /* data/value-labels.h */