$darkmode
Libical API Documentation 4.0 STABLE VERSION Visit the v3.0 documentation
icalstrarray.h
Go to the documentation of this file.
1 /*======================================================================
2  FILE: icalstrarray.h
3  CREATOR: Ken Murchison 24 Aug 2022
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 
14 #ifndef ICALSTRARRAY_H
15 #define ICALSTRARRAY_H
16 
17 #include "libical_ical_export.h"
18 #include "icalarray.h"
19 
20 #include <stdlib.h>
21 
23 /* An icalstrarray is just an icalarray in disguise. */
24 typedef icalarray icalstrarray;
26 
47 #define icalstrarray_new(increment_size) \
48  (icalarray_new(sizeof(char *), increment_size))
49 
69 LIBICAL_ICAL_EXPORT const char *icalstrarray_element_at(icalstrarray *array, size_t position);
70 
83 LIBICAL_ICAL_EXPORT size_t icalstrarray_size(const icalstrarray *array);
84 
102 LIBICAL_ICAL_EXPORT size_t icalstrarray_find(icalstrarray *array,
103  const char *needle);
104 
119 LIBICAL_ICAL_EXPORT void icalstrarray_append(icalstrarray *array,
120  const char *elem);
121 
135 LIBICAL_ICAL_EXPORT void icalstrarray_add(icalstrarray *array,
136  const char *elem);
137 
151 LIBICAL_ICAL_EXPORT void icalstrarray_remove_element_at(icalstrarray *array,
152  size_t position);
153 
166 LIBICAL_ICAL_EXPORT void icalstrarray_remove(icalstrarray *array,
167  const char *del);
168 
180 LIBICAL_ICAL_EXPORT void icalstrarray_free(icalstrarray *array);
181 
194 LIBICAL_ICAL_EXPORT void icalstrarray_sort(icalstrarray *array);
195 
209 LIBICAL_ICAL_EXPORT icalstrarray *icalstrarray_clone(icalstrarray *array);
210 
211 #endif /* ICALSTRARRAY_H */
void icalstrarray_add(icalstrarray *array, const char *elem)
Appends a string to the array, omitting duplicates.
Definition: icalstrarray.c:71
const char * icalstrarray_element_at(icalstrarray *array, size_t position)
Accesses a string stored in the array.
Definition: icalstrarray.c:32
void icalstrarray_remove(icalstrarray *array, const char *del)
Removes all occurrences of a string.
Definition: icalstrarray.c:96
void icalstrarray_remove_element_at(icalstrarray *array, size_t position)
Removes the string at an array position.
Definition: icalstrarray.c:82
void icalstrarray_sort(icalstrarray *array)
Sorts the strings in the array in ascending order.
Definition: icalstrarray.c:137
void icalstrarray_free(icalstrarray *array)
Frees this array's memory and all its elements.
Definition: icalstrarray.c:116
size_t icalstrarray_find(icalstrarray *array, const char *needle)
Finds a string in the array.
Definition: icalstrarray.c:40
void icalstrarray_append(icalstrarray *array, const char *elem)
Appends a string to the array.
Definition: icalstrarray.c:59
icalstrarray * icalstrarray_clone(icalstrarray *array)
Clones the array and all its elements.
Definition: icalstrarray.c:145
An array of arbitrarily-sized elements which grows dynamically as elements are added.
size_t icalstrarray_size(const icalstrarray *array)
Indicates the count of strings stored in the array.
Definition: icalstrarray.c:24