NeoMutt  2020-04-24
Teaching an old dog new tricks
Go to the documentation of this file.
23 #ifndef MUTT_LIB_SLIST_H
24 #define MUTT_LIB_SLIST_H
26 #include <stddef.h>
27 #include <stdbool.h>
28 #include "list.h"
30 #define SLIST_SEP_SPACE (1 << 13)
31 #define SLIST_SEP_COMMA (1 << 14)
32 #define SLIST_SEP_COLON (1 << 15)
34 #define SLIST_SEP_MASK 0xE000
36 #define SLIST_ALLOW_DUPES (1 << 17)
37 #define SLIST_ALLOW_EMPTY (1 << 18)
38 #define SLIST_CASE_SENSITIVE (1 << 19)
43 struct Slist
44 {
45  struct ListHead head;
46  size_t count;
47  unsigned int flags;
48 };
50 struct Slist *slist_add_list(struct Slist *list, const struct Slist *add);
51 struct Slist *slist_add_string(struct Slist *list, const char *str);
52 bool slist_compare(const struct Slist *a, const struct Slist *b);
53 struct Slist *slist_dup(const struct Slist *list);
54 struct Slist *slist_empty(struct Slist **list);
55 void slist_free(struct Slist **list);
56 bool slist_is_member(const struct Slist *list, const char *str);
57 struct Slist *slist_parse(const char *str, int flags);
58 struct Slist *slist_remove_string(struct Slist *list, const char *str);
60 #endif /* MUTT_LIB_SLIST_H */
struct Slist * slist_dup(const struct Slist *list)
Create a copy of an Slist object.
Definition: slist.c:105
unsigned int flags
Definition: slist.h:47
String list.
Definition: slist.h:43
bool slist_is_member(const struct Slist *list, const char *str)
Is a string a member of a list?
Definition: slist.c:163
struct Slist * slist_empty(struct Slist **list)
Empty out an Slist object.
Definition: slist.c:127
struct ListHead head
Definition: slist.h:45
void slist_free(struct Slist **list)
Free an Slist object.
Definition: slist.c:148
struct Slist * slist_add_string(struct Slist *list, const char *str)
Add a string to a list.
Definition: slist.c:65
size_t count
Definition: slist.h:46
Singly-linked list type.
struct Slist * slist_remove_string(struct Slist *list, const char *str)
Remove a string from a list.
Definition: slist.c:236
bool slist_compare(const struct Slist *a, const struct Slist *b)
Compare two string lists.
Definition: slist.c:88
struct Slist * slist_parse(const char *str, int flags)
Parse a list of strings into a list.
Definition: slist.c:186
struct Slist * slist_add_list(struct Slist *list, const struct Slist *add)
Add a list to another list.
Definition: slist.c:43