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.h240
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
33typedef 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. */
37typedef struct icalcompiter
38{
39 icalcomponent_kind kind;
40 pvl_elem iter;
41
42} icalcompiter;
43
44icalcomponent* icalcomponent_new(icalcomponent_kind kind);
45icalcomponent* icalcomponent_new_clone(icalcomponent* component);
46icalcomponent* icalcomponent_new_from_string(char* str);
47icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...);
48void icalcomponent_free(icalcomponent* component);
49
50char* icalcomponent_as_ical_string(icalcomponent* component);
51
52int icalcomponent_is_valid(icalcomponent* component);
53
54icalcomponent_kind icalcomponent_isa(icalcomponent* component);
55
56int icalcomponent_isa_component (void* component);
57
58/*
59 * Working with properties
60 */
61
62void icalcomponent_add_property(icalcomponent* component,
63 icalproperty* property);
64
65void icalcomponent_remove_property(icalcomponent* component,
66 icalproperty* property);
67
68int icalcomponent_count_properties(icalcomponent* component,
69 icalproperty_kind kind);
70
71/* Iterate through the properties */
72icalproperty* icalcomponent_get_current_property(icalcomponent* component);
73
74icalproperty* icalcomponent_get_first_property(icalcomponent* component,
75 icalproperty_kind kind);
76icalproperty* 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
88icalcomponent* icalcomponent_get_inner(icalcomponent* comp);
89
90
91void icalcomponent_add_component(icalcomponent* parent,
92 icalcomponent* child);
93
94void icalcomponent_remove_component(icalcomponent* parent,
95 icalcomponent* child);
96
97int icalcomponent_count_components(icalcomponent* component,
98 icalcomponent_kind kind);
99
100/* Iteration Routines. There are two forms of iterators, internal and
101external. The internal ones came first, and are almost completely
102sufficient, but they fail badly when you want to construct a loop that
103removes components from the container.*/
104
105
106/* Iterate through components */
107icalcomponent* icalcomponent_get_current_component (icalcomponent* component);
108
109icalcomponent* icalcomponent_get_first_component(icalcomponent* component,
110 icalcomponent_kind kind);
111icalcomponent* icalcomponent_get_next_component(icalcomponent* component,
112 icalcomponent_kind kind);
113
114/* Using external iterators */
115icalcompiter icalcomponent_begin_component(icalcomponent* component,
116 icalcomponent_kind kind);
117icalcompiter icalcomponent_end_component(icalcomponent* component,
118 icalcomponent_kind kind);
119icalcomponent* icalcompiter_next(icalcompiter* i);
120icalcomponent* icalcompiter_prior(icalcompiter* i);
121icalcomponent* icalcompiter_deref(icalcompiter* i);
122
123
124
125
126/* Working with embedded error properties */
127
128int icalcomponent_count_errors(icalcomponent* component);
129
130/* Remove all X-LIC-ERROR properties*/
131void icalcomponent_strip_errors(icalcomponent* component);
132
133/* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/
134void icalcomponent_convert_errors(icalcomponent* component);
135
136/* Internal operations. They are private, and you should not be using them. */
137icalcomponent* icalcomponent_get_parent(icalcomponent* component);
138void icalcomponent_set_parent(icalcomponent* component,
139 icalcomponent* parent);
140
141/* Kind conversion routiens */
142
143icalcomponent_kind icalcomponent_string_to_kind(const char* string);
144
145const char* icalcomponent_kind_to_string(icalcomponent_kind kind);
146
147
148/************* Derived class methods. ****************************
149
150If the code was in an OO language, the remaining routines would be
151members of classes derived from icalcomponent. Don't call them on the
152wrong component subtypes. */
153
154/* For VCOMPONENT: Return a reference to the first VEVENT, VTODO or
155 VJOURNAL */
156icalcomponent* 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 */
160struct icaltime_span icalcomponent_get_span(icalcomponent* comp);
161
162/******************** Convienience routines **********************/
163
164void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v);
165struct 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
177struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp);
178void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v);
179
180void icalcomponent_set_duration(icalcomponent* comp,
181 struct icaldurationtype v);
182struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp);
183
184void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method);
185icalproperty_method icalcomponent_get_method(icalcomponent* comp);
186
187struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp);
188void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v);
189
190
191void icalcomponent_set_summary(icalcomponent* comp, const char* v);
192const char* icalcomponent_get_summary(icalcomponent* comp);
193
194void icalcomponent_set_comment(icalcomponent* comp, const char* v);
195const char* icalcomponent_get_comment(icalcomponent* comp);
196
197void icalcomponent_set_uid(icalcomponent* comp, const char* v);
198const char* icalcomponent_get_uid(icalcomponent* comp);
199
200void icalcomponent_set_recurrenceid(icalcomponent* comp,
201 struct icaltimetype v);
202struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
203
204
205void icalcomponent_set_organizer(icalcomponent* comp,
206 struct icalorganizertype org);
207 struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp);
208
209
210void icalcomponent_add_attendee(icalcomponent *comp,
211 struct icalattendeetype attendee);
212
213int icalcomponent_remove_attendee(icalcomponent *comp, char* cuid);
214
215/* Get the Nth attendee. Out of range indices return an attendee
216 with cuid == 0 */
217struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp,
218 int index);
219
220
221
222
223/*************** Type Specific routines ***************/
224
225icalcomponent* icalcomponent_new_vcalendar();
226icalcomponent* icalcomponent_new_vevent();
227icalcomponent* icalcomponent_new_vtodo();
228icalcomponent* icalcomponent_new_vjournal();
229icalcomponent* icalcomponent_new_valarm();
230icalcomponent* icalcomponent_new_vfreebusy();
231icalcomponent* icalcomponent_new_vtimezone();
232icalcomponent* icalcomponent_new_xstandard();
233icalcomponent* icalcomponent_new_xdaylight();
234
235
236
237#endif /* !ICALCOMPONENT_H */
238
239
240