attributes: New macro ATTRSET_INITIALIZER.
[pspp] / src / data / attributes.h
index 61b68f116094c0451f704bd3785897a43099c6bd..6da0b0ef9cd71b362b45122bd93c1d8300e17620 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2008, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2011, 2012, 2016 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -41,10 +41,11 @@ void attribute_set_value (struct attribute *, size_t index, const char *);
 void attribute_del_value (struct attribute *, size_t index);
 size_t attribute_get_n_values (const struct attribute *);
 
-struct attrset 
+struct attrset
   {
     struct hmap map;
   };
+#define ATTRSET_INITIALIZER(ATTRSET) { .map = HMAP_INITIALIZER((ATTRSET).map) }
 
 void attrset_init (struct attrset *);
 void attrset_clone (struct attrset *, const struct attrset *);
@@ -52,7 +53,8 @@ void attrset_destroy (struct attrset *);
 
 size_t attrset_count (const struct attrset *);
 
-struct attribute *attrset_lookup (struct attrset *, const char *);
+struct attribute *attrset_lookup (const struct attrset *, const char *);
+bool attrset_try_add (struct attrset *, struct attribute *);
 void attrset_add (struct attrset *, struct attribute *);
 void attrset_delete (struct attrset *, const char *);
 void attrset_clear (struct attrset *);
@@ -65,6 +67,6 @@ struct attribute *attrset_first (const struct attrset *,
                                  struct attrset_iterator *);
 struct attribute *attrset_next (const struct attrset *,
                                 struct attrset_iterator *);
-
+struct attribute **attrset_sorted (const struct attrset *);
 
 #endif /* data/attributes.h */