Libical  2.0
icalcomponent.h
1 /*======================================================================
2  FILE: icalcomponent.h
3  CREATOR: eric 20 March 1999
4 
5  (C) COPYRIGHT 2000, Eric Busboom <eric@softwarestudio.org>
6  http://www.softwarestudio.org
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of either:
10 
11  The LGPL as published by the Free Software Foundation, version
12  2.1, available at: http://www.gnu.org/licenses/lgpl-2.1.html
13 
14  Or:
15 
16  The Mozilla Public License Version 1.0. You may obtain a copy of
17  the License at http://www.mozilla.org/MPL/
18 ======================================================================*/
19 
20 #ifndef ICALCOMPONENT_H
21 #define ICALCOMPONENT_H
22 
23 #include "libical_ical_export.h"
24 #include "icalenums.h" /* defines icalcomponent_kind */
25 #include "icalproperty.h"
26 #include "pvl.h"
27 
28 typedef struct icalcomponent_impl icalcomponent;
29 
30 /* This is exposed so that callers will not have to allocate and
31  deallocate iterators. Pretend that you can't see it. */
32 typedef struct icalcompiter
33 {
34  icalcomponent_kind kind;
35  pvl_elem iter;
36 
37 } icalcompiter;
38 
39 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new(icalcomponent_kind kind);
40 
41 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_clone(icalcomponent *component);
42 
43 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_from_string(const char *str);
44 
45 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_vanew(icalcomponent_kind kind, ...);
46 
47 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_x(const char *x_name);
48 
49 LIBICAL_ICAL_EXPORT void icalcomponent_free(icalcomponent *component);
50 
51 LIBICAL_ICAL_EXPORT char *icalcomponent_as_ical_string(icalcomponent *component);
52 
53 LIBICAL_ICAL_EXPORT char *icalcomponent_as_ical_string_r(icalcomponent *component);
54 
55 LIBICAL_ICAL_EXPORT int icalcomponent_is_valid(icalcomponent *component);
56 
57 LIBICAL_ICAL_EXPORT icalcomponent_kind icalcomponent_isa(const icalcomponent *component);
58 
59 LIBICAL_ICAL_EXPORT int icalcomponent_isa_component(void *component);
60 
61 /*
62  * Working with properties
63  */
64 
65 LIBICAL_ICAL_EXPORT void icalcomponent_add_property(icalcomponent *component,
66  icalproperty *property);
67 
68 LIBICAL_ICAL_EXPORT void icalcomponent_remove_property(icalcomponent *component,
69  icalproperty *property);
70 
71 LIBICAL_ICAL_EXPORT int icalcomponent_count_properties(icalcomponent *component,
72  icalproperty_kind kind);
73 
74 LIBICAL_ICAL_EXPORT icalcomponent *icalproperty_get_parent(const icalproperty *property);
75 
76 /* Iterate through the properties */
77 LIBICAL_ICAL_EXPORT icalproperty *icalcomponent_get_current_property(icalcomponent *component);
78 
79 LIBICAL_ICAL_EXPORT icalproperty *icalcomponent_get_first_property(icalcomponent *component,
80  icalproperty_kind kind);
81 LIBICAL_ICAL_EXPORT icalproperty *icalcomponent_get_next_property(icalcomponent *component,
82  icalproperty_kind kind);
83 
84 /*
85  * Working with components
86  */
87 
88 /* Return the first VEVENT, VTODO or VJOURNAL sub-component of cop, or
89  comp if it is one of those types */
90 
91 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_inner(icalcomponent *comp);
92 
93 LIBICAL_ICAL_EXPORT void icalcomponent_add_component(icalcomponent *parent, icalcomponent *child);
94 
95 LIBICAL_ICAL_EXPORT void icalcomponent_remove_component(icalcomponent *parent,
96  icalcomponent *child);
97 
98 LIBICAL_ICAL_EXPORT int icalcomponent_count_components(icalcomponent *component,
99  icalcomponent_kind kind);
100 
105 LIBICAL_ICAL_EXPORT void icalcomponent_merge_component(icalcomponent *comp,
106  icalcomponent *comp_to_merge);
107 
108 /* Iteration Routines. There are two forms of iterators, internal and
109 external. The internal ones came first, and are almost completely
110 sufficient, but they fail badly when you want to construct a loop that
111 removes components from the container.*/
112 
113 /* Iterate through components */
114 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_current_component(icalcomponent *component);
115 
116 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_first_component(icalcomponent *component,
117  icalcomponent_kind kind);
118 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_next_component(icalcomponent *component,
119  icalcomponent_kind kind);
120 
121 /* Using external iterators */
122 LIBICAL_ICAL_EXPORT icalcompiter icalcomponent_begin_component(icalcomponent *component,
123  icalcomponent_kind kind);
124 
125 LIBICAL_ICAL_EXPORT icalcompiter icalcomponent_end_component(icalcomponent *component,
126  icalcomponent_kind kind);
127 
128 LIBICAL_ICAL_EXPORT icalcomponent *icalcompiter_next(icalcompiter * i);
129 
130 LIBICAL_ICAL_EXPORT icalcomponent *icalcompiter_prior(icalcompiter * i);
131 
132 LIBICAL_ICAL_EXPORT icalcomponent *icalcompiter_deref(icalcompiter * i);
133 
134 /* Working with embedded error properties */
135 
136 /* Check the component against itip rules and insert error properties*/
137 /* Working with embedded error properties */
138 LIBICAL_ICAL_EXPORT int icalcomponent_check_restrictions(icalcomponent *comp);
139 
141 LIBICAL_ICAL_EXPORT int icalcomponent_count_errors(icalcomponent *component);
142 
144 LIBICAL_ICAL_EXPORT void icalcomponent_strip_errors(icalcomponent *component);
145 
147 LIBICAL_ICAL_EXPORT void icalcomponent_convert_errors(icalcomponent *component);
148 
149 /* Internal operations. They are private, and you should not be using them. */
150 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_parent(icalcomponent *component);
151 
152 LIBICAL_ICAL_EXPORT void icalcomponent_set_parent(icalcomponent *component,
153  icalcomponent *parent);
154 
155 /* Kind conversion routines */
156 
157 LIBICAL_ICAL_EXPORT int icalcomponent_kind_is_valid(const icalcomponent_kind kind);
158 
159 LIBICAL_ICAL_EXPORT icalcomponent_kind icalcomponent_string_to_kind(const char *string);
160 
161 LIBICAL_ICAL_EXPORT const char *icalcomponent_kind_to_string(icalcomponent_kind kind);
162 
163 /************* Derived class methods. ****************************
164 
165 If the code was in an OO language, the remaining routines would be
166 members of classes derived from icalcomponent. Don't call them on the
167 wrong component subtypes. */
168 
171 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_get_first_real_component(icalcomponent *c);
172 
175 LIBICAL_ICAL_EXPORT struct icaltime_span icalcomponent_get_span(icalcomponent *comp);
176 
177 /******************** Convenience routines **********************/
178 
179 LIBICAL_ICAL_EXPORT void icalcomponent_set_dtstart(icalcomponent *comp, struct icaltimetype v);
180 LIBICAL_ICAL_EXPORT struct icaltimetype icalcomponent_get_dtstart(icalcomponent *comp);
181 
182 /* For the icalcomponent routines only, dtend and duration are tied
183  together. If you call the set routine for one and the other exists,
184  the routine will calculate the change to the other. That is, if
185  there is a DTEND and you call set_duration, the routine will modify
186  DTEND to be the sum of DTSTART and the duration. If you call a get
187  routine for one and the other exists, the routine will calculate
188  the return value. If you call a set routine and neither exists, the
189  routine will create the apcompriate comperty */
190 
191 LIBICAL_ICAL_EXPORT struct icaltimetype icalcomponent_get_dtend(icalcomponent *comp);
192 
193 LIBICAL_ICAL_EXPORT void icalcomponent_set_dtend(icalcomponent *comp, struct icaltimetype v);
194 
195 LIBICAL_ICAL_EXPORT struct icaltimetype icalcomponent_get_due(icalcomponent *comp);
196 
197 LIBICAL_ICAL_EXPORT void icalcomponent_set_due(icalcomponent *comp, struct icaltimetype v);
198 
199 LIBICAL_ICAL_EXPORT void icalcomponent_set_duration(icalcomponent *comp,
200  struct icaldurationtype v);
201 
202 LIBICAL_ICAL_EXPORT struct icaldurationtype icalcomponent_get_duration(icalcomponent *comp);
203 
204 LIBICAL_ICAL_EXPORT void icalcomponent_set_method(icalcomponent *comp, icalproperty_method method);
205 
206 LIBICAL_ICAL_EXPORT icalproperty_method icalcomponent_get_method(icalcomponent *comp);
207 
208 LIBICAL_ICAL_EXPORT struct icaltimetype icalcomponent_get_dtstamp(icalcomponent *comp);
209 
210 LIBICAL_ICAL_EXPORT void icalcomponent_set_dtstamp(icalcomponent *comp, struct icaltimetype v);
211 
212 LIBICAL_ICAL_EXPORT void icalcomponent_set_summary(icalcomponent *comp, const char *v);
213 
214 LIBICAL_ICAL_EXPORT const char *icalcomponent_get_summary(icalcomponent *comp);
215 
216 LIBICAL_ICAL_EXPORT void icalcomponent_set_comment(icalcomponent *comp, const char *v);
217 
218 LIBICAL_ICAL_EXPORT const char *icalcomponent_get_comment(icalcomponent *comp);
219 
220 LIBICAL_ICAL_EXPORT void icalcomponent_set_uid(icalcomponent *comp, const char *v);
221 
222 LIBICAL_ICAL_EXPORT const char *icalcomponent_get_uid(icalcomponent *comp);
223 
224 LIBICAL_ICAL_EXPORT void icalcomponent_set_relcalid(icalcomponent *comp, const char *v);
225 
226 LIBICAL_ICAL_EXPORT const char *icalcomponent_get_relcalid(icalcomponent *comp);
227 
228 LIBICAL_ICAL_EXPORT void icalcomponent_set_recurrenceid(icalcomponent *comp,
229  struct icaltimetype v);
230 
231 LIBICAL_ICAL_EXPORT struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent *comp);
232 
233 LIBICAL_ICAL_EXPORT void icalcomponent_set_description(icalcomponent *comp, const char *v);
234 
235 LIBICAL_ICAL_EXPORT const char *icalcomponent_get_description(icalcomponent *comp);
236 
237 LIBICAL_ICAL_EXPORT void icalcomponent_set_location(icalcomponent *comp, const char *v);
238 
239 LIBICAL_ICAL_EXPORT const char *icalcomponent_get_location(icalcomponent *comp);
240 
241 LIBICAL_ICAL_EXPORT void icalcomponent_set_sequence(icalcomponent *comp, int v);
242 
243 LIBICAL_ICAL_EXPORT int icalcomponent_get_sequence(icalcomponent *comp);
244 
245 LIBICAL_ICAL_EXPORT void icalcomponent_set_status(icalcomponent *comp, enum icalproperty_status v);
246 
247 LIBICAL_ICAL_EXPORT enum icalproperty_status icalcomponent_get_status(icalcomponent *comp);
248 
251 LIBICAL_ICAL_EXPORT void icalcomponent_foreach_tzid(icalcomponent *comp,
252  void (*callback) (icalparameter *param,
253  void *data),
254  void *callback_data);
255 
258 LIBICAL_ICAL_EXPORT icaltimezone *icalcomponent_get_timezone(icalcomponent *comp,
259  const char *tzid);
260 
261 LIBICAL_ICAL_EXPORT int icalproperty_recurrence_is_excluded(icalcomponent *comp,
262  struct icaltimetype *dtstart,
263  struct icaltimetype *recurtime);
264 
265 LIBICAL_ICAL_EXPORT void icalcomponent_foreach_recurrence(icalcomponent *comp,
266  struct icaltimetype start,
267  struct icaltimetype end,
268  void (*callback) (icalcomponent *comp,
269  struct icaltime_span *
270  span, void *data),
271  void *callback_data);
272 
273 /*************** Type Specific routines ***************/
274 
275 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vcalendar(void);
276 
277 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vevent(void);
278 
279 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vtodo(void);
280 
281 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vjournal(void);
282 
283 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_valarm(void);
284 
285 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vfreebusy(void);
286 
287 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vtimezone(void);
288 
289 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_xstandard(void);
290 
291 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_xdaylight(void);
292 
293 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vagenda(void);
294 
295 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vquery(void);
296 
297 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vavailability(void);
298 
299 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_xavailable(void);
300 
301 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vpoll(void);
302 
303 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_vvoter(void);
304 
305 LIBICAL_ICAL_EXPORT icalcomponent *icalcomponent_new_xvote(void);
306 
307 #endif /* !ICALCOMPONENT_H */
Definition: icaltime.h:99
Definition: icalduration.h:29
Definition: icalcomponent.c:33
Definition: icalcomponent.h:32
Definition: pvl.h:34
Definition: icaltime.h:114
Definition: icaltimezoneimpl.h:23