Libical API Documentation 4.0 UNRELEASED Go to the stable 3.0 documentation
Loading...
Searching...
No Matches
icalenumarray.h
Go to the documentation of this file.
1/*======================================================================
2 FILE: icalenumarray.h
3 CREATOR: Ken Murchison 24 Aug 2022 <murch@fastmailteam.com>
4
5 SPDX-FileCopyrightText: 2022, Fastmail Pty. Ltd. (https://fastmail.com)
6 SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
7 ======================================================================*/
8
13
14#ifndef ICALENUMARRAY_H
15#define ICALENUMARRAY_H
16
17#include "libical_ical_export.h"
18#include "icalarray.h"
19
20#include <stdlib.h>
21
23/* An icalenumarray is just an icalarray in disguise. */
24typedef icalarray icalenumarray;
26
30typedef struct {
31 int val;
32 const char *xvalue;
34
56#define icalenumarray_new(increment_size) \
57 icalarray_new(sizeof(icalenumarray_element), increment_size)
58
78LIBICAL_ICAL_EXPORT const icalenumarray_element *icalenumarray_element_at(icalenumarray *array, size_t position);
79
93LIBICAL_ICAL_EXPORT size_t icalenumarray_size(const icalenumarray *array);
94
112LIBICAL_ICAL_EXPORT size_t icalenumarray_find(icalenumarray *array,
113 const icalenumarray_element *needle);
114
130LIBICAL_ICAL_EXPORT void icalenumarray_append(icalenumarray *array,
131 const icalenumarray_element *elem);
132
147LIBICAL_ICAL_EXPORT void icalenumarray_add(icalenumarray *array,
148 const icalenumarray_element *elem);
149
163LIBICAL_ICAL_EXPORT void icalenumarray_remove_element_at(icalenumarray *array,
164 size_t position);
165
178LIBICAL_ICAL_EXPORT void icalenumarray_remove(icalenumarray *array,
179 const icalenumarray_element *del);
180
192LIBICAL_ICAL_EXPORT void icalenumarray_free(icalenumarray *array);
193
206LIBICAL_ICAL_EXPORT void icalenumarray_sort(icalenumarray *array);
207
221LIBICAL_ICAL_EXPORT icalenumarray *icalenumarray_clone(icalenumarray *array);
222
223#endif /* ICALENUMARRAY_H */
An array of arbitrarily-sized elements which grows dynamically as elements are added.
void icalenumarray_free(icalenumarray *array)
Frees this array's memory and all its elements.
void icalenumarray_remove(icalenumarray *array, const icalenumarray_element *del)
Removes all occurrences of an element.
size_t icalenumarray_find(icalenumarray *array, const icalenumarray_element *needle)
Finds an element in the array.
void icalenumarray_sort(icalenumarray *array)
Sorts the elements in the array in ascending order.
void icalenumarray_append(icalenumarray *array, const icalenumarray_element *elem)
Appends an element to the array.
size_t icalenumarray_size(const icalenumarray *array)
Indicates the count of elements stored in the array.
icalenumarray * icalenumarray_clone(icalenumarray *array)
Clones the array and all its elements.
void icalenumarray_remove_element_at(icalenumarray *array, size_t position)
Removes the element at an array position.
const icalenumarray_element * icalenumarray_element_at(icalenumarray *array, size_t position)
Accesses an element stored in the array.
void icalenumarray_add(icalenumarray *array, const icalenumarray_element *elem)
Appends an element to the array, omitting duplicates.