19#include "icalerror_p.h"
26#include "icaltime_p.h"
28#include "icaltypes_p.h"
35struct icalcomponent_impl {
39 icalpvl_list properties;
40 icalpvl_elem property_iterator;
41 icalpvl_list components;
42 icalpvl_elem component_iterator;
43 struct icalcomponent_impl *parent;
53static void icalcomponent_add_children(icalcomponent *impl, va_list args);
56static bool icalcomponent_merge_vtimezone(icalcomponent *comp,
57 icalcomponent *vtimezone, icalstrarray *tzids_to_rename);
58static bool icalcomponent_handle_conflicting_vtimezones(icalcomponent *comp,
59 icalcomponent *vtimezone,
60 icalproperty *tzid_prop,
62 icalstrarray *tzids_to_rename);
63static size_t icalcomponent_get_tzid_prefix_len(
const char *tzid);
64static void icalcomponent_rename_tzids(icalcomponent *comp, icalstrarray *rename_table);
65static void icalcomponent_rename_tzids_callback(
icalparameter *param,
void *data);
66static int icalcomponent_compare_vtimezones(icalcomponent *vtimezone1, icalcomponent *vtimezone2);
67static int icalcomponent_compare_timezone_fn(
const void *elem1,
const void *elem2);
69void icalcomponent_add_children(icalcomponent *impl, va_list args)
73 while ((vp = va_arg(args,
void *)) != 0) {
98 memset(comp, 0,
sizeof(icalcomponent));
100 comp->id = ICAL_STRUCTURE_TYPE_COMPONENT;
102 comp->properties = icalpvl_newlist();
103 comp->components = icalpvl_newlist();
104 comp->timezones_sorted = 1;
111 return icalcomponent_new_impl(kind);
120 icalcomponent *impl = icalcomponent_new_impl(kind);
126 va_start(args, kind);
127 icalcomponent_add_children(impl, args);
140 icalcomponent *clone;
141 const icalcomponent *c;
142 const icalproperty *p;
145 icalerror_check_arg_rz((old != 0),
"component");
147 clone = icalcomponent_new_impl(old->kind);
157 for (itr = icalpvl_head(old->properties); itr != 0; itr = icalpvl_next(itr)) {
158 p = (icalproperty *)icalpvl_data(itr);
162 for (itr = icalpvl_head(old->components); itr != 0; itr = icalpvl_next(itr)) {
163 c = (icalcomponent *)icalpvl_data(itr);
196 icalerror_check_arg_rv((c != 0),
"component");
198 if (c->parent != 0) {
202 if (c->properties != 0) {
204 while ((prop = icalpvl_pop(c->properties)) != 0) {
208 icalpvl_free(c->properties);
211 while ((comp = icalpvl_data(icalpvl_head(c->components))) != 0) {
216 icalpvl_free(c->components);
220 icaltimezone_array_free(c->timezones);
225 c->property_iterator = 0;
227 c->component_iterator = 0;
229 c->id = ICAL_STRUCTURE_TYPE_COMPONENT_EMPTY;
249 size_t buf_size = 1024;
254 const char newline[] =
"\r\n";
256 const icalcomponent *c;
260 const char *kind_string;
262 icalerror_check_arg_rz((component != 0),
"component");
263 icalerror_check_arg_rz((kind !=
ICAL_NO_COMPONENT),
"component kind is ICAL_NO_COMPONENT");
266 kind_string = component->x_name;
271 icalerror_check_arg_rz((kind_string != 0),
"Unknown kind of component");
284 for (itr = icalpvl_head(component->properties); itr != 0; itr = icalpvl_next(itr)) {
287 p = (icalproperty *)icalpvl_data(itr);
289 icalerror_assert((p != 0),
"Got a null property");
296 for (itr = icalpvl_head(component->components); itr != 0; itr = icalpvl_next(itr)) {
299 c = (icalcomponent *)icalpvl_data(itr);
302 if (tmp_buf != NULL) {
318 if ((component->id == ICAL_STRUCTURE_TYPE_COMPONENT) && component->kind !=
ICAL_NO_COMPONENT) {
329 return component->kind;
334 const icalcomponent *impl = component;
336 icalerror_check_arg_rz((component != 0),
"component");
338 return (impl->id == ICAL_STRUCTURE_TYPE_COMPONENT);
343 icalerror_check_arg_rv((name != 0),
"name");
344 icalerror_check_arg_rv((comp != 0),
"comp");
349 if (comp->x_name == 0) {
356 icalerror_check_arg_rz((comp != 0),
"comp");
363 icalerror_check_arg_rv((name != 0),
"name");
364 icalerror_check_arg_rv((comp != 0),
"comp");
370 if (comp->x_name == 0) {
377 icalerror_check_arg_rz((comp != 0),
"comp");
394 const char *component_name = 0;
395 size_t buf_size = 256;
399 icalerror_check_arg_rz((comp != 0),
"comp");
406 component_name = comp->x_name;
411 if (component_name == 0) {
427 icalerror_check_arg_rv((component != 0),
"component");
428 icalerror_check_arg_rv((property != 0),
"property");
431 "The property has already been added to a component. "
432 "Remove the property with icalcomponent_remove_property "
433 "before calling icalcomponent_add_property");
437 icalpvl_push(component->properties, property);
442 icalpvl_elem itr, next_itr;
444 icalerror_check_arg_rv((component != 0),
"component");
445 icalerror_check_arg_rv((property != 0),
"property");
451 for (itr = icalpvl_head(component->properties); itr != 0; itr = next_itr) {
452 next_itr = icalpvl_next(itr);
454 if (icalpvl_data(itr) == (
void *)property) {
455 if (component->property_iterator == itr) {
456 component->property_iterator = icalpvl_next(itr);
459 (void)icalpvl_remove(component->properties, itr);
467 icalpvl_elem itr, next_itr;
469 icalerror_check_arg_rv((component != 0),
"component");
471 for (itr = icalpvl_head(component->properties); itr != 0; itr = next_itr) {
472 next_itr = icalpvl_next(itr);
474 icalproperty *
property = icalpvl_data(itr);
476 if (component->property_iterator == itr) {
477 component->property_iterator = icalpvl_next(itr);
480 (void)icalpvl_remove(component->properties, itr);
492 icalerror_check_arg_rz((component != 0),
"component");
494 for (itr = icalpvl_head(component->properties); itr != 0; itr = icalpvl_next(itr)) {
505 icalerror_check_arg_rz((component != 0),
"component");
507 if (component->property_iterator == 0) {
511 return (icalproperty *)icalpvl_data(component->property_iterator);
516 icalerror_check_arg_rz((c != 0),
"component");
518 for (c->property_iterator = icalpvl_head(c->properties);
519 c->property_iterator != 0; c->property_iterator = icalpvl_next(c->property_iterator)) {
520 icalproperty *p = (icalproperty *)icalpvl_data(c->property_iterator);
531 icalerror_check_arg_rz((c != 0),
"component");
533 if (c->property_iterator == 0) {
537 for (c->property_iterator = icalpvl_next(c->property_iterator);
538 c->property_iterator != 0; c->property_iterator = icalpvl_next(c->property_iterator)) {
539 icalproperty *p = (icalproperty *)icalpvl_data(c->property_iterator);
551 icalerror_check_arg_rv((parent != 0),
"parent");
552 icalerror_check_arg_rv((child != 0),
"child");
554 if (child->parent != 0) {
558 child->parent = parent;
562 icalpvl_push(parent->components, child);
565 icalpvl_unshift(parent->components, child);
570 if (!parent->timezones) {
571 parent->timezones = icaltimezone_array_new();
574 if (parent->timezones) {
575 icaltimezone_array_append_from_vtimezone(parent->timezones, child);
579 parent->timezones_sorted = 0;
585 icalpvl_elem itr, next_itr;
587 icalerror_check_arg_rv((parent != 0),
"parent");
588 icalerror_check_arg_rv((child != 0),
"child");
593 size_t i, num_elements;
595 num_elements = parent->timezones ? parent->timezones->num_elements : 0;
596 for (i = 0; i < num_elements; i++) {
606 for (itr = icalpvl_head(parent->components); itr != 0; itr = next_itr) {
607 next_itr = icalpvl_next(itr);
609 if (icalpvl_data(itr) == (
void *)child) {
610 if (parent->component_iterator == itr) {
614 parent->component_iterator = icalpvl_next(parent->component_iterator);
616 (void)icalpvl_remove(parent->components, itr);
628 icalerror_check_arg_rz((component != 0),
"component");
630 for (itr = icalpvl_head(component->components); itr != 0; itr = icalpvl_next(itr)) {
642 icalerror_check_arg_rz((component != 0),
"component");
644 if (component->component_iterator == 0) {
648 return (icalcomponent *)icalpvl_data(component->component_iterator);
653 icalerror_check_arg_rz((c != 0),
"component");
655 for (c->component_iterator = icalpvl_head(c->components);
656 c->component_iterator != 0; c->component_iterator = icalpvl_next(c->component_iterator)) {
657 icalcomponent *p = (icalcomponent *)icalpvl_data(c->component_iterator);
669 icalerror_check_arg_rz((c != 0),
"component");
671 if (c->component_iterator == 0) {
675 for (c->component_iterator = icalpvl_next(c->component_iterator);
676 c->component_iterator != 0; c->component_iterator = icalpvl_next(c->component_iterator)) {
677 icalcomponent *p = (icalcomponent *)icalpvl_data(c->component_iterator);
690 icalcomponent *cin = (icalcomponent *)c;
712 const icalcomponent *inner;
782 icalproperty *exdate, *exrule;
783 icalpvl_elem property_iterator;
790 property_iterator = comp->property_iterator;
801 comp->property_iterator = property_iterator;
824 comp->property_iterator = property_iterator;
839 comp->property_iterator = property_iterator;
851static bool icalcomponent_is_busy(icalcomponent *comp)
853 const icalproperty *transp;
897 struct icaltimetype ret = t;
907 return icaltime_with_time(t, 0, 0, 0);
912 icaltime_span ret = {0};
929 icaltime_span ret = {0};
958static int icaldatetimeperiod_start_compare(
const void *a,
const void *b)
970 void (*callback)(icalcomponent *comp,
971 const struct icaltime_span *span,
976 icaltime_span recurspan, basespan, limit_span,
977 rrule_span, rdate_span;
978 icaltime_t limit_start, limit_end, last_start;
983 size_t rdate_idx = 0;
985 icalproperty *rrule, *rdate;
986 icalpvl_elem property_iterator;
988 if (comp == NULL || callback == NULL) {
1011 basespan = icaltime_span_new(dtstart, dtend,
true);
1013 basespan.is_busy = (int)icalcomponent_is_busy(comp);
1019 start = icaltime_at_midnight(start);
1028 end = icaltime_at_midnight(end);
1034#if (SIZEOF_ICALTIME_T > 4)
1035 limit_end = (icaltime_t)LONG_MAX;
1037 limit_end = (icaltime_t)INT_MAX;
1040 limit_span.start = limit_start;
1041 limit_span.end = limit_end;
1043 rrule_span.start = rdate_span.start =
1044 last_start = end_timet + 1;
1049 if ((rrule == NULL) &&
1051 last_start = basespan.start;
1053 if (icaltime_span_overlaps(&basespan, &limit_span)) {
1054 (*callback)(comp, &basespan, callback_data);
1061 icalrecur_iterator *rrule_itr = NULL;
1062 if (rrule != NULL) {
1068 if (recur->
count == 0) {
1081 rrule_span = icaltime_span_from_time(rrule_time, dtduration);
1098 if (rdates->num_elements > 0) {
1101 rdate_span = icaltime_span_from_datetimeperiod(rdate_period, dtduration);
1105 if (rdate_idx >= rdates->num_elements ||
1107 rrule_span.start < rdate_span.start)) {
1109 recurspan = rrule_span;
1110 recur_time = rrule_time;
1114 rrule_span = icaltime_span_from_time(rrule_time, dtduration);
1118 recurspan = rdate_span;
1119 recur_time = rdate_period.
time;
1125 if (rdate_idx < rdates->num_elements) {
1127 rdate_span = icaltime_span_from_datetimeperiod(rdate_period, dtduration);
1131 if (recurspan.start > end_timet) {
1135 if (last_start == recurspan.start) {
1138 last_start = recurspan.start;
1141 property_iterator = comp->property_iterator;
1144 &dtstart, &recur_time)) {
1146 if (icaltime_span_overlaps(&recurspan, &limit_span)) {
1147 recurspan.is_busy = basespan.is_busy;
1148 (*callback)(comp, &recurspan, callback_data);
1151 comp->property_iterator = property_iterator;
1157 if (rrule_itr != NULL) {
1164 icalerror_check_arg_rz(comp != 0,
"comp");
1173 icalerror_check_arg_rz((component != 0),
"component");
1175 for (itr = icalpvl_head(component->properties); itr != 0; itr = icalpvl_next(itr)) {
1176 const icalproperty *p = (icalproperty *)icalpvl_data(itr);
1182 for (itr = icalpvl_head(component->components); itr != 0; itr = icalpvl_next(itr)) {
1183 icalcomponent *c = (icalcomponent *)icalpvl_data(itr);
1192 icalpvl_elem itr, next_itr;
1194 icalerror_check_arg_rv((component != 0),
"component");
1196 for (itr = icalpvl_head(component->properties); itr != 0; itr = next_itr) {
1197 icalproperty *p = (icalproperty *)icalpvl_data(itr);
1198 next_itr = icalpvl_next(itr);
1206 for (itr = icalpvl_head(component->components); itr != 0; itr = icalpvl_next(itr)) {
1207 icalcomponent *c = (icalcomponent *)icalpvl_data(itr);
1215 icalproperty *p, *next_p;
1272icalcomponent *icalcomponent_get_parent(
const icalcomponent *component)
1274 return component->parent;
1277void icalcomponent_set_parent(icalcomponent *component, icalcomponent *parent)
1279 component->parent = parent;
1287struct icalcomponent_kind_map {
1292static const struct icalcomponent_kind_map component_map[] = {
1348 if (component_map[i].kind == kind) {
1361 if (component_map[i].kind == kind) {
1362 return component_map[i].name;
1382 if (strncasecmp(
string, component_map[i].name, strlen(component_map[i].name)) == 0) {
1383 return component_map[i].kind;
1387 if (strncasecmp(
string,
"X-", 2) == 0) {
1414 icalerror_check_arg_re(component != 0,
"component", icalcompiter_null);
1416 for (i = icalpvl_head(component->components); i != 0; i = icalpvl_next(i)) {
1417 const icalcomponent *c = (icalcomponent *)icalpvl_data(i);
1426 return icalcompiter_null;
1436 icalerror_check_arg_re(component != 0,
"component", icalcompiter_null);
1438 for (i = icalpvl_tail(component->components); i != 0; i = icalpvl_prior(i)) {
1439 const icalcomponent *c = (icalcomponent *)icalpvl_data(i);
1442 itr.iter = icalpvl_next(i);
1448 return icalcompiter_null;
1453 icalerror_check_arg_rz((i != 0),
"i");
1459 for (i->iter = icalpvl_next(i->iter); i->iter != 0; i->iter = icalpvl_next(i->iter)) {
1460 const icalcomponent *c = (icalcomponent *)icalpvl_data(i->iter);
1472 icalerror_check_arg_rz((i != 0),
"i");
1478 for (i->iter = icalpvl_prior(i->iter); i->iter != 0; i->iter = icalpvl_prior(i->iter)) {
1479 const icalcomponent *c = (icalcomponent *)icalpvl_data(i->iter);
1491 icalerror_check_arg_rz((i != 0),
"i");
1497 return icalpvl_data(i->iter);
1502 icalerror_check_arg_re(component != 0,
"component", icalpropiter_null);
1506 for (i = icalpvl_head(component->properties); i != 0; i = icalpvl_next(i)) {
1507 const icalproperty *p = (icalproperty *)icalpvl_data(i);
1510 icalpropiter itr = {kind, i};
1515 return icalpropiter_null;
1532 icalerror_check_arg_rz((i != 0),
"i");
1538 for (i->iter = icalpvl_next(i->iter); i->iter != 0; i->iter = icalpvl_next(i->iter)) {
1539 const icalproperty *p = (icalproperty *)icalpvl_data(i->iter);
1551 icalerror_check_arg_rz((i != 0),
"i");
1557 return icalpvl_data(i->iter);
1593#define ICALSETUPSET(p_kind) \
1594 icalcomponent *inner; \
1595 icalproperty *prop; \
1596 icalerror_check_arg_rv(comp != 0, "comp"); \
1597 inner = icalcomponent_get_inner(comp); \
1599 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); \
1602 prop = icalcomponent_get_first_property(inner, p_kind);
1642 icalproperty *end_prop, *dur_prop;
1658 if (end_prop != 0 && dur_prop == 0) {
1660 }
else if (end_prop == 0 && dur_prop != 0) {
1672 }
else if (end_prop == 0 && dur_prop == 0) {
1740 icalproperty *end_prop, *dur_prop;
1759 if (dur_prop != 0 && end_prop == 0) {
1762 }
else if (end_prop != 0 && dur_prop == 0) {
1768 }
else if (end_prop == 0 && dur_prop == 0) {
1820 icalcomponent *inner;
1823 icalerror_check_arg_rz(comp != 0,
"comp");
1855 icalcomponent *inner;
1858 icalerror_check_arg_rz(comp != 0,
"comp");
1890 icalcomponent *inner;
1893 icalerror_check_arg_rz(comp != 0,
"comp");
1933 icalcomponent *inner;
1971 icalcomponent *inner;
1974 icalerror_check_arg_rz(comp != 0,
"comp");
2006 icalcomponent *inner;
2009 icalerror_check_arg_rz(comp != 0,
"comp");
2041 icalcomponent *inner;
2044 icalerror_check_arg_rz(comp != 0,
"comp");
2076 icalcomponent *inner;
2079 icalerror_check_arg_rz(comp != 0,
"comp");
2213 icalcomponent *subcomp, *next_subcomp;
2214 icalstrarray *tzids_to_rename;
2224 if (!tzids_to_rename) {
2233 if (!icalcomponent_merge_vtimezone(comp, subcomp, tzids_to_rename)) {
2236 subcomp = next_subcomp;
2241 icalcomponent_rename_tzids(comp_to_merge, tzids_to_rename);
2244 tzids_to_rename = 0;
2254 subcomp = next_subcomp;
2262static bool icalcomponent_merge_vtimezone(icalcomponent *comp,
2263 icalcomponent *vtimezone, icalstrarray *tzids_to_rename)
2265 icalproperty *tzid_prop;
2286 if (!existing_vtimezone) {
2294 if (tzid[0] ==
'/') {
2310 bool merged = (match != -1);
2313 merged = icalcomponent_handle_conflicting_vtimezones(comp, vtimezone, tzid_prop,
2314 tzid_copy, tzids_to_rename);
2320static bool icalcomponent_handle_conflicting_vtimezones(icalcomponent *comp,
2321 icalcomponent *vtimezone,
2322 icalproperty *tzid_prop,
2324 icalstrarray *tzids_to_rename)
2327 size_t i, num_elements, tzid_len;
2328 char *new_tzid, suffix_buf[32];
2331 tzid_len = icalcomponent_get_tzid_prefix_len(tzid);
2340 num_elements = comp->timezones ? comp->timezones->num_elements : 0;
2341 for (i = 0; i < num_elements; i++) {
2343 const char *existing_tzid;
2344 size_t existing_tzid_len;
2350 existing_tzid_len = icalcomponent_get_tzid_prefix_len(existing_tzid);
2353 if (tzid_len == existing_tzid_len && strncmp(tzid, existing_tzid, tzid_len) == 0) {
2369 const char *t = existing_tzid + existing_tzid_len;
2370 const long suffix = strtol(t, &t_end, 10);
2371 if (t != t_end && suffix > max_suffix && suffix < INT_MAX) {
2372 max_suffix = (int)suffix;
2379 snprintf(suffix_buf,
sizeof(suffix_buf),
"%i", max_suffix + 1);
2380 const size_t len_new_tzid = tzid_len + strlen(suffix_buf) + 1;
2386 strncpy(new_tzid, tzid, tzid_len);
2387 new_tzid[tzid_len] =
'\0';
2388 strncat(new_tzid, suffix_buf, len_new_tzid);
2389 new_tzid[len_new_tzid - 1] =
'\0';
2403static size_t icalcomponent_get_tzid_prefix_len(
const char *tzid)
2410 while (len > 0 && *p >=
'0' && *p <=
'9') {
2423static void icalcomponent_rename_tzids(icalcomponent *comp, icalstrarray *rename_table)
2428static void icalcomponent_rename_tzids_callback(
icalparameter *param,
void *data)
2430 icalstrarray *rename_table = data;
2444 if (from && to && !strcmp(tzid, from)) {
2453 void *callback_data)
2456 icalcomponent *subcomp;
2472 (*callback)(param, callback_data);
2490 size_t lower, upper;
2492 if (!comp->timezones) {
2497 if (!comp->timezones_sorted) {
2498 icalarray_sort(comp->timezones, icalcomponent_compare_timezone_fn);
2499 comp->timezones_sorted = 1;
2504 upper = comp->timezones->num_elements;
2506 while (lower < upper) {
2507 size_t middle = (lower + upper) >> 1;
2510 if (zone_tzid != NULL) {
2511 int cmp = strcmp(tzid, zone_tzid);
2514 }
else if (cmp < 0) {
2528static int icalcomponent_compare_timezone_fn(
const void *elem1,
const void *elem2)
2530 bool zone1_is_valid =
false, zone2_is_valid =
false;
2531 const char *zone1_tzid = 0, *zone2_tzid = 0;
2539 zone1_is_valid =
true;
2545 zone2_is_valid =
true;
2549 if (zone1_is_valid && !zone2_is_valid) {
2552 if (!zone1_is_valid) {
2553 if (zone2_is_valid) {
2560 return strcmp(zone1_tzid, zone2_tzid);
2567static int icalcomponent_compare_vtimezones(icalcomponent *vtimezone1, icalcomponent *vtimezone2)
2569 icalproperty *prop1, *prop2;
2570 const char *tzid1, *tzid2;
2571 char *tzid2_copy, *string1, *string2;
2620 cmp = strcmp(string1, string2);
2629 return (cmp == 0) ? 1 : 0;
2646 icalcomponent *inner;
2649 icalerror_check_arg_rz(comp != 0,
"comp");
2674 if (due_prop != 0) {
2676 }
else if (dur_prop != 0) {
2697 if (due_prop == 0 && dur_prop == 0) {
2700 }
else if (due_prop != 0) {
2703 }
else if (dur_prop != 0) {
2718static int strcmpsafe(
const char *a,
const char *b)
2720 return strcmp((a == NULL ?
"" : a),
2721 (b == NULL ?
"" : b));
2724static int prop_compare(
void *a,
void *b)
2726 const icalproperty *p1 = (icalproperty *)a;
2727 const icalproperty *p2 = (icalproperty *)b;
2730 int r = (int)k1 - (
int)k2;
2747static inline int compare_nullptr(
const void *a,
const void *b)
2757static int comp_compare(
void *a,
void *b)
2759 icalcomponent *c1 = (icalcomponent *)a;
2760 icalcomponent *c2 = (icalcomponent *)b;
2763 int r = (int)k1 - (
int)k2;
2767 (c1->x_name && c2->x_name)) {
2768 r = strcmp(c1->x_name, c2->x_name);
2783 const icalproperty *p1, *p2;
2803 r = compare_nullptr(p1, p2);
2807 r = compare_nullptr(p1, p2);
2821 r = compare_nullptr(p1, p2);
2836 r = compare_nullptr(p1, p2);
2850 r = compare_nullptr(p1, p2);
2864 r = compare_nullptr(p1, p2);
2886static bool string_contains_non_printing(
const char *s)
2888 while (*s && isgraph((
unsigned char)*s)) {
2897 icalpvl_list sorted_props;
2898 icalpvl_list sorted_comps;
2901 icalerror_check_arg(comp != 0,
"comp");
2906 sorted_props = icalpvl_newlist();
2907 sorted_comps = icalpvl_newlist();
2914 while ((++cnt < max_properties) && ((prop = icalpvl_pop(comp->properties)) != 0)) {
2915 int nparams, remove = 0;
2962 if (!uid || string_contains_non_printing(uid)) {
2976 icalpvl_insert_ordered(sorted_props, prop_compare, prop);
2981 if (cnt == max_properties) {
2982 while ((prop = icalpvl_pop(comp->properties)) != 0) {
2988 icalpvl_free(comp->properties);
2989 comp->properties = sorted_props;
2992 while ((sub = icalpvl_pop(comp->components)) != 0) {
2994 icalpvl_insert_ordered(sorted_comps, comp_compare, sub);
2997 icalpvl_free(comp->components);
2998 comp->components = sorted_comps;
void * icalarray_element_at(icalarray *array, size_t position)
Access an array element.
void icalarray_free(icalarray *array)
void icalarray_sort(icalarray *array, int(*compare)(const void *, const void *))
Sorts the elements of an icalarray using the given comparison function.
void icalarray_append(icalarray *array, const void *element)
Appends an element to an array.
icalarray * icalarray_new(size_t element_size, size_t increment_size)
void icalarray_remove_element_at(icalarray *array, size_t position)
Removes a given element from an array.
void icalcomponent_remove_property_by_kind(icalcomponent *component, icalproperty_kind kind)
void icalcomponent_convert_errors(icalcomponent *component)
icalcomponent * icalcomponent_new_xstandard(void)
void icalcomponent_set_relcalid(icalcomponent *comp, const char *v)
bool icalcomponent_is_valid(const icalcomponent *component)
icalproperty * icalpropiter_deref(icalpropiter *i)
icalcomponent * icalcomponent_new_vagenda(void)
void icalcomponent_set_uid(icalcomponent *comp, const char *v)
icalcomponent_kind icalcomponent_string_to_kind(const char *string)
void icalcomponent_set_x_name(icalcomponent *comp, const char *name)
struct icaltimetype icalcomponent_get_dtend(icalcomponent *comp)
struct icaltimetype icalcomponent_get_dtstart(icalcomponent *comp)
icalcomponent * icalcomponent_new_vlocation(void)
icalproperty * icalcomponent_get_first_property(icalcomponent *c, icalproperty_kind kind)
bool icalcomponent_check_restrictions(icalcomponent *comp)
icalcomponent * icalcomponent_new_vpoll(void)
int icalcomponent_count_properties(icalcomponent *component, icalproperty_kind kind)
icalcomponent * icalcomponent_new_vavailability(void)
icalcomponent * icalcomponent_new_xpatch(void)
icalproperty_method icalcomponent_get_method(icalcomponent *comp)
bool icalcompiter_is_valid(const icalcompiter *i)
icalcomponent * icalcomponent_new_vreply(void)
void icalcomponent_set_recurrenceid(icalcomponent *comp, struct icaltimetype v)
icalcomponent * icalcomponent_new_xvote(void)
struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent *comp)
icalcomponent * icalcompiter_next(icalcompiter *i)
void icalcomponent_set_location(icalcomponent *comp, const char *v)
const char * icalcomponent_get_description(icalcomponent *comp)
void icalcomponent_set_iana_name(icalcomponent *comp, const char *name)
icalcomponent * icalcomponent_get_next_component(icalcomponent *c, icalcomponent_kind kind)
icalcomponent * icalcomponent_get_first_component(icalcomponent *c, icalcomponent_kind kind)
void icalcomponent_set_dtstart(icalcomponent *comp, struct icaltimetype v)
void icalcomponent_set_dtstamp(icalcomponent *comp, struct icaltimetype v)
void icalcomponent_strip_errors(icalcomponent *component)
icalcomponent * icalcomponent_new_vcalendar(void)
void icalcomponent_normalize(icalcomponent *comp)
icalpropiter icalcomponent_begin_property(icalcomponent *component, icalproperty_kind kind)
icalcomponent * icalcomponent_get_current_component(icalcomponent *component)
void icalcomponent_remove_property(icalcomponent *component, icalproperty *property)
char * icalcomponent_as_ical_string(const icalcomponent *component)
const char * icalcomponent_kind_to_string(icalcomponent_kind kind)
enum icalproperty_status icalcomponent_get_status(icalcomponent *comp)
icalcomponent * icalcomponent_new_vjournal(void)
void icalcomponent_remove_component(icalcomponent *parent, icalcomponent *child)
icalcomponent * icalcomponent_new_vpatch(void)
icalcomponent * icalcomponent_new_vfreebusy(void)
icalproperty * icalpropiter_next(icalpropiter *i)
icalcomponent * icalcompiter_deref(icalcompiter *i)
icalcomponent * icalcomponent_vanew(icalcomponent_kind kind,...)
void icalcomponent_set_method(icalcomponent *comp, icalproperty_method method)
icalcomponent * icalcomponent_new(icalcomponent_kind kind)
void icalcomponent_set_summary(icalcomponent *comp, const char *v)
void icalcomponent_set_sequence(icalcomponent *comp, int v)
icalcomponent * icalcomponent_get_inner(icalcomponent *comp)
const char * icalcomponent_get_comment(icalcomponent *comp)
const char * icalcomponent_get_summary(icalcomponent *comp)
icaltime_span icalcomponent_get_span(icalcomponent *comp)
const char * icalcomponent_get_relcalid(icalcomponent *comp)
icalcomponent * icalcomponent_get_first_real_component(const icalcomponent *c)
icalcomponent * icalcomponent_new_vtimezone(void)
struct icaltimetype icalcomponent_get_due(icalcomponent *comp)
void icalcomponent_merge_component(icalcomponent *comp, icalcomponent *comp_to_merge)
bool icalpropiter_is_valid(const icalpropiter *i)
icalcomponent * icalcomponent_new_vresource(void)
bool icalproperty_recurrence_is_excluded(icalcomponent *comp, struct icaltimetype *dtstart, struct icaltimetype *recurtime)
Decides if a recurrence is acceptable.
const char * icalcomponent_get_x_name(const icalcomponent *comp)
int icalcomponent_count_errors(icalcomponent *component)
struct icaldurationtype icalcomponent_get_duration(icalcomponent *comp)
icalcomponent * icalcomponent_clone(const icalcomponent *old)
icalcomponent * icalcomponent_new_iana(const char *iana_name)
icalcomponent * icalcomponent_new_xavailable(void)
icalcomponent * icalcomponent_new_participant(void)
const char * icalcomponent_get_iana_name(const icalcomponent *comp)
icalproperty * icalcomponent_get_current_property(icalcomponent *component)
icaltimezone * icalcomponent_get_timezone(icalcomponent *comp, const char *tzid)
void icalcomponent_set_dtend(icalcomponent *comp, struct icaltimetype v)
const char * icalcomponent_get_uid(icalcomponent *comp)
int icalcomponent_get_sequence(icalcomponent *comp)
icalcompiter icalcomponent_end_component(icalcomponent *component, icalcomponent_kind kind)
const char * icalcomponent_get_component_name(const icalcomponent *comp)
icalcomponent * icalcomponent_new_xdaylight(void)
icalcomponent * icalcomponent_new_valarm(void)
icalcomponent * icalcomponent_new_x(const char *x_name)
void icalcomponent_add_property(icalcomponent *component, icalproperty *property)
void icalcomponent_set_duration(icalcomponent *comp, struct icaldurationtype v)
icalcompiter icalcomponent_begin_component(icalcomponent *component, icalcomponent_kind kind)
char * icalcomponent_as_ical_string_r(const icalcomponent *component)
icalcomponent_kind icalcomponent_isa(const icalcomponent *component)
icalcomponent * icalcompiter_prior(icalcompiter *i)
icalcomponent * icalcomponent_new_vtodo(void)
bool icalcomponent_kind_is_valid(const icalcomponent_kind kind)
char * icalcomponent_get_component_name_r(const icalcomponent *comp)
void icalcomponent_set_status(icalcomponent *comp, enum icalproperty_status v)
void icalcomponent_foreach_tzid(icalcomponent *comp, void(*callback)(icalparameter *param, void *data), void *callback_data)
const char * icalcomponent_get_location(icalcomponent *comp)
void icalcomponent_free(icalcomponent *c)
icalcomponent * icalcomponent_new_vevent(void)
void icalcomponent_set_due(icalcomponent *comp, struct icaltimetype v)
void icalcomponent_foreach_recurrence(icalcomponent *comp, struct icaltimetype start, struct icaltimetype end, void(*callback)(icalcomponent *comp, const struct icaltime_span *span, void *data), void *callback_data)
void icalcomponent_add_component(icalcomponent *parent, icalcomponent *child)
icalproperty * icalcomponent_get_next_property(icalcomponent *c, icalproperty_kind kind)
void icalcomponent_set_description(icalcomponent *comp, const char *v)
icalcomponent * icalcomponent_new_from_string(const char *str)
int icalcomponent_count_components(icalcomponent *component, icalcomponent_kind kind)
void icalcomponent_set_comment(icalcomponent *comp, const char *v)
icalcomponent * icalcomponent_new_vquery(void)
bool icalcomponent_isa_component(const void *component)
icalcomponent * icalcomponent_new_vvoter(void)
struct icaltimetype icalcomponent_get_dtstamp(icalcomponent *comp)
Defines the data structure for iCalendar components.
icalcomponent * icalproperty_get_parent(const icalproperty *property)
struct icaltimetype icalproperty_get_datetime_with_component(icalproperty *prop, icalcomponent *comp)
void icalproperty_set_parent(icalproperty *property, icalcomponent *component)
icalparameter_xlicerrortype icalparameter_get_xlicerrortype(const icalparameter *value)
@ ICAL_XLICERRORTYPE_PARAMETER
void icalparameter_set_tzid(icalparameter *value, const char *v)
const char * icalparameter_get_tzid(const icalparameter *value)
struct icalparameter_impl icalparameter
icalparameter * icalparameter_new_tzid(const char *v)
@ ICAL_XLICERRORTYPE_PROPERTYPARSEERROR
@ ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR
@ ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR
@ ICAL_XLICERRORTYPE_VALUEPARSEERROR
@ ICAL_XLICERRORTYPE_COMPONENTPARSEERROR
void icalproperty_set_dtstart(icalproperty *prop, struct icaltimetype v)
int icalproperty_get_repeat(const icalproperty *prop)
enum icalproperty_transp icalproperty_get_transp(const icalproperty *prop)
const char * icalproperty_get_uid(const icalproperty *prop)
int icalproperty_get_sequence(const icalproperty *prop)
icalproperty * icalproperty_new_comment(const char *v)
void icalproperty_set_tzid(icalproperty *prop, const char *v)
struct icaltimetype icalproperty_get_dtstamp(const icalproperty *prop)
icalproperty * icalproperty_new_description(const char *v)
icalproperty * icalproperty_new_dtend(struct icaltimetype v)
void icalproperty_set_due(icalproperty *prop, struct icaltimetype v)
icalproperty * icalproperty_new_dtstamp(struct icaltimetype v)
void icalproperty_set_uid(icalproperty *prop, const char *v)
const char * icalproperty_get_description(const icalproperty *prop)
icalproperty * icalproperty_new_sequence(int v)
void icalproperty_set_comment(icalproperty *prop, const char *v)
void icalproperty_set_sequence(icalproperty *prop, int v)
void icalproperty_set_dtend(icalproperty *prop, struct icaltimetype v)
const char * icalproperty_get_summary(const icalproperty *prop)
struct icalrecurrencetype * icalproperty_get_exrule(const icalproperty *prop)
icalproperty * icalproperty_new_method(enum icalproperty_method v)
struct icaldurationtype icalproperty_get_duration(const icalproperty *prop)
icalproperty * icalproperty_new_relcalid(const char *v)
void icalproperty_set_duration(icalproperty *prop, struct icaldurationtype v)
const char * icalproperty_get_comment(const icalproperty *prop)
void icalproperty_set_summary(icalproperty *prop, const char *v)
enum icalproperty_status icalproperty_get_status(const icalproperty *prop)
void icalproperty_set_location(icalproperty *prop, const char *v)
enum icalproperty_class icalproperty_get_class(const icalproperty *prop)
void icalproperty_set_recurrenceid(icalproperty *prop, struct icaltimetype v)
struct icalrecurrencetype * icalproperty_get_rrule(const icalproperty *prop)
icalproperty * icalproperty_new_uid(const char *v)
const char * icalproperty_get_tzid(const icalproperty *prop)
struct icaldatetimeperiodtype icalproperty_get_rdate(const icalproperty *prop)
void icalproperty_set_relcalid(icalproperty *prop, const char *v)
enum icalproperty_method icalproperty_get_method(const icalproperty *prop)
void icalproperty_set_method(icalproperty *prop, enum icalproperty_method v)
const char * icalproperty_get_calscale(const icalproperty *prop)
icalproperty * icalproperty_new_summary(const char *v)
icalproperty * icalproperty_new_location(const char *v)
void icalproperty_set_dtstamp(icalproperty *prop, struct icaltimetype v)
const char * icalproperty_get_xlicerror(const icalproperty *prop)
icalproperty * icalproperty_new_duration(struct icaldurationtype v)
icalproperty * icalproperty_new_requeststatus(struct icalreqstattype v)
@ ICAL_DESCRIPTION_PROPERTY
@ ICAL_XLICERROR_PROPERTY
@ ICAL_RECURRENCEID_PROPERTY
@ ICAL_POLLITEMID_PROPERTY
int icalproperty_get_priority(const icalproperty *prop)
void icalproperty_set_description(icalproperty *prop, const char *v)
icalproperty * icalproperty_new_dtstart(struct icaltimetype v)
const char * icalproperty_get_location(const icalproperty *prop)
void icalproperty_set_status(icalproperty *prop, enum icalproperty_status v)
icalproperty * icalproperty_new_due(struct icaltimetype v)
icalproperty * icalproperty_new_status(enum icalproperty_status v)
icalproperty * icalproperty_new_recurrenceid(struct icaltimetype v)
const char * icalproperty_get_relcalid(const icalproperty *prop)
enum icalproperty_transp icalvalue_get_transp(const icalvalue *value)
@ ICAL_TRANSP_TRANSPARENT
@ ICAL_TRANSP_OPAQUENOCONFLICT
@ ICAL_TRANSP_TRANSPARENTNOCONFLICT
struct icalvalue_impl icalvalue
struct icaldurationtype icalduration_from_times(struct icaltimetype t1, struct icaltimetype t2)
Creates a duration from two icaltimetype endpoints.
struct icaltimetype icalduration_extend(struct icaltimetype t, struct icaldurationtype d)
Extends a time duration.
bool icaldurationtype_is_null_duration(struct icaldurationtype d)
Checks if a duration is a null duration.
struct icaldurationtype icaldurationtype_null_duration(void)
Creates a duration with zero length.
@ ICAL_XDAYLIGHT_COMPONENT
@ ICAL_VLOCATION_COMPONENT
@ ICAL_XSTANDARD_COMPONENT
@ ICAL_VFREEBUSY_COMPONENT
@ ICAL_PARTICIPANT_COMPONENT
@ ICAL_VCALENDAR_COMPONENT
@ ICAL_VAVAILABILITY_COMPONENT
@ ICAL_VSCHEDULE_COMPONENT
@ ICAL_VTIMEZONE_COMPONENT
@ ICAL_VJOURNAL_COMPONENT
@ ICAL_VCOMMAND_COMPONENT
@ ICAL_XLICMIMEPART_COMPONENT
@ ICAL_XAVAILABLE_COMPONENT
@ ICAL_XLICINVALID_COMPONENT
@ ICAL_VRESOURCE_COMPONENT
@ ICAL_3_2_INVPARAM_STATUS
@ ICAL_3_0_INVPROPNAME_STATUS
@ ICAL_3_1_INVPROPVAL_STATUS
@ ICAL_3_4_INVCOMP_STATUS
@ ICAL_3_3_INVPARAMVAL_STATUS
void icalerror_set_errno(icalerrorenum x)
Sets the icalerrno to a given error.
Error handling for libical.
@ ICAL_MALFORMEDDATA_ERROR
size_t icallimit_get(icallimits_kind kind)
Defines the interface for getting/setting internal library limits.
void icalmemory_free_buffer(void *buf)
Releases a buffer.
char * icalmemory_strdup(const char *s)
Creates a duplicate of a string.
void icalmemory_append_string(char **buf, char **pos, size_t *buf_size, const char *string)
Appends a string to a buffer.
void * icalmemory_new_buffer(size_t size)
Creates new buffer with the specified size.
void icalmemory_add_tmp_buffer(void *buf)
Adds an externally allocated buffer to the ring.
Common memory management routines.
icalcomponent * icalparser_parse_string(const char *str)
Parses a string and returns the parsed icalcomponent.
icalvalue * icalproperty_get_value(const icalproperty *prop)
bool icalproperty_isa_property(void *property)
void icalproperty_free(icalproperty *p)
char * icalproperty_as_ical_string_r(icalproperty *prop)
icalproperty_kind icalproperty_isa(const icalproperty *p)
int icalproperty_count_parameters(const icalproperty *prop)
const char * icalproperty_get_value_as_string(const icalproperty *prop)
void icalproperty_remove_parameter_by_kind(icalproperty *prop, icalparameter_kind kind)
Removes all parameters with the specified kind.
icalparameter * icalproperty_get_first_parameter(icalproperty *p, icalparameter_kind kind)
void icalproperty_add_parameter(icalproperty *p, icalparameter *parameter)
void icalproperty_normalize(icalproperty *prop)
icalproperty * icalproperty_clone(const icalproperty *old)
const char * icalproperty_get_x_name(const icalproperty *prop)
void icalproperty_set_parameter(icalproperty *prop, icalparameter *parameter)
bool icalrecur_iterator_set_start(icalrecur_iterator *impl, struct icaltimetype start)
void icalrecur_iterator_free(icalrecur_iterator *impl)
icalrecur_iterator * icalrecur_iterator_new(struct icalrecurrencetype *rule, struct icaltimetype dtstart)
struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *impl)
Functions to check if an icalcomponent meets the restrictions imposed by the standard.
bool icalrestriction_check(icalcomponent *comp)
Checks if a given VCALENDAR meets all the restrictions imposed by the standard.
const char * icalstrarray_element_at(icalstrarray *array, size_t position)
Accesses a string stored in the array.
void icalstrarray_append(icalstrarray *array, const char *elem)
Appends a string to the array.
void icalstrarray_free(icalstrarray *array)
Frees this array's memory and all its elements.
size_t icalstrarray_size(const icalstrarray *array)
Indicates the count of strings stored in the array.
#define icalstrarray_new(increment_size)
Creates a new icalstrarray object.
bool icaltime_is_date(const struct icaltimetype t)
const char * icaltime_get_tzid(const struct icaltimetype t)
bool icaltime_is_utc(const struct icaltimetype t)
int icaltime_compare_date_only(const struct icaltimetype a_in, const struct icaltimetype b_in)
bool icaltime_is_null_time(const struct icaltimetype t)
icaltime_t icaltime_as_timet_with_zone(const struct icaltimetype tt, const icaltimezone *zone)
int icaltime_compare(const struct icaltimetype a_in, const struct icaltimetype b_in)
struct icaltimetype icaltime_null_time(void)
icalcomponent * icaltimezone_get_component(icaltimezone *zone)
const char * icaltimezone_get_tzid(icaltimezone *zone)
icaltimezone * icaltimezone_get_utc_timezone(void)
void icaltimezone_free(icaltimezone *zone, int free_struct)
Frees all memory used for the icaltimezone.
Timezone handling routines.
struct _icaltimezone icaltimezone
struct icalperiodtype period
struct icaldurationtype duration
struct icaltimetype start
const icaltimezone * zone