Raw File
1 /*============================================================================
2 epub2txt v2
3 list.h
4 Copyright (c)2000-2020 Kevin Boone, GPL v3.0
5 ============================================================================*/
6
7 #pragma once
8
9 #include "defs.h"
10
11 struct _List;
12 typedef struct _List List;
13
14 // The comparison function should return -1, 0, +1, like strcmp
15 typedef int (*ListCompareFn) (const void *i1, const void *i2);
16 typedef void* (*ListCopyFn) (const void *orig);
17 typedef void (*ListItemFreeFn) (void *);
18
19 List *list_create (ListItemFreeFn free_fn);
20 void list_destroy (List *);
21 void list_append (List *self, void *item);
22 void list_prepend (List *self, void *item);
23 void *list_get (List *self, int index);
24 void list_dump (List *self);
25 int list_length (List *self);
26 BOOL list_contains (List *self, const void *item, ListCompareFn fn);
27 BOOL list_contains_string (List *self, const char *item);
28 void list_remove (List *self, const void *item, ListCompareFn fn);
29 void list_remove_string (List *self, const char *item);
30 List *list_clone (List *self, ListCopyFn copyFn);
31 List *list_create_strings (void);
32
33
Generated by GNU Enscript 1.6.6, and GophHub 1.3.