NeoMutt  2024-04-25-76-g20fe7b
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
list.h
Go to the documentation of this file.
1
24#ifndef MUTT_MUTT_LIST_H
25#define MUTT_MUTT_LIST_H
26
27#include <stdbool.h>
28#include <stddef.h>
29#include "buffer.h"
30#include "queue.h"
31
36{
37 char *data;
39};
41
49typedef void (*list_free_t)(void **ptr);
50
51void mutt_list_clear (struct ListHead *h);
52void mutt_list_copy_tail (struct ListHead *dst, const struct ListHead *src);
53bool mutt_list_equal (const struct ListHead *ah, const struct ListHead *bh);
54struct ListNode *mutt_list_find (const struct ListHead *h, const char *data);
55void mutt_list_free (struct ListHead *h);
56void mutt_list_free_type (struct ListHead *h, list_free_t fn);
57struct ListNode *mutt_list_insert_after(struct ListHead *h, struct ListNode *n, char *s);
58struct ListNode *mutt_list_insert_head (struct ListHead *h, char *s);
59struct ListNode *mutt_list_insert_tail (struct ListHead *h, char *s);
60bool mutt_list_match (const char *s, struct ListHead *h);
61size_t mutt_list_str_split (struct ListHead *head, const char *src, char sep);
62size_t mutt_list_write (const struct ListHead *h, struct Buffer *buf);
63
64#endif /* MUTT_MUTT_LIST_H */
General purpose object for storing and parsing strings.
void mutt_list_copy_tail(struct ListHead *dst, const struct ListHead *src)
Copy a list into another list.
Definition: list.c:275
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition: list.c:65
struct ListNode * mutt_list_find(const struct ListHead *h, const char *data)
Find a string in a List.
Definition: list.c:103
struct ListNode * mutt_list_insert_head(struct ListHead *h, char *s)
Insert a string at the beginning of a List.
Definition: list.c:46
size_t mutt_list_write(const struct ListHead *h, struct Buffer *buf)
Write a list to a buffer.
Definition: list.c:293
void mutt_list_clear(struct ListHead *h)
Free a list, but NOT its strings.
Definition: list.c:166
size_t mutt_list_str_split(struct ListHead *head, const char *src, char sep)
Split a string into a list using a separator char.
Definition: list.c:246
void(* list_free_t)(void **ptr)
Definition: list.h:49
bool mutt_list_equal(const struct ListHead *ah, const struct ListHead *bh)
Compare two string lists.
Definition: list.c:217
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:123
void mutt_list_free_type(struct ListHead *h, list_free_t fn)
Free a List of type.
Definition: list.c:144
bool mutt_list_match(const char *s, struct ListHead *h)
Is the string in the list (see notes)
Definition: list.c:194
struct ListNode * mutt_list_insert_after(struct ListHead *h, struct ListNode *n, char *s)
Insert a string after a given ListNode.
Definition: list.c:85
#define STAILQ_HEAD(name, type)
Definition: queue.h:312
String manipulation buffer.
Definition: buffer.h:36
A List node for strings.
Definition: list.h:36
char * data
String.
Definition: list.h:37
STAILQ_ENTRY(ListNode) entries
Linked list.