NeoMutt  2021-02-05-666-ge300cd
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 <stdint.h>
29 #include "list.h"
31 struct Buffer;
33 #define SLIST_SEP_SPACE (1 << 13)
34 #define SLIST_SEP_COMMA (1 << 14)
35 #define SLIST_SEP_COLON (1 << 15)
37 #define SLIST_SEP_MASK 0xE000
39 #define SLIST_ALLOW_DUPES (1 << 17)
40 #define SLIST_ALLOW_EMPTY (1 << 18)
41 #define SLIST_CASE_SENSITIVE (1 << 19)
46 struct Slist
47 {
48  struct ListHead head;
49  size_t count;
50  uint32_t flags;
51 };
53 struct Slist *slist_add_list(struct Slist *list, const struct Slist *add);
54 struct Slist *slist_add_string(struct Slist *list, const char *str);
55 bool slist_compare(const struct Slist *a, const struct Slist *b);
56 struct Slist *slist_dup(const struct Slist *list);
57 struct Slist *slist_empty(struct Slist **list);
58 void slist_free(struct Slist **list);
59 bool slist_is_member(const struct Slist *list, const char *str);
60 struct Slist *slist_new(uint32_t flags);
61 struct Slist *slist_parse(const char *str, uint32_t flags);
62 struct Slist *slist_remove_string(struct Slist *list, const char *str);
63 int slist_to_buffer(const struct Slist *list, struct Buffer *buf);
65 #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
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:46
struct Slist * slist_parse(const char *str, uint32_t flags)
Parse a list of strings into a list.
Definition: slist.c:200
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:48
struct Slist * slist_empty(struct Slist **list)
Empty out an Slist object.
Definition: slist.c:141
uint32_t flags
Definition: slist.h:50
size_t count
Definition: slist.h:49
struct Slist * slist_new(uint32_t flags)
Create a new string list.
Definition: slist.c:43
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_add_list(struct Slist *list, const struct Slist *add)
Add a list to another list.
Definition: slist.c:58