Libical API Documentation 4.0 UNRELEASED Go to the stable 3.0 documentation
Loading...
Searching...
No Matches
icalpvl.h
1/*======================================================================
2 FILE: icalpvl.h
3 CREATOR: eric November, 1995
4
5 SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
6 SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
7
8 The original code is pvl.h
9======================================================================*/
10
11/*************************************************************************
12 * WARNING: USE AT YOUR OWN RISK *
13 * These are library internal-only functions. *
14 * Be warned that these functions can change at any time without notice. *
15 *************************************************************************/
16
17#ifndef ICAL_PVL_P_H
18#define ICAL_PVL_P_H
19
20#include "libical_ical_export.h"
21
22typedef struct icalpvl_list_t *icalpvl_list;
23typedef struct icalpvl_elem_t *icalpvl_elem;
24
25/* Create new lists or elements */
26LIBICAL_ICAL_EXPORT icalpvl_elem icalpvl_new_element(void *d, icalpvl_elem next, icalpvl_elem prior);
27
28LIBICAL_ICAL_EXPORT icalpvl_list icalpvl_newlist(void);
29
30LIBICAL_ICAL_EXPORT void icalpvl_free(icalpvl_list);
31
32/* Add, remove, or get the head of the list */
33LIBICAL_ICAL_EXPORT void icalpvl_unshift(icalpvl_list l, void *d);
34
35LIBICAL_ICAL_EXPORT void *icalpvl_shift(icalpvl_list l);
36
37LIBICAL_ICAL_EXPORT icalpvl_elem icalpvl_head(icalpvl_list);
38
39/* Add, remove or get the tail of the list */
40LIBICAL_ICAL_EXPORT void icalpvl_push(icalpvl_list l, void *d);
41
42LIBICAL_ICAL_EXPORT void *icalpvl_pop(icalpvl_list l);
43
44LIBICAL_ICAL_EXPORT icalpvl_elem icalpvl_tail(icalpvl_list);
45
46/* Insert elements in random places */
47typedef int (*icalpvl_comparef)(void *a, void *b); /* a, b are of the data type */
48
49LIBICAL_ICAL_EXPORT void icalpvl_insert_ordered(icalpvl_list l, icalpvl_comparef f, void *d);
50
51LIBICAL_ICAL_EXPORT void icalpvl_insert_after(icalpvl_list l, icalpvl_elem p, void *d);
52
53LIBICAL_ICAL_EXPORT void icalpvl_insert_before(icalpvl_list l, icalpvl_elem p, void *d);
54
55/* Remove an element, or clear the entire list */
56LIBICAL_ICAL_EXPORT void *icalpvl_remove(icalpvl_list, icalpvl_elem); /* Remove element, return data */
57
58LIBICAL_ICAL_EXPORT void icalpvl_clear(icalpvl_list); /* Remove all elements, de-allocate all data */
59
60LIBICAL_ICAL_EXPORT int icalpvl_count(icalpvl_list);
61
62/* Navigate the list */
63LIBICAL_ICAL_EXPORT icalpvl_elem icalpvl_next(icalpvl_elem e);
64
65LIBICAL_ICAL_EXPORT icalpvl_elem icalpvl_prior(icalpvl_elem e);
66
67/* get the data in the list */
68LIBICAL_ICAL_EXPORT void *icalpvl_data(icalpvl_elem);
69
70/* Find an element for which a function returns true */
71typedef int (*icalpvl_findf)(void *a, void *b); /*a is list elem, b is other data */
72
73LIBICAL_ICAL_EXPORT icalpvl_elem icalpvl_find(icalpvl_list l, icalpvl_findf f, void *v);
74
75LIBICAL_ICAL_EXPORT icalpvl_elem icalpvl_find_next(icalpvl_list l, icalpvl_findf f, void *v);
76
81typedef void (*icalpvl_applyf)(void *a, void *b);
82
83LIBICAL_ICAL_EXPORT void icalpvl_apply(icalpvl_list l, icalpvl_applyf f, void *v);
84
85#endif /* ICAL_PVL_P_H */