NeoMutt  2020-11-20
Teaching an old dog new tricks
DOXYGEN
slist.h
Go to the documentation of this file.
1 
23 #ifndef MUTT_LIB_SLIST_H
24 #define MUTT_LIB_SLIST_H
25 
26 #include <stddef.h>
27 #include <stdbool.h>
28 #include "list.h"
29 
30 struct Buffer;
31 
32 #define SLIST_SEP_SPACE (1 << 13)
33 #define SLIST_SEP_COMMA (1 << 14)
34 #define SLIST_SEP_COLON (1 << 15)
35 
36 #define SLIST_SEP_MASK 0xE000
37 
38 #define SLIST_ALLOW_DUPES (1 << 17)
39 #define SLIST_ALLOW_EMPTY (1 << 18)
40 #define SLIST_CASE_SENSITIVE (1 << 19)
41 
45 struct Slist
46 {
47  struct ListHead head;
48  size_t count;
49  unsigned int flags;
50 };
51 
52 struct Slist *slist_add_list(struct Slist *list, const struct Slist *add);
53 struct Slist *slist_add_string(struct Slist *list, const char *str);
54 bool slist_compare(const struct Slist *a, const struct Slist *b);
55 struct Slist *slist_dup(const struct Slist *list);
56 struct Slist *slist_empty(struct Slist **list);
57 void slist_free(struct Slist **list);
58 bool slist_is_member(const struct Slist *list, const char *str);
59 struct Slist *slist_new(int flags);
60 struct Slist *slist_parse(const char *str, int flags);
61 struct Slist *slist_remove_string(struct Slist *list, const char *str);
62 int slist_to_buffer(const struct Slist *list, struct Buffer *buf);
63 
64 #endif /* MUTT_LIB_SLIST_H */
bool slist_compare(const struct Slist *a, const struct Slist *b)
Compare two string lists.
Definition: slist.c:103
String manipulation buffer.
Definition: buffer.h:33
unsigned int flags
Definition: slist.h:49
bool slist_is_member(const struct Slist *list, const char *str)
Is a string a member of a list?
Definition: slist.c:177
struct Slist * slist_dup(const struct Slist *list)
Create a copy of an Slist object.
Definition: slist.c:120
String list.
Definition: slist.h:45
struct Slist * slist_remove_string(struct Slist *list, const char *str)
Remove a string from a list.
Definition: slist.c:258
struct ListHead head
Definition: slist.h:47
struct Slist * slist_empty(struct Slist **list)
Empty out an Slist object.
Definition: slist.c:141
size_t count
Definition: slist.h:48
Singly-linked list type.
void slist_free(struct Slist **list)
Free an Slist object.
Definition: slist.c:162
struct Slist * slist_add_string(struct Slist *list, const char *str)
Add a string to a list.
Definition: slist.c:80
int slist_to_buffer(const struct Slist *list, struct Buffer *buf)
Export an Slist to a Buffer.
Definition: slist.c:292
struct Slist * slist_new(int flags)
Create a new string list.
Definition: slist.c:43
struct Slist * slist_parse(const char *str, int flags)
Parse a list of strings into a list.
Definition: slist.c:200
struct Slist * slist_add_list(struct Slist *list, const struct Slist *add)
Add a list to another list.
Definition: slist.c:58