Diffstat (limited to 'libical/src/libical/icalcomponent.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libical/src/libical/icalcomponent.h | 240 |
1 files changed, 240 insertions, 0 deletions
diff --git a/libical/src/libical/icalcomponent.h b/libical/src/libical/icalcomponent.h new file mode 100644 index 0000000..6046bbe --- a/dev/null +++ b/libical/src/libical/icalcomponent.h | |||
@@ -0,0 +1,240 @@ | |||
1 | /* -*- Mode: C -*- */ | ||
2 | /*====================================================================== | ||
3 | FILE: icalcomponent.h | ||
4 | CREATOR: eric 20 March 1999 | ||
5 | |||
6 | |||
7 | (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org | ||
8 | |||
9 | This program is free software; you can redistribute it and/or modify | ||
10 | it under the terms of either: | ||
11 | |||
12 | The LGPL as published by the Free Software Foundation, version | ||
13 | 2.1, available at: http://www.fsf.org/copyleft/lesser.html | ||
14 | |||
15 | Or: | ||
16 | |||
17 | The Mozilla Public License Version 1.0. You may obtain a copy of | ||
18 | the License at http://www.mozilla.org/MPL/ | ||
19 | |||
20 | The original code is icalcomponent.h | ||
21 | |||
22 | ======================================================================*/ | ||
23 | |||
24 | #ifndef ICALCOMPONENT_H | ||
25 | #define ICALCOMPONENT_H | ||
26 | |||
27 | #include "icalproperty.h" | ||
28 | #include "icalvalue.h" | ||
29 | #include "icalenums.h" /* defines icalcomponent_kind */ | ||
30 | #include "icalattendee.h" | ||
31 | #include "pvl.h" | ||
32 | |||
33 | typedef void icalcomponent; | ||
34 | |||
35 | /* This is exposed so that callers will not have to allocate and | ||
36 | deallocate iterators. Pretend that you can't see it. */ | ||
37 | typedef struct icalcompiter | ||
38 | { | ||
39 | icalcomponent_kind kind; | ||
40 | pvl_elem iter; | ||
41 | |||
42 | } icalcompiter; | ||
43 | |||
44 | icalcomponent* icalcomponent_new(icalcomponent_kind kind); | ||
45 | icalcomponent* icalcomponent_new_clone(icalcomponent* component); | ||
46 | icalcomponent* icalcomponent_new_from_string(char* str); | ||
47 | icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...); | ||
48 | void icalcomponent_free(icalcomponent* component); | ||
49 | |||
50 | char* icalcomponent_as_ical_string(icalcomponent* component); | ||
51 | |||
52 | int icalcomponent_is_valid(icalcomponent* component); | ||
53 | |||
54 | icalcomponent_kind icalcomponent_isa(icalcomponent* component); | ||
55 | |||
56 | int icalcomponent_isa_component (void* component); | ||
57 | |||
58 | /* | ||
59 | * Working with properties | ||
60 | */ | ||
61 | |||
62 | void icalcomponent_add_property(icalcomponent* component, | ||
63 | icalproperty* property); | ||
64 | |||
65 | void icalcomponent_remove_property(icalcomponent* component, | ||
66 | icalproperty* property); | ||
67 | |||
68 | int icalcomponent_count_properties(icalcomponent* component, | ||
69 | icalproperty_kind kind); | ||
70 | |||
71 | /* Iterate through the properties */ | ||
72 | icalproperty* icalcomponent_get_current_property(icalcomponent* component); | ||
73 | |||
74 | icalproperty* icalcomponent_get_first_property(icalcomponent* component, | ||
75 | icalproperty_kind kind); | ||
76 | icalproperty* icalcomponent_get_next_property(icalcomponent* component, | ||
77 | icalproperty_kind kind); | ||
78 | |||
79 | |||
80 | /* | ||
81 | * Working with components | ||
82 | */ | ||
83 | |||
84 | |||
85 | /* Return the first VEVENT, VTODO or VJOURNAL sub-component of cop, or | ||
86 | comp if it is one of those types */ | ||
87 | |||
88 | icalcomponent* icalcomponent_get_inner(icalcomponent* comp); | ||
89 | |||
90 | |||
91 | void icalcomponent_add_component(icalcomponent* parent, | ||
92 | icalcomponent* child); | ||
93 | |||
94 | void icalcomponent_remove_component(icalcomponent* parent, | ||
95 | icalcomponent* child); | ||
96 | |||
97 | int icalcomponent_count_components(icalcomponent* component, | ||
98 | icalcomponent_kind kind); | ||
99 | |||
100 | /* Iteration Routines. There are two forms of iterators, internal and | ||
101 | external. The internal ones came first, and are almost completely | ||
102 | sufficient, but they fail badly when you want to construct a loop that | ||
103 | removes components from the container.*/ | ||
104 | |||
105 | |||
106 | /* Iterate through components */ | ||
107 | icalcomponent* icalcomponent_get_current_component (icalcomponent* component); | ||
108 | |||
109 | icalcomponent* icalcomponent_get_first_component(icalcomponent* component, | ||
110 | icalcomponent_kind kind); | ||
111 | icalcomponent* icalcomponent_get_next_component(icalcomponent* component, | ||
112 | icalcomponent_kind kind); | ||
113 | |||
114 | /* Using external iterators */ | ||
115 | icalcompiter icalcomponent_begin_component(icalcomponent* component, | ||
116 | icalcomponent_kind kind); | ||
117 | icalcompiter icalcomponent_end_component(icalcomponent* component, | ||
118 | icalcomponent_kind kind); | ||
119 | icalcomponent* icalcompiter_next(icalcompiter* i); | ||
120 | icalcomponent* icalcompiter_prior(icalcompiter* i); | ||
121 | icalcomponent* icalcompiter_deref(icalcompiter* i); | ||
122 | |||
123 | |||
124 | |||
125 | |||
126 | /* Working with embedded error properties */ | ||
127 | |||
128 | int icalcomponent_count_errors(icalcomponent* component); | ||
129 | |||
130 | /* Remove all X-LIC-ERROR properties*/ | ||
131 | void icalcomponent_strip_errors(icalcomponent* component); | ||
132 | |||
133 | /* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/ | ||
134 | void icalcomponent_convert_errors(icalcomponent* component); | ||
135 | |||
136 | /* Internal operations. They are private, and you should not be using them. */ | ||
137 | icalcomponent* icalcomponent_get_parent(icalcomponent* component); | ||
138 | void icalcomponent_set_parent(icalcomponent* component, | ||
139 | icalcomponent* parent); | ||
140 | |||
141 | /* Kind conversion routiens */ | ||
142 | |||
143 | icalcomponent_kind icalcomponent_string_to_kind(const char* string); | ||
144 | |||
145 | const char* icalcomponent_kind_to_string(icalcomponent_kind kind); | ||
146 | |||
147 | |||
148 | /************* Derived class methods. **************************** | ||
149 | |||
150 | 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 | ||
152 | wrong component subtypes. */ | ||
153 | |||
154 | /* For VCOMPONENT: Return a reference to the first VEVENT, VTODO or | ||
155 | VJOURNAL */ | ||
156 | icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c); | ||
157 | |||
158 | /* For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end | ||
159 | times of an event in UTC */ | ||
160 | struct icaltime_span icalcomponent_get_span(icalcomponent* comp); | ||
161 | |||
162 | /******************** Convienience routines **********************/ | ||
163 | |||
164 | void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v); | ||
165 | struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp); | ||
166 | |||
167 | /* For the icalcomponent routines only, dtend and duration are tied | ||
168 | together. If you call the set routine for one and the other exists, | ||
169 | the routine will calculate the change to the other. That is, if | ||
170 | there is a DTEND and you call set_duration, the routine will modify | ||
171 | DTEND to be the sum of DTSTART and the duration. If you call a get | ||
172 | 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 | ||
174 | routine will create the apcompriate comperty */ | ||
175 | |||
176 | |||
177 | struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp); | ||
178 | void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v); | ||
179 | |||
180 | void icalcomponent_set_duration(icalcomponent* comp, | ||
181 | struct icaldurationtype v); | ||
182 | struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp); | ||
183 | |||
184 | void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method); | ||
185 | icalproperty_method icalcomponent_get_method(icalcomponent* comp); | ||
186 | |||
187 | struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp); | ||
188 | void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v); | ||
189 | |||
190 | |||
191 | void icalcomponent_set_summary(icalcomponent* comp, const char* v); | ||
192 | const char* icalcomponent_get_summary(icalcomponent* comp); | ||
193 | |||
194 | void icalcomponent_set_comment(icalcomponent* comp, const char* v); | ||
195 | const char* icalcomponent_get_comment(icalcomponent* comp); | ||
196 | |||
197 | void icalcomponent_set_uid(icalcomponent* comp, const char* v); | ||
198 | const char* icalcomponent_get_uid(icalcomponent* comp); | ||
199 | |||
200 | void icalcomponent_set_recurrenceid(icalcomponent* comp, | ||
201 | struct icaltimetype v); | ||
202 | struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp); | ||
203 | |||
204 | |||
205 | void icalcomponent_set_organizer(icalcomponent* comp, | ||
206 | struct icalorganizertype org); | ||
207 | struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp); | ||
208 | |||
209 | |||
210 | void icalcomponent_add_attendee(icalcomponent *comp, | ||
211 | struct icalattendeetype attendee); | ||
212 | |||
213 | int icalcomponent_remove_attendee(icalcomponent *comp, char* cuid); | ||
214 | |||
215 | /* Get the Nth attendee. Out of range indices return an attendee | ||
216 | with cuid == 0 */ | ||
217 | struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp, | ||
218 | int index); | ||
219 | |||
220 | |||
221 | |||
222 | |||
223 | /*************** Type Specific routines ***************/ | ||
224 | |||
225 | icalcomponent* icalcomponent_new_vcalendar(); | ||
226 | icalcomponent* icalcomponent_new_vevent(); | ||
227 | icalcomponent* icalcomponent_new_vtodo(); | ||
228 | icalcomponent* icalcomponent_new_vjournal(); | ||
229 | icalcomponent* icalcomponent_new_valarm(); | ||
230 | icalcomponent* icalcomponent_new_vfreebusy(); | ||
231 | icalcomponent* icalcomponent_new_vtimezone(); | ||
232 | icalcomponent* icalcomponent_new_xstandard(); | ||
233 | icalcomponent* icalcomponent_new_xdaylight(); | ||
234 | |||
235 | |||
236 | |||
237 | #endif /* !ICALCOMPONENT_H */ | ||
238 | |||
239 | |||
240 | |||