NeoMutt  2022-04-29-247-gc6aae8
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
31struct 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
46struct Slist
47{
48 struct ListHead head;
49 size_t count;
50 uint32_t flags;
51};
52
53struct Slist *slist_add_list(struct Slist *list, const struct Slist *add);
54struct Slist *slist_add_string(struct Slist *list, const char *str);
55bool slist_compare(const struct Slist *a, const struct Slist *b);
56struct Slist *slist_dup(const struct Slist *list);
57struct Slist *slist_empty(struct Slist **list);
58void slist_free(struct Slist **list);
59bool slist_is_member(const struct Slist *list, const char *str);
60struct Slist *slist_new(uint32_t flags);
61struct Slist *slist_parse(const char *str, uint32_t flags);
62struct Slist *slist_remove_string(struct Slist *list, const char *str);
63int slist_to_buffer(const struct Slist *list, struct Buffer *buf);
64
65#endif /* MUTT_LIB_SLIST_H */
Singly-linked list type.
struct Slist * slist_remove_string(struct Slist *list, const char *str)
Remove a string from a list.
Definition: slist.c:258
struct Slist * slist_empty(struct Slist **list)
Empty out an Slist object.
Definition: slist.c:141
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_add_list(struct Slist *list, const struct Slist *add)
Add a list to another list.
Definition: slist.c:58
bool slist_compare(const struct Slist *a, const struct Slist *b)
Compare two string lists.
Definition: slist.c:103
struct Slist * slist_add_string(struct Slist *list, const char *str)
Add a string to a list.
Definition: slist.c:80
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
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(uint32_t flags)
Create a new string list.
Definition: slist.c:43
void slist_free(struct Slist **list)
Free an Slist object.
Definition: slist.c:162
String manipulation buffer.
Definition: buffer.h:34
String list.
Definition: slist.h:47
struct ListHead head
List containing values.
Definition: slist.h:48
size_t count
Number of values in list.
Definition: slist.h:49
uint32_t flags
Flags controlling list, e.g. SLIST_SEP_SPACE.
Definition: slist.h:50