1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2008, 2011 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 #ifndef DATA_ATTRIBUTES_H
18 #define DATA_ATTRIBUTES_H 1
20 #include "libpspp/hmapx.h"
22 /* This header supports custom attribute of the sort maintained
23 by the DATAFILE ATTRIBUTE and VARIABLE ATTRIBUTE commands.
25 Attributes have a name (the rules for which are the same as
26 those for PSPP variable names) and one or more values, each of
27 which is a string. An attribute may be part of one attribute
30 An attribute set is an unordered collection of attributes
31 with names that are unique (case-insensitively). */
33 struct attribute *attribute_create (const char *name);
34 struct attribute *attribute_clone (const struct attribute *);
35 void attribute_destroy (struct attribute *);
37 const char *attribute_get_name (const struct attribute *);
38 const char *attribute_get_value (const struct attribute *, size_t index);
39 void attribute_add_value (struct attribute *, const char *);
40 void attribute_set_value (struct attribute *, size_t index, const char *);
41 void attribute_del_value (struct attribute *, size_t index);
42 size_t attribute_get_n_values (const struct attribute *);
49 void attrset_init (struct attrset *);
50 void attrset_clone (struct attrset *, const struct attrset *);
51 void attrset_destroy (struct attrset *);
53 size_t attrset_count (const struct attrset *);
55 struct attribute *attrset_lookup (struct attrset *, const char *);
56 void attrset_add (struct attrset *, struct attribute *);
57 void attrset_delete (struct attrset *, const char *);
58 void attrset_clear (struct attrset *);
60 struct attrset_iterator
62 struct hmap_node *node;
64 struct attribute *attrset_first (const struct attrset *,
65 struct attrset_iterator *);
66 struct attribute *attrset_next (const struct attrset *,
67 struct attrset_iterator *);
70 #endif /* data/attributes.h */