src/data_provider.[ch]: Implement "data_provider_get_ident_data".
[collection4.git] / src / utils_array.h
1 /**
2  * collection4 - utils_array.h
3  * Copyright (C) 2010  Florian octo Forster
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  * 
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA  02110-1301  USA
19  *
20  * Authors:
21  *   Florian octo Forster <ff at octo.it>
22  **/
23
24 #ifndef UTILS_ARRAY_H
25 #define UTILS_ARRAY_H 1
26
27 struct str_array_s;
28 typedef struct str_array_s str_array_t;
29
30 str_array_t *array_create (void);
31 void array_destroy (str_array_t *a);
32
33 /* Appends a string to the array. The string is duplicated, so the original
34  * string may / must be freed. */
35 int array_append (str_array_t *a, const char *entry);
36 int array_append_format (str_array_t *a, const char *format, ...)
37   __attribute__((format(printf,2,3)));
38
39 /* Prepends a string to the array. The string is duplicated, so the original
40  * string may / must be freed. */
41 int array_prepend (str_array_t *a, const char *entry);
42 int array_prepend_format (str_array_t *a, const char *format, ...)
43   __attribute__((format(printf,2,3)));
44
45 int array_sort (str_array_t *a);
46
47 int array_argc (str_array_t *);
48 char **array_argv (str_array_t *);
49
50 #endif /* UTILS_ARRAY_H */
51 /* vim: set sw=2 sts=2 et fdm=marker : */