Diffstat (limited to 'libical/src/libical/icalcomponent.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libical/src/libical/icalcomponent.h | 90 |
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 | ||
33 | typedef void icalcomponent; | 32 | typedef 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. */ |
37 | typedef struct icalcompiter | 45 | typedef 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); | |||
46 | icalcomponent* icalcomponent_new_from_string(char* str); | 54 | icalcomponent* icalcomponent_new_from_string(char* str); |
47 | icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...); | 55 | icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...); |
48 | void icalcomponent_free(icalcomponent* component); | 56 | void icalcomponent_free(icalcomponent* component); |
49 | 57 | ||
50 | char* icalcomponent_as_ical_string(icalcomponent* component); | 58 | char* icalcomponent_as_ical_string(icalcomponent* component); |
51 | 59 | ||
52 | int icalcomponent_is_valid(icalcomponent* component); | 60 | int icalcomponent_is_valid(icalcomponent* component); |
53 | 61 | ||
54 | icalcomponent_kind icalcomponent_isa(icalcomponent* component); | 62 | icalcomponent_kind icalcomponent_isa(const icalcomponent* component); |
55 | 63 | ||
56 | int icalcomponent_isa_component (void* component); | 64 | int icalcomponent_isa_component (void* component); |
57 | 65 | ||
58 | /* | 66 | /* |
59 | * Working with properties | 67 | * Working with properties |
60 | */ | 68 | */ |
61 | 69 | ||
62 | void icalcomponent_add_property(icalcomponent* component, | 70 | void icalcomponent_add_property(icalcomponent* component, |
@@ -92,16 +100,24 @@ void icalcomponent_add_component(icalcomponent* parent, | |||
92 | icalcomponent* child); | 100 | icalcomponent* child); |
93 | 101 | ||
94 | void icalcomponent_remove_component(icalcomponent* parent, | 102 | void icalcomponent_remove_component(icalcomponent* parent, |
95 | icalcomponent* child); | 103 | icalcomponent* child); |
96 | 104 | ||
97 | int icalcomponent_count_components(icalcomponent* component, | 105 | int 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. */ | ||
112 | void 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 |
101 | external. The internal ones came first, and are almost completely | 117 | external. The internal ones came first, and are almost completely |
102 | sufficient, but they fail badly when you want to construct a loop that | 118 | sufficient, but they fail badly when you want to construct a loop that |
103 | removes components from the container.*/ | 119 | removes components from the container.*/ |
104 | 120 | ||
105 | 121 | ||
106 | /* Iterate through components */ | 122 | /* Iterate through components */ |
107 | icalcomponent* icalcomponent_get_current_component (icalcomponent* component); | 123 | icalcomponent* icalcomponent_get_current_component (icalcomponent* component); |
@@ -116,51 +132,57 @@ icalcompiter icalcomponent_begin_component(icalcomponent* component, | |||
116 | icalcomponent_kind kind); | 132 | icalcomponent_kind kind); |
117 | icalcompiter icalcomponent_end_component(icalcomponent* component, | 133 | icalcompiter icalcomponent_end_component(icalcomponent* component, |
118 | icalcomponent_kind kind); | 134 | icalcomponent_kind kind); |
119 | icalcomponent* icalcompiter_next(icalcompiter* i); | 135 | icalcomponent* icalcompiter_next(icalcompiter* i); |
120 | icalcomponent* icalcompiter_prior(icalcompiter* i); | 136 | icalcomponent* icalcompiter_prior(icalcompiter* i); |
121 | icalcomponent* icalcompiter_deref(icalcompiter* i); | 137 | icalcomponent* 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 */ |
145 | int icalcomponent_check_restrictions(icalcomponent* comp); | ||
127 | 146 | ||
147 | /** Count embedded errors. */ | ||
128 | int icalcomponent_count_errors(icalcomponent* component); | 148 | int icalcomponent_count_errors(icalcomponent* component); |
129 | 149 | ||
130 | /* Remove all X-LIC-ERROR properties*/ | 150 | /** Remove all X-LIC-ERROR properties*/ |
131 | void icalcomponent_strip_errors(icalcomponent* component); | 151 | void 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*/ |
134 | void icalcomponent_convert_errors(icalcomponent* component); | 154 | void 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. */ |
137 | icalcomponent* icalcomponent_get_parent(icalcomponent* component); | 157 | icalcomponent* icalcomponent_get_parent(icalcomponent* component); |
138 | void icalcomponent_set_parent(icalcomponent* component, | 158 | void icalcomponent_set_parent(icalcomponent* component, |
139 | icalcomponent* parent); | 159 | icalcomponent* parent); |
140 | 160 | ||
141 | /* Kind conversion routiens */ | 161 | /* Kind conversion routines */ |
162 | |||
163 | int icalcomponent_kind_is_valid(const icalcomponent_kind kind); | ||
142 | 164 | ||
143 | icalcomponent_kind icalcomponent_string_to_kind(const char* string); | 165 | icalcomponent_kind icalcomponent_string_to_kind(const char* string); |
144 | 166 | ||
145 | const char* icalcomponent_kind_to_string(icalcomponent_kind kind); | 167 | const char* icalcomponent_kind_to_string(icalcomponent_kind kind); |
146 | 168 | ||
147 | 169 | ||
148 | /************* Derived class methods. **************************** | 170 | /************* Derived class methods. **************************** |
149 | 171 | ||
150 | If the code was in an OO language, the remaining routines would be | 172 | If the code was in an OO language, the remaining routines would be |
151 | members of classes derived from icalcomponent. Don't call them on the | 173 | members of classes derived from icalcomponent. Don't call them on the |
152 | wrong component subtypes. */ | 174 | wrong 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 */ |
156 | icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c); | 178 | icalcomponent* 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 */ |
160 | struct icaltime_span icalcomponent_get_span(icalcomponent* comp); | 182 | struct icaltime_span icalcomponent_get_span(icalcomponent* comp); |
161 | 183 | ||
162 | /******************** Convienience routines **********************/ | 184 | /******************** Convienience routines **********************/ |
163 | 185 | ||
164 | void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v); | 186 | void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v); |
165 | struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp); | 187 | struct 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 | ||
177 | struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp); | 199 | struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp); |
178 | void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v); | 200 | void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v); |
179 | 201 | ||
202 | struct icaltimetype icalcomponent_get_due(icalcomponent* comp); | ||
203 | void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v); | ||
204 | |||
180 | void icalcomponent_set_duration(icalcomponent* comp, | 205 | void icalcomponent_set_duration(icalcomponent* comp, |
181 | struct icaldurationtype v); | 206 | struct icaldurationtype v); |
182 | struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp); | 207 | struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp); |
183 | 208 | ||
184 | void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method); | 209 | void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method); |
185 | icalproperty_method icalcomponent_get_method(icalcomponent* comp); | 210 | icalproperty_method icalcomponent_get_method(icalcomponent* comp); |
186 | 211 | ||
187 | struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp); | 212 | struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp); |
188 | void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v); | 213 | void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v); |
189 | 214 | ||
190 | |||
191 | void icalcomponent_set_summary(icalcomponent* comp, const char* v); | 215 | void icalcomponent_set_summary(icalcomponent* comp, const char* v); |
192 | const char* icalcomponent_get_summary(icalcomponent* comp); | 216 | const char* icalcomponent_get_summary(icalcomponent* comp); |
193 | 217 | ||
194 | void icalcomponent_set_comment(icalcomponent* comp, const char* v); | 218 | void icalcomponent_set_comment(icalcomponent* comp, const char* v); |
195 | const char* icalcomponent_get_comment(icalcomponent* comp); | 219 | const char* icalcomponent_get_comment(icalcomponent* comp); |
196 | 220 | ||
197 | void icalcomponent_set_uid(icalcomponent* comp, const char* v); | 221 | void icalcomponent_set_uid(icalcomponent* comp, const char* v); |
198 | const char* icalcomponent_get_uid(icalcomponent* comp); | 222 | const char* icalcomponent_get_uid(icalcomponent* comp); |
199 | 223 | ||
224 | void icalcomponent_set_relcalid(icalcomponent* comp, const char* v); | ||
225 | const char* icalcomponent_get_relcalid(icalcomponent* comp); | ||
226 | |||
200 | void icalcomponent_set_recurrenceid(icalcomponent* comp, | 227 | void icalcomponent_set_recurrenceid(icalcomponent* comp, |
201 | struct icaltimetype v); | 228 | struct icaltimetype v); |
202 | struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp); | 229 | struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp); |
203 | 230 | ||
231 | void icalcomponent_set_description(icalcomponent* comp, const char* v); | ||
232 | const char* icalcomponent_get_description(icalcomponent* comp); | ||
204 | 233 | ||
205 | void icalcomponent_set_organizer(icalcomponent* comp, | 234 | void icalcomponent_set_location(icalcomponent* comp, const char* v); |
206 | struct icalorganizertype org); | 235 | const char* icalcomponent_get_location(icalcomponent* comp); |
207 | struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp); | ||
208 | 236 | ||
237 | void icalcomponent_set_sequence(icalcomponent* comp, int v); | ||
238 | int icalcomponent_get_sequence(icalcomponent* comp); | ||
209 | 239 | ||
210 | void icalcomponent_add_attendee(icalcomponent *comp, | 240 | void icalcomponent_set_status(icalcomponent* comp, enum icalproperty_status v); |
211 | struct icalattendeetype attendee); | 241 | enum icalproperty_status icalcomponent_get_status(icalcomponent* comp); |
212 | 242 | ||
213 | int 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. */ |
217 | struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp, | 246 | void 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. */ | ||
252 | icaltimezone* icalcomponent_get_timezone(icalcomponent* comp, | ||
253 | const char *tzid); | ||
220 | 254 | ||
255 | int icalproperty_recurrence_is_excluded(icalcomponent *comp, | ||
256 | struct icaltimetype *dtstart, | ||
257 | struct icaltimetype *recurtime); | ||
258 | |||
259 | void 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 | ||
225 | icalcomponent* icalcomponent_new_vcalendar(); | 270 | icalcomponent* icalcomponent_new_vcalendar(); |
226 | icalcomponent* icalcomponent_new_vevent(); | 271 | icalcomponent* icalcomponent_new_vevent(); |
227 | icalcomponent* icalcomponent_new_vtodo(); | 272 | icalcomponent* icalcomponent_new_vtodo(); |
228 | icalcomponent* icalcomponent_new_vjournal(); | 273 | icalcomponent* icalcomponent_new_vjournal(); |
229 | icalcomponent* icalcomponent_new_valarm(); | 274 | icalcomponent* icalcomponent_new_valarm(); |
230 | icalcomponent* icalcomponent_new_vfreebusy(); | 275 | icalcomponent* icalcomponent_new_vfreebusy(); |
231 | icalcomponent* icalcomponent_new_vtimezone(); | 276 | icalcomponent* icalcomponent_new_vtimezone(); |
232 | icalcomponent* icalcomponent_new_xstandard(); | 277 | icalcomponent* icalcomponent_new_xstandard(); |
233 | icalcomponent* icalcomponent_new_xdaylight(); | 278 | icalcomponent* icalcomponent_new_xdaylight(); |
234 | 279 | icalcomponent* icalcomponent_new_vagenda(); | |
235 | 280 | icalcomponent* icalcomponent_new_vquery(); | |
236 | 281 | ||
237 | #endif /* !ICALCOMPONENT_H */ | 282 | #endif /* !ICALCOMPONENT_H */ |
238 | |||
239 | |||
240 | |||