NeoMutt  2021-02-05-89-gabe350
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 <stdint.h>
29 #include "list.h"
30 
31 struct Buffer;
32 
33 #define SLIST_SEP_SPACE (1 << 13)
34 #define SLIST_SEP_COMMA (1 << 14)
35 #define SLIST_SEP_COLON (1 << 15)
36 
37 #define SLIST_SEP_MASK 0xE000
38 
39 #define SLIST_ALLOW_DUPES (1 << 17)
40 #define SLIST_ALLOW_EMPTY (1 << 18)
41 #define SLIST_CASE_SENSITIVE (1 << 19)
42 
46 struct Slist
47 {
48  struct ListHead head;
49  size_t count;
50  uint32_t flags;
51 };
52 
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);
64 
65 #endif /* MUTT_LIB_SLIST_H */
slist_compare
bool slist_compare(const struct Slist *a, const struct Slist *b)
Compare two string lists.
Definition: slist.c:103
Buffer
String manipulation buffer.
Definition: buffer.h:33
Slist::head
struct ListHead head
Definition: slist.h:48
slist_dup
struct Slist * slist_dup(const struct Slist *list)
Create a copy of an Slist object.
Definition: slist.c:120
slist_add_string
struct Slist * slist_add_string(struct Slist *list, const char *str)
Add a string to a list.
Definition: slist.c:80
slist_parse
struct Slist * slist_parse(const char *str, uint32_t flags)
Parse a list of strings into a list.
Definition: slist.c:200
slist_remove_string
struct Slist * slist_remove_string(struct Slist *list, const char *str)
Remove a string from a list.
Definition: slist.c:258
slist_is_member
bool slist_is_member(const struct Slist *list, const char *str)
Is a string a member of a list?
Definition: slist.c:177
Slist::flags
uint32_t flags
Definition: slist.h:50
slist_new
struct Slist * slist_new(uint32_t flags)
Create a new string list.
Definition: slist.c:43
slist_free
void slist_free(struct Slist **list)
Free an Slist object.
Definition: slist.c:162
Slist::count
size_t count
Definition: slist.h:49
slist_add_list
struct Slist * slist_add_list(struct Slist *list, const struct Slist *add)
Add a list to another list.
Definition: slist.c:58
slist_to_buffer
int slist_to_buffer(const struct Slist *list, struct Buffer *buf)
Export an Slist to a Buffer.
Definition: slist.c:292
list.h
slist_empty
struct Slist * slist_empty(struct Slist **list)
Empty out an Slist object.
Definition: slist.c:141
Slist
String list.
Definition: slist.h:46