Libical API Documentation 4.0
Loading...
Searching...
No Matches
icalcomponent.h
Go to the documentation of this file.
1/*======================================================================
2 FILE: icalcomponent.h
3 CREATOR: eric 20 March 1999
4
5 SPDX-FileCopyrightText: 2000, Eric Busboom <eric@civicknowledge.com>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
8
9======================================================================*/
10
14
15#ifndef ICALCOMPONENT_H
16#define ICALCOMPONENT_H
17
18#include "libical_sentinel.h"
19#include "libical_ical_export.h"
20#include "icalenums.h" /* Defines icalcomponent_kind */
21#include "icalproperty.h"
22#include "pvl.h"
23
24typedef struct icalcomponent_impl icalcomponent;
25
26/* This is exposed so that callers will not have to allocate and
27 deallocate iterators. Pretend that you can't see it. */
28typedef struct icalcompiter {
29 icalcomponent_kind kind;
30 pvl_elem iter;
32
33typedef struct icalpropiter {
34 icalproperty_kind kind;
35 pvl_elem iter;
37
40LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new(icalcomponent_kind kind);
41
47LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_clone(const icalcomponent *component);
48
51LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_from_string(const char *str);
52
57LIBICAL_ICAL_EXPORT LIBICAL_SENTINEL icalcomponent *icalcomponent_vanew(icalcomponent_kind kind, ...);
58
61LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_x(const char *x_name);
62
63/*** @brief Destructor
64 */
65LIBICAL_ICAL_EXPORT void icalcomponent_free(icalcomponent *component);
66
67LIBICAL_ICAL_EXPORT char *icalcomponent_as_ical_string(icalcomponent *component);
68
69LIBICAL_ICAL_EXPORT char *icalcomponent_as_ical_string_r(icalcomponent *component);
70
71LIBICAL_ICAL_EXPORT bool icalcomponent_is_valid(icalcomponent *component);
72
73LIBICAL_ICAL_EXPORT icalcomponent_kind icalcomponent_isa(const icalcomponent *component);
74
75LIBICAL_ICAL_EXPORT bool icalcomponent_isa_component(void *component);
76
77/* Deal with X components */
78
79LIBICAL_ICAL_EXPORT void icalcomponent_set_x_name(icalcomponent *comp, const char *name);
80LIBICAL_ICAL_EXPORT const char *icalcomponent_get_x_name(icalcomponent *comp);
81
85LIBICAL_ICAL_EXPORT const char *icalcomponent_get_component_name(const icalcomponent *comp);
86LIBICAL_ICAL_EXPORT char *icalcomponent_get_component_name_r(const icalcomponent *comp);
87
88/***** Working with Properties *****/
89
90LIBICAL_ICAL_EXPORT void icalcomponent_add_property(icalcomponent *component,
91 icalproperty *property);
92
93LIBICAL_ICAL_EXPORT void icalcomponent_remove_property(icalcomponent *component,
94 icalproperty *property);
95
96LIBICAL_ICAL_EXPORT int icalcomponent_count_properties(icalcomponent *component,
97 icalproperty_kind kind);
98
103LIBICAL_ICAL_EXPORT void icalproperty_set_parent(icalproperty *property,
104 icalcomponent *component);
105
109LIBICAL_ICAL_EXPORT icalcomponent *icalproperty_get_parent(const icalproperty *property);
110
111/* Iterate through the properties */
112LIBICAL_ICAL_EXPORT icalproperty *icalcomponent_get_current_property(icalcomponent *component);
113
114LIBICAL_ICAL_EXPORT icalproperty *icalcomponent_get_first_property(icalcomponent *component,
115 icalproperty_kind kind);
116LIBICAL_ICAL_EXPORT icalproperty *icalcomponent_get_next_property(icalcomponent *component,
117 icalproperty_kind kind);
118
119/***** Working with Components *****/
120
123LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_inner(icalcomponent *comp);
124
125LIBICAL_ICAL_EXPORT void icalcomponent_add_component(icalcomponent *parent, icalcomponent *child);
126
127LIBICAL_ICAL_EXPORT void icalcomponent_remove_component(icalcomponent *parent,
128 icalcomponent *child);
129
130LIBICAL_ICAL_EXPORT int icalcomponent_count_components(icalcomponent *component,
131 icalcomponent_kind kind);
132
138LIBICAL_ICAL_EXPORT void icalcomponent_merge_component(icalcomponent *comp,
139 icalcomponent *comp_to_merge);
140
141/* Iteration Routines. There are two forms of iterators, internal and
142external. The internal ones came first, and are almost completely
143sufficient, but they fail badly when you want to construct a loop that
144removes components from the container.*/
145
146/* Iterate through components */
147LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_current_component(icalcomponent *component);
148
149LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_first_component(icalcomponent *component,
150 icalcomponent_kind kind);
151LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_next_component(icalcomponent *component,
152 icalcomponent_kind kind);
153
154/* Using external iterators */
155LIBICAL_ICAL_EXPORT icalcompiter icalcomponent_begin_component(icalcomponent *component,
156 icalcomponent_kind kind);
157
158LIBICAL_ICAL_EXPORT icalcompiter icalcomponent_end_component(icalcomponent *component,
159 icalcomponent_kind kind);
160
161LIBICAL_ICAL_EXPORT icalcomponent *icalcompiter_next(icalcompiter *i);
162
163LIBICAL_ICAL_EXPORT icalcomponent *icalcompiter_prior(icalcompiter *i);
164
165LIBICAL_ICAL_EXPORT icalcomponent *icalcompiter_deref(icalcompiter *i);
166
167LIBICAL_ICAL_EXPORT icalpropiter icalcomponent_begin_property(icalcomponent *component,
168 icalproperty_kind kind);
169
170LIBICAL_ICAL_EXPORT icalproperty *icalpropiter_next(icalpropiter *i);
171
172LIBICAL_ICAL_EXPORT icalproperty *icalpropiter_deref(icalpropiter *i);
173
174/***** Working with embedded error properties *****/
175
176/* Check the component against itip rules and insert error properties */
177/* Working with embedded error properties */
178LIBICAL_ICAL_EXPORT int icalcomponent_check_restrictions(icalcomponent *comp);
179
185LIBICAL_ICAL_EXPORT int icalcomponent_count_errors(icalcomponent *component);
186
188LIBICAL_ICAL_EXPORT void icalcomponent_strip_errors(icalcomponent *component);
189
191LIBICAL_ICAL_EXPORT void icalcomponent_convert_errors(icalcomponent *component);
192
193/* Internal operations. They are private, and you should not be using them. */
194LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_parent(icalcomponent *component);
195
196LIBICAL_ICAL_EXPORT void icalcomponent_set_parent(icalcomponent *component,
197 icalcomponent *parent);
198
199/* Kind conversion routines */
200
201LIBICAL_ICAL_EXPORT bool icalcomponent_kind_is_valid(const icalcomponent_kind kind);
202
203LIBICAL_ICAL_EXPORT icalcomponent_kind icalcomponent_string_to_kind(const char *string);
204
205LIBICAL_ICAL_EXPORT const char *icalcomponent_kind_to_string(icalcomponent_kind kind);
206
207/************* Derived class methods. ****************************
208
209If the code was in an OO language, the remaining routines would be
210members of classes derived from icalcomponent. Don't call them on the
211wrong component subtypes. */
212
216LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_first_real_component(icalcomponent *c);
217
234LIBICAL_ICAL_EXPORT struct icaltime_span icalcomponent_get_span(icalcomponent *comp);
235
236/******************** Convenience routines **********************/
237
243LIBICAL_ICAL_EXPORT void icalcomponent_set_dtstart(icalcomponent *comp, struct icaltimetype v);
244
254LIBICAL_ICAL_EXPORT struct icaltimetype icalcomponent_get_dtstart(icalcomponent *comp);
255
256/* For the icalcomponent routines only, dtend and duration are tied
257 together. If you call the get routine for one and the other exists,
258 the routine will calculate the return value. That is, if there is a
259 DTEND and you call get_duration, the routine will return the difference
260 between DTEND and DTSTART. However, if you call a set routine for
261 one and the other exists, no action will be taken and icalerrno will
262 be set to ICAL_MALFORMEDDATA_ERROR. If you call a set routine and
263 neither exists, the routine will create the appropriate property. */
264
290LIBICAL_ICAL_EXPORT struct icaltimetype icalcomponent_get_dtend(icalcomponent *comp);
291
307LIBICAL_ICAL_EXPORT void icalcomponent_set_dtend(icalcomponent *comp, struct icaltimetype v);
308
316LIBICAL_ICAL_EXPORT struct icaltimetype icalcomponent_get_due(icalcomponent *comp);
317
329LIBICAL_ICAL_EXPORT void icalcomponent_set_due(icalcomponent *comp, struct icaltimetype v);
330
346LIBICAL_ICAL_EXPORT void icalcomponent_set_duration(icalcomponent *comp,
347 struct icaldurationtype v);
348
361LIBICAL_ICAL_EXPORT struct icaldurationtype icalcomponent_get_duration(icalcomponent *comp);
362
365LIBICAL_ICAL_EXPORT void icalcomponent_set_method(icalcomponent *comp, icalproperty_method method);
366
369LIBICAL_ICAL_EXPORT icalproperty_method icalcomponent_get_method(icalcomponent *comp);
370
371LIBICAL_ICAL_EXPORT struct icaltimetype icalcomponent_get_dtstamp(icalcomponent *comp);
372
373LIBICAL_ICAL_EXPORT void icalcomponent_set_dtstamp(icalcomponent *comp, struct icaltimetype v);
374
375LIBICAL_ICAL_EXPORT void icalcomponent_set_summary(icalcomponent *comp, const char *v);
376
377LIBICAL_ICAL_EXPORT const char *icalcomponent_get_summary(icalcomponent *comp);
378
379LIBICAL_ICAL_EXPORT void icalcomponent_set_comment(icalcomponent *comp, const char *v);
380
381LIBICAL_ICAL_EXPORT const char *icalcomponent_get_comment(icalcomponent *comp);
382
383LIBICAL_ICAL_EXPORT void icalcomponent_set_uid(icalcomponent *comp, const char *v);
384
385LIBICAL_ICAL_EXPORT const char *icalcomponent_get_uid(icalcomponent *comp);
386
387LIBICAL_ICAL_EXPORT void icalcomponent_set_relcalid(icalcomponent *comp, const char *v);
388
389LIBICAL_ICAL_EXPORT const char *icalcomponent_get_relcalid(icalcomponent *comp);
390
391LIBICAL_ICAL_EXPORT void icalcomponent_set_recurrenceid(icalcomponent *comp,
392 struct icaltimetype v);
393
394LIBICAL_ICAL_EXPORT struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent *comp);
395
396LIBICAL_ICAL_EXPORT void icalcomponent_set_description(icalcomponent *comp, const char *v);
397
398LIBICAL_ICAL_EXPORT const char *icalcomponent_get_description(icalcomponent *comp);
399
400LIBICAL_ICAL_EXPORT void icalcomponent_set_location(icalcomponent *comp, const char *v);
401
402LIBICAL_ICAL_EXPORT const char *icalcomponent_get_location(icalcomponent *comp);
403
404LIBICAL_ICAL_EXPORT void icalcomponent_set_sequence(icalcomponent *comp, int v);
405
406LIBICAL_ICAL_EXPORT int icalcomponent_get_sequence(icalcomponent *comp);
407
408LIBICAL_ICAL_EXPORT void icalcomponent_set_status(icalcomponent *comp, enum icalproperty_status v);
409
410LIBICAL_ICAL_EXPORT enum icalproperty_status icalcomponent_get_status(icalcomponent *comp);
411
415LIBICAL_ICAL_EXPORT void icalcomponent_foreach_tzid(icalcomponent *comp,
416 void (*callback)(icalparameter *param,
417 void *data),
418 void *callback_data);
419
423LIBICAL_ICAL_EXPORT icaltimezone *icalcomponent_get_timezone(icalcomponent *comp,
424 const char *tzid);
425
448LIBICAL_ICAL_EXPORT bool icalproperty_recurrence_is_excluded(icalcomponent *comp,
449 struct icaltimetype *dtstart,
450 struct icaltimetype *recurtime);
451
470LIBICAL_ICAL_EXPORT void icalcomponent_foreach_recurrence(icalcomponent *comp,
471 struct icaltimetype start,
472 struct icaltimetype end,
473 void (*callback)(icalcomponent *comp,
474 struct icaltime_span *
475 span,
476 void *data),
477 void *callback_data);
478
483LIBICAL_ICAL_EXPORT void icalcomponent_normalize(icalcomponent *comp);
484
496 icalproperty *prop,
497 icalcomponent *comp);
498/*************** Type Specific routines ***************/
499
500LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vcalendar(void);
501
502LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vevent(void);
503
504LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vtodo(void);
505
506LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vjournal(void);
507
508LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_valarm(void);
509
510LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vfreebusy(void);
511
512LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vtimezone(void);
513
514LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_xstandard(void);
515
516LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_xdaylight(void);
517
518LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vagenda(void);
519
520LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vquery(void);
521
522LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vavailability(void);
523
524LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_xavailable(void);
525
526LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vpoll(void);
527
528LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vvoter(void);
529
530LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_xvote(void);
531
532LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vpatch(void);
533
534LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_xpatch(void);
535
536LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_participant(void);
537
538LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vlocation(void);
539
540LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vresource(void);
541
542#endif /* !ICALCOMPONENT_H */
void icalcomponent_convert_errors(icalcomponent *component)
Converts some X-LIC-ERROR properties into RETURN-STATUS properties.
Definition icalcomponent.c:1090
void icalcomponent_set_relcalid(icalcomponent *comp, const char *v)
Sets the RELCALID property of a component.
Definition icalcomponent.c:2457
icalcomponent * icalcomponent_clone(const icalcomponent *component)
Deeply clones an icalcomponent. Returns a pointer to the memory for the newly cloned icalcomponent.
Definition icalcomponent.c:130
icalproperty_method icalcomponent_get_method(icalcomponent *comp)
Returns the METHOD property.
Definition icalcomponent.c:1421
void icalcomponent_foreach_recurrence(icalcomponent *comp, struct icaltimetype start, struct icaltimetype end, void(*callback)(icalcomponent *comp, struct icaltime_span *span, void *data), void *callback_data)
Cycles through all recurrences of an event.
Definition icalcomponent.c:853
icalcomponent * icalproperty_get_parent(const icalproperty *property)
Returns the parent icalcomponent for the specified property.
Definition icalproperty.c:903
void icalcomponent_set_dtstart(icalcomponent *comp, struct icaltimetype v)
Sets the DTSTART property to the given icaltime,.
Definition icalcomponent.c:1443
void icalcomponent_strip_errors(icalcomponent *component)
Removes all X-LIC-ERROR properties.
Definition icalcomponent.c:1065
void icalcomponent_normalize(icalcomponent *comp)
Normalizes (reorders and sorts the properties) the specified icalcomponent comp.
Definition icalcomponent.c:2715
struct icaltimetype icalproperty_get_datetime_with_component(icalproperty *prop, icalcomponent *comp)
Gets a DATE or DATE-TIME property as an icaltime.
Definition icalproperty.c:1046
icalcomponent * icalcomponent_vanew(icalcomponent_kind kind,...)
Constructor.
Definition icalcomponent.c:106
void icalcomponent_set_method(icalcomponent *comp, icalproperty_method method)
Sets the METHOD property to the given method.
Definition icalcomponent.c:1409
icalcomponent * icalcomponent_new(icalcomponent_kind kind)
Constructor.
Definition icalcomponent.c:101
icalcomponent * icalcomponent_get_inner(icalcomponent *comp)
Definition icalcomponent.c:1400
void icalproperty_set_parent(icalproperty *property, icalcomponent *component)
Sets the parent icalcomponent for the specified icalproperty property.
Definition icalproperty.c:896
icalcomponent * icalcomponent_get_first_real_component(icalcomponent *c)
Returns a reference to the first VEVENT, VTODO or VJOURNAL in the component.
Definition icalcomponent.c:632
const char * icalcomponent_get_relcalid(icalcomponent *comp)
Gets the RELCALID property of a component.
Definition icalcomponent.c:2475
void icalcomponent_merge_component(icalcomponent *comp, icalcomponent *comp_to_merge)
Definition icalcomponent.c:2044
bool icalproperty_recurrence_is_excluded(icalcomponent *comp, struct icaltimetype *dtstart, struct icaltimetype *recurtime)
Decides if a recurrence is acceptable.
Definition icalcomponent.c:722
int icalcomponent_count_errors(icalcomponent *component)
Returns the number of errors encountered parsing the data.
Definition icalcomponent.c:1039
icaltimezone * icalcomponent_get_timezone(icalcomponent *comp, const char *tzid)
Returns the icaltimezone in the component corresponding to the TZID, or NULL if it can't be found.
Definition icalcomponent.c:2329
void icalcomponent_set_dtend(icalcomponent *comp, struct icaltimetype v)
Sets the DTEND property to given icaltime.
Definition icalcomponent.c:1532
const char * icalcomponent_get_component_name(const icalcomponent *comp)
Definition icalcomponent.c:346
icalcomponent * icalcomponent_new_x(const char *x_name)
Constructor.
Definition icalcomponent.c:158
void icalcomponent_set_duration(icalcomponent *comp, struct icaldurationtype v)
Sets the DURATION property to given icalduration.
Definition icalcomponent.c:1557
void icalcomponent_foreach_tzid(icalcomponent *comp, void(*callback)(icalparameter *param, void *data), void *callback_data)
Calls the given function for each TZID parameter found in the component, and any subcomponents.
Definition icalcomponent.c:2292
void icalcomponent_set_due(icalcomponent *comp, struct icaltimetype v)
Sets the due date of a VTODO task.
Definition icalcomponent.c:2518
icalcomponent * icalcomponent_new_from_string(const char *str)
Constructor.
Definition icalcomponent.c:125
struct _icaltimezone icaltimezone
An opaque struct representing a timezone. We declare this here to avoid a circular dependency.
Definition icaltime.h:84
Definition icalcomponent.h:28
Definition icalcomponent.c:27
A struct representing a duration.
Definition icalduration.h:29
Definition icalcomponent.h:33
Definition icaltime.h:89
Definition icaltime.h:98