1 /* GNU gettext - internationalization aids
2 Copyright (C) 1995-1996, 1998, 2000-2004 Free Software Foundation, Inc.
4 This file was written by Peter Miller <millerp@canb.auug.org.au>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 /* Get size_t and NULL. */
35 /* Type describing list of immutable strings,
36 implemented using a dynamic array. */
37 typedef struct string_list_ty string_list_ty
;
45 /* Initialize an empty list of strings. */
46 extern void string_list_init (string_list_ty
*slp
);
48 /* Return a fresh, empty list of strings. */
49 extern string_list_ty
*string_list_alloc (void);
51 /* Append a single string to the end of a list of strings. */
52 extern void string_list_append (string_list_ty
*slp
, const char *s
);
54 /* Append a single string to the end of a list of strings, unless it is
55 already contained in the list. */
56 extern void string_list_append_unique (string_list_ty
*slp
, const char *s
);
58 /* Destroy a list of strings. */
59 extern void string_list_destroy (string_list_ty
*slp
);
61 /* Free a list of strings. */
62 extern void string_list_free (string_list_ty
*slp
);
64 /* Return a freshly allocated string obtained by concatenating all the
65 strings in the list. */
66 extern char *string_list_concat (const string_list_ty
*slp
);
68 /* Return a freshly allocated string obtained by concatenating all the
69 strings in the list, and destroy the list. */
70 extern char *string_list_concat_destroy (string_list_ty
*slp
);
72 /* Return a freshly allocated string obtained by concatenating all the
73 strings in the list, separated by the separator character, terminated
74 by the terminator character. The terminator character is not added if
75 drop_redundant_terminator is true and the last string already ends with
77 extern char *string_list_join (const string_list_ty
*slp
, char separator
,
78 char terminator
, bool drop_redundant_terminator
);
80 /* Return 1 if s is contained in the list of strings, 0 otherwise. */
81 extern bool string_list_member (const string_list_ty
*slp
, const char *s
);
89 #endif /* _STR_LIST_H */