summaryrefslogtreecommitdiffabout
path: root/libical/src/libical/icalcomponent.h
Unidiff
Diffstat (limited to 'libical/src/libical/icalcomponent.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libical/src/libical/icalcomponent.h90
1 files changed, 66 insertions, 24 deletions
diff --git a/libical/src/libical/icalcomponent.h b/libical/src/libical/icalcomponent.h
index 6046bbe..be9bf8c 100644
--- a/libical/src/libical/icalcomponent.h
+++ b/libical/src/libical/icalcomponent.h
@@ -22,20 +22,28 @@
22======================================================================*/ 22======================================================================*/
23 23
24#ifndef ICALCOMPONENT_H 24#ifndef ICALCOMPONENT_H
25#define ICALCOMPONENT_H 25#define ICALCOMPONENT_H
26 26
27#include "icalproperty.h" 27#include "icalproperty.h"
28#include "icalvalue.h" 28#include "icalvalue.h"
29#include "icalenums.h" /* defines icalcomponent_kind */ 29#include "icalenums.h" /* defines icalcomponent_kind */
30#include "icalattendee.h"
31#include "pvl.h" 30#include "pvl.h"
32 31
33typedef void icalcomponent; 32typedef struct icalcomponent_impl icalcomponent;
33
34#ifndef ICALTIMEZONE_DEFINED
35#define ICALTIMEZONE_DEFINED
36/** @brief An opaque struct representing a timezone.
37 * We declare this here to avoid a circular dependancy.
38 */
39 typedef struct _icaltimezone icaltimezone;
40#endif
41
34 42
35/* This is exposed so that callers will not have to allocate and 43/* This is exposed so that callers will not have to allocate and
36 deallocate iterators. Pretend that you can't see it. */ 44 deallocate iterators. Pretend that you can't see it. */
37typedef struct icalcompiter 45typedef struct icalcompiter
38{ 46{
39 icalcomponent_kind kind; 47 icalcomponent_kind kind;
40 pvl_elem iter; 48 pvl_elem iter;
41 49
@@ -46,17 +54,17 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* component);
46icalcomponent* icalcomponent_new_from_string(char* str); 54icalcomponent* icalcomponent_new_from_string(char* str);
47icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...); 55icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...);
48void icalcomponent_free(icalcomponent* component); 56void icalcomponent_free(icalcomponent* component);
49 57
50char* icalcomponent_as_ical_string(icalcomponent* component); 58char* icalcomponent_as_ical_string(icalcomponent* component);
51 59
52int icalcomponent_is_valid(icalcomponent* component); 60int icalcomponent_is_valid(icalcomponent* component);
53 61
54icalcomponent_kind icalcomponent_isa(icalcomponent* component); 62icalcomponent_kind icalcomponent_isa(const icalcomponent* component);
55 63
56int icalcomponent_isa_component (void* component); 64int icalcomponent_isa_component (void* component);
57 65
58/* 66/*
59 * Working with properties 67 * Working with properties
60 */ 68 */
61 69
62void icalcomponent_add_property(icalcomponent* component, 70void icalcomponent_add_property(icalcomponent* component,
@@ -92,16 +100,24 @@ void icalcomponent_add_component(icalcomponent* parent,
92 icalcomponent* child); 100 icalcomponent* child);
93 101
94void icalcomponent_remove_component(icalcomponent* parent, 102void icalcomponent_remove_component(icalcomponent* parent,
95 icalcomponent* child); 103 icalcomponent* child);
96 104
97int icalcomponent_count_components(icalcomponent* component, 105int icalcomponent_count_components(icalcomponent* component,
98 icalcomponent_kind kind); 106 icalcomponent_kind kind);
99 107
108/**
109 This takes 2 VCALENDAR components and merges the second one into the first,
110 resolving any problems with conflicting TZIDs. comp_to_merge will no
111 longer exist after calling this function. */
112void icalcomponent_merge_component(icalcomponent* comp,
113 icalcomponent* comp_to_merge);
114
115
100/* Iteration Routines. There are two forms of iterators, internal and 116/* Iteration Routines. There are two forms of iterators, internal and
101external. The internal ones came first, and are almost completely 117external. The internal ones came first, and are almost completely
102sufficient, but they fail badly when you want to construct a loop that 118sufficient, but they fail badly when you want to construct a loop that
103removes components from the container.*/ 119removes components from the container.*/
104 120
105 121
106/* Iterate through components */ 122/* Iterate through components */
107icalcomponent* icalcomponent_get_current_component (icalcomponent* component); 123icalcomponent* icalcomponent_get_current_component (icalcomponent* component);
@@ -116,51 +132,57 @@ icalcompiter icalcomponent_begin_component(icalcomponent* component,
116 icalcomponent_kind kind); 132 icalcomponent_kind kind);
117icalcompiter icalcomponent_end_component(icalcomponent* component, 133icalcompiter icalcomponent_end_component(icalcomponent* component,
118 icalcomponent_kind kind); 134 icalcomponent_kind kind);
119icalcomponent* icalcompiter_next(icalcompiter* i); 135icalcomponent* icalcompiter_next(icalcompiter* i);
120icalcomponent* icalcompiter_prior(icalcompiter* i); 136icalcomponent* icalcompiter_prior(icalcompiter* i);
121icalcomponent* icalcompiter_deref(icalcompiter* i); 137icalcomponent* icalcompiter_deref(icalcompiter* i);
122 138
123 139
140/* Working with embedded error properties */
124 141
125 142
143/* Check the component against itip rules and insert error properties*/
126/* Working with embedded error properties */ 144/* Working with embedded error properties */
145int icalcomponent_check_restrictions(icalcomponent* comp);
127 146
147/** Count embedded errors. */
128int icalcomponent_count_errors(icalcomponent* component); 148int icalcomponent_count_errors(icalcomponent* component);
129 149
130/* Remove all X-LIC-ERROR properties*/ 150/** Remove all X-LIC-ERROR properties*/
131void icalcomponent_strip_errors(icalcomponent* component); 151void icalcomponent_strip_errors(icalcomponent* component);
132 152
133/* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/ 153/** Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/
134void icalcomponent_convert_errors(icalcomponent* component); 154void icalcomponent_convert_errors(icalcomponent* component);
135 155
136/* Internal operations. They are private, and you should not be using them. */ 156/* Internal operations. They are private, and you should not be using them. */
137icalcomponent* icalcomponent_get_parent(icalcomponent* component); 157icalcomponent* icalcomponent_get_parent(icalcomponent* component);
138void icalcomponent_set_parent(icalcomponent* component, 158void icalcomponent_set_parent(icalcomponent* component,
139 icalcomponent* parent); 159 icalcomponent* parent);
140 160
141/* Kind conversion routiens */ 161/* Kind conversion routines */
162
163int icalcomponent_kind_is_valid(const icalcomponent_kind kind);
142 164
143icalcomponent_kind icalcomponent_string_to_kind(const char* string); 165icalcomponent_kind icalcomponent_string_to_kind(const char* string);
144 166
145const char* icalcomponent_kind_to_string(icalcomponent_kind kind); 167const char* icalcomponent_kind_to_string(icalcomponent_kind kind);
146 168
147 169
148/************* Derived class methods. **************************** 170/************* Derived class methods. ****************************
149 171
150If the code was in an OO language, the remaining routines would be 172If the code was in an OO language, the remaining routines would be
151members of classes derived from icalcomponent. Don't call them on the 173members of classes derived from icalcomponent. Don't call them on the
152wrong component subtypes. */ 174wrong component subtypes. */
153 175
154/* For VCOMPONENT: Return a reference to the first VEVENT, VTODO or 176/** For VCOMPONENT: Return a reference to the first VEVENT, VTODO or
155 VJOURNAL */ 177 VJOURNAL */
156icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c); 178icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c);
157 179
158/* For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end 180/** For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end
159 times of an event in UTC */ 181 times of an event in UTC */
160struct icaltime_span icalcomponent_get_span(icalcomponent* comp); 182struct icaltime_span icalcomponent_get_span(icalcomponent* comp);
161 183
162/******************** Convienience routines **********************/ 184/******************** Convienience routines **********************/
163 185
164void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v); 186void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v);
165struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp); 187struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp);
166 188
@@ -172,69 +194,89 @@ struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp);
172 routine for one and the other exists, the routine will calculate 194 routine for one and the other exists, the routine will calculate
173 the return value. If you call a set routine and neither exists, the 195 the return value. If you call a set routine and neither exists, the
174 routine will create the apcompriate comperty */ 196 routine will create the apcompriate comperty */
175 197
176 198
177struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp); 199struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp);
178void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v); 200void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v);
179 201
202struct icaltimetype icalcomponent_get_due(icalcomponent* comp);
203void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v);
204
180void icalcomponent_set_duration(icalcomponent* comp, 205void icalcomponent_set_duration(icalcomponent* comp,
181 struct icaldurationtype v); 206 struct icaldurationtype v);
182struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp); 207struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp);
183 208
184void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method); 209void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method);
185icalproperty_method icalcomponent_get_method(icalcomponent* comp); 210icalproperty_method icalcomponent_get_method(icalcomponent* comp);
186 211
187struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp); 212struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp);
188void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v); 213void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v);
189 214
190
191void icalcomponent_set_summary(icalcomponent* comp, const char* v); 215void icalcomponent_set_summary(icalcomponent* comp, const char* v);
192const char* icalcomponent_get_summary(icalcomponent* comp); 216const char* icalcomponent_get_summary(icalcomponent* comp);
193 217
194void icalcomponent_set_comment(icalcomponent* comp, const char* v); 218void icalcomponent_set_comment(icalcomponent* comp, const char* v);
195const char* icalcomponent_get_comment(icalcomponent* comp); 219const char* icalcomponent_get_comment(icalcomponent* comp);
196 220
197void icalcomponent_set_uid(icalcomponent* comp, const char* v); 221void icalcomponent_set_uid(icalcomponent* comp, const char* v);
198const char* icalcomponent_get_uid(icalcomponent* comp); 222const char* icalcomponent_get_uid(icalcomponent* comp);
199 223
224void icalcomponent_set_relcalid(icalcomponent* comp, const char* v);
225const char* icalcomponent_get_relcalid(icalcomponent* comp);
226
200void icalcomponent_set_recurrenceid(icalcomponent* comp, 227void icalcomponent_set_recurrenceid(icalcomponent* comp,
201 struct icaltimetype v); 228 struct icaltimetype v);
202struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp); 229struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
203 230
231void icalcomponent_set_description(icalcomponent* comp, const char* v);
232const char* icalcomponent_get_description(icalcomponent* comp);
204 233
205void icalcomponent_set_organizer(icalcomponent* comp, 234void icalcomponent_set_location(icalcomponent* comp, const char* v);
206 struct icalorganizertype org); 235const char* icalcomponent_get_location(icalcomponent* comp);
207 struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp);
208 236
237void icalcomponent_set_sequence(icalcomponent* comp, int v);
238int icalcomponent_get_sequence(icalcomponent* comp);
209 239
210void icalcomponent_add_attendee(icalcomponent *comp, 240void icalcomponent_set_status(icalcomponent* comp, enum icalproperty_status v);
211 struct icalattendeetype attendee); 241enum icalproperty_status icalcomponent_get_status(icalcomponent* comp);
212 242
213int icalcomponent_remove_attendee(icalcomponent *comp, char* cuid);
214 243
215/* Get the Nth attendee. Out of range indices return an attendee 244/** Calls the given function for each TZID parameter found in the
216 with cuid == 0 */ 245 component, and any subcomponents. */
217struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp, 246void icalcomponent_foreach_tzid(icalcomponent* comp,
218 int index); 247 void (*callback)(icalparameter *param, void *data),
248 void *callback_data);
219 249
250/** Returns the icaltimezone in the component corresponding to the
251 TZID, or NULL if it can't be found. */
252icaltimezone* icalcomponent_get_timezone(icalcomponent* comp,
253 const char *tzid);
220 254
255int icalproperty_recurrence_is_excluded(icalcomponent *comp,
256 struct icaltimetype *dtstart,
257 struct icaltimetype *recurtime);
258
259void icalcomponent_foreach_recurrence(icalcomponent* comp,
260 struct icaltimetype start,
261 struct icaltimetype end,
262 void (*callback)(icalcomponent *comp,
263 struct icaltime_span *span,
264 void *data),
265 void *callback_data);
221 266
222 267
223/*************** Type Specific routines ***************/ 268/*************** Type Specific routines ***************/
224 269
225icalcomponent* icalcomponent_new_vcalendar(); 270icalcomponent* icalcomponent_new_vcalendar();
226icalcomponent* icalcomponent_new_vevent(); 271icalcomponent* icalcomponent_new_vevent();
227icalcomponent* icalcomponent_new_vtodo(); 272icalcomponent* icalcomponent_new_vtodo();
228icalcomponent* icalcomponent_new_vjournal(); 273icalcomponent* icalcomponent_new_vjournal();
229icalcomponent* icalcomponent_new_valarm(); 274icalcomponent* icalcomponent_new_valarm();
230icalcomponent* icalcomponent_new_vfreebusy(); 275icalcomponent* icalcomponent_new_vfreebusy();
231icalcomponent* icalcomponent_new_vtimezone(); 276icalcomponent* icalcomponent_new_vtimezone();
232icalcomponent* icalcomponent_new_xstandard(); 277icalcomponent* icalcomponent_new_xstandard();
233icalcomponent* icalcomponent_new_xdaylight(); 278icalcomponent* icalcomponent_new_xdaylight();
234 279icalcomponent* icalcomponent_new_vagenda();
235 280icalcomponent* icalcomponent_new_vquery();
236 281
237#endif /* !ICALCOMPONENT_H */ 282#endif /* !ICALCOMPONENT_H */
238
239
240