bump to 1.0.0 and clean up spec file
[platform/upstream/libical.git] / src / libical / icalproperty_cxx.h
1 /* -*- Mode: C++ -*- */
2
3 /**
4  * @file    icalproperty_cxx.h
5  * @author  fnguyen (12/10/01)
6  * @brief   Definition of C++ Wrapper for icalproperty.c
7  *
8  * (C) COPYRIGHT 2001, Critical Path
9
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of either: 
12
13     The LGPL as published by the Free Software Foundation, version
14     2.1, available at: http://www.fsf.org/copyleft/lesser.html
15
16   Or:
17
18     The Mozilla Public License Version 1.0. You may obtain a copy of
19     the License at http://www.mozilla.org/MPL/
20  */
21
22 #ifndef ICALPROPERTY_CXX_H
23 #define ICALPROPERTY_CXX_H
24
25 #include "ical.h"
26 #include "icptrholder.h"
27
28 typedef char* string; // Will use the string library from STL
29
30 class ICalParameter;
31 class ICalValue;
32
33 class ICalProperty {
34 public:
35         ICalProperty();
36         ICalProperty(const ICalProperty&) throw(icalerrorenum);
37         ICalProperty& operator=(const ICalProperty&) throw(icalerrorenum);
38         ~ICalProperty();
39
40         ICalProperty(icalproperty* v);
41         ICalProperty(string str);
42         ICalProperty(icalproperty_kind kind);
43         ICalProperty(icalproperty_kind kind, string str);
44
45         operator icalproperty*() {return imp;}
46         int operator==(ICalProperty& rhs);
47
48         void detach() {
49             imp = NULL;
50         }
51
52 public:
53         string as_ical_string();
54         icalproperty_kind isa();
55         int isa_property(void* property);
56
57         void add_parameter(ICalParameter& parameter);
58         void set_parameter(ICalParameter& parameter);
59         void set_parameter_from_string(string name, string val);
60         string get_parameter_as_string(string name);
61         void remove_parameter(icalparameter_kind kind);
62         int count_parameters();
63
64         /** Iterate through the parameters */
65         ICalParameter* get_first_parameter(icalparameter_kind kind);
66         ICalParameter* get_next_parameter(icalparameter_kind kind);
67
68         /** Access the value of the property */
69         void set_value(const ICalValue& val);
70         void set_value_from_string(string val, string kind);
71
72         ICalValue* get_value();
73         string get_value_as_string();
74
75         /** Return the name of the property -- the type name converted
76          *  to a string, or the value of get_x_name if the type is X
77          *  property
78         */
79         string get_name();
80
81 public:
82         /* Deal with X properties */
83         static void set_x_name(ICalProperty &prop, string name);
84         static string get_x_name(ICalProperty &prop);
85
86         static icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value val);
87
88         /* Convert kinds to string and get default value type */
89         static icalvalue_kind kind_to_value_kind(icalproperty_kind kind);
90         static icalproperty_kind value_kind_to_kind(icalvalue_kind kind);
91         static string kind_to_string(icalproperty_kind kind);
92         static icalproperty_kind string_to_kind(string str);
93
94         static icalproperty_method string_to_method(string str);
95         static string method_to_string(icalproperty_method method);
96
97         static string enum_to_string(int e);
98         static int string_to_enum(string str);
99
100         static string status_to_string(icalproperty_status);
101         static icalproperty_status string_to_status(string str);
102
103         static int enum_belongs_to_property(icalproperty_kind kind, int e);
104
105 public:
106         /* ACTION */
107         void set_action(enum icalproperty_action v);
108         enum icalproperty_action get_action();
109
110         /* ATTACH */
111         void set_attach(icalattach *v);
112         icalattach *get_attach();
113
114         /* ATTENDEE */
115         void set_attendee(string val);
116         string get_attendee();
117
118         /* CALSCALE */
119         void set_calscale(string val);
120         string get_calscale();
121
122         /* CATEGORIES */
123         void set_categories(string val);
124         string get_categories();
125
126         /* CLASS */
127         void set_class(enum icalproperty_class val);
128         enum icalproperty_class get_class();
129
130         /* COMMENT */
131         void set_comment(string val);
132         string get_comment();
133
134         /* COMPLETED */
135         void set_completed(struct icaltimetype val);
136         struct icaltimetype get_completed();
137
138         /* CONTACT */
139         void set_contact(string val);
140         string get_contact();
141
142         /* CREATED */
143         void set_created(struct icaltimetype val);
144         struct icaltimetype get_created();
145
146         /* DESCRIPTION */
147         void set_description(string val);
148         string get_description();
149
150         /* DTEND */
151         void set_dtend(struct icaltimetype val);
152         struct icaltimetype get_dtend();
153
154         /* DTSTAMP */
155         void set_dtstamp(struct icaltimetype val);
156         struct icaltimetype get_dtstamp();
157
158         /* DTSTART */
159         void set_dtstart(struct icaltimetype val);
160         struct icaltimetype get_dtstart();
161
162         /* DUE */
163         void set_due(struct icaltimetype val);
164         struct icaltimetype get_due();
165
166         /* DURATION */
167         void set_duration(struct icaldurationtype val);
168         struct icaldurationtype get_duration();
169
170         /* EXDATE */
171         void set_exdate(struct icaltimetype val);
172         struct icaltimetype get_exdate();
173
174         /* EXPAND */
175         void set_expand(int val);
176         int get_expand();
177
178         /* EXRULE */
179         void set_exrule(struct icalrecurrencetype val);
180         struct icalrecurrencetype get_exrule();
181
182         /* FREEBUSY */
183         void set_freebusy(struct icalperiodtype val);
184         struct icalperiodtype get_freebusy();
185
186         /* GEO */
187         void set_geo(struct icalgeotype val);
188         struct icalgeotype get_geo();
189
190         /* GRANT */
191         void set_grant(string val);
192         string get_grant();
193
194         /* LAST-MODIFIED */
195         void set_lastmodified(struct icaltimetype val);
196         struct icaltimetype get_lastmodified();
197
198         /* LOCATION */
199         void set_location(string val);
200         string get_location();
201
202         /* MAXRESULTS */
203         void set_maxresults(int val);
204         int get_maxresults();
205
206         /* MAXRESULTSSIZE */
207         void set_maxresultsize(int val);
208         int get_maxresultsize();
209
210         /* METHOD */
211         void set_method(enum icalproperty_method val);
212         enum icalproperty_method get_method();
213
214         /* OWNER */
215         void set_owner(string val);
216         string get_owner();
217
218         /* ORGANIZER */
219         void set_organizer(string val);
220         string get_organizer();
221
222         /* PERCENT-COMPLETE */
223         void set_percentcomplete(int val);
224         int get_percentcomplete();
225
226         /* PRIORITY */
227         void set_priority(int val);
228         int get_priority();
229
230         /* PRODID */
231         void set_prodid(string val);
232         string get_prodid();
233
234         /* QUERY */
235         void set_query(string val);
236         string get_query();
237
238         /* QUERYNAME */
239         void set_queryname(string val);
240         string get_queryname();
241
242         /* RDATE */
243         void set_rdate(struct icaldatetimeperiodtype val);
244         struct icaldatetimeperiodtype get_rdate();
245
246         /* RECURRENCE-ID */
247         void set_recurrenceid(struct icaltimetype val);
248         struct icaltimetype get_recurrenceid();
249
250         /* RELATED-TO */
251         void set_relatedto(string val);
252         string get_relatedto();
253
254         /* RELCALID */
255         void set_relcalid(string val);
256         string get_relcalid();
257
258         /* REPEAT */
259         void set_repeat(int val);
260         int get_repeat();
261
262         /* REQUEST-STATUS */
263         void set_requeststatus(string val);
264         string get_requeststatus();
265
266         /* RESOURCES */
267         void set_resources(string val);
268         string get_resources();
269
270         /* RRULE */
271         void set_rrule(struct icalrecurrencetype val);
272         struct icalrecurrencetype get_rrule();
273
274         /* SCOPE */
275         void set_scope(string val);
276         string get_scope();
277
278         /* SEQUENCE */
279         void set_sequence(int val);
280         int get_sequence();
281
282         /* STATUS */
283         void set_status(enum icalproperty_status val);
284         enum icalproperty_status get_status();
285
286         /* SUMMARY */
287         void set_summary(string val);
288         string get_summary();
289
290         /* TARGET */
291         void set_target(string val);
292         string get_target();
293
294         /* TRANSP */
295         void set_transp(enum icalproperty_transp val);
296         enum icalproperty_transp get_transp();
297
298         /* TRIGGER */
299         void set_trigger(struct icaltriggertype val);
300         struct icaltriggertype get_trigger();
301
302         /* TZID */
303         void set_tzid(string val);
304         string get_tzid();
305
306         /* TZNAME */
307         void set_tzname(string val);
308         string get_tzname();
309
310         /* TZOFFSETFROM */
311         void set_tzoffsetfrom(int val);
312         int get_tzoffsetfrom();
313
314         /* TZOFFSETTO */
315         void set_tzoffsetto(int val);
316         int get_tzoffsetto();
317
318         /* TZURL */
319         void set_tzurl(string val);
320         string get_tzurl();
321
322         /* UID */
323         void set_uid(string val);
324         string get_uid();
325
326         /* URL */
327         void set_url(string val);
328         string get_url();
329
330         /* VERSION */
331         void set_version(string val);
332         string get_version();
333
334         /* X */
335         void set_x(string val);
336         string get_x();
337
338         /* X-LIC-CLUSTERCOUNT */
339         void set_xlicclustercount(string val);
340         string get_xlicclustercount();
341
342         /* X-LIC-ERROR */
343         void set_xlicerror(string val);
344         string get_xlicerror();
345
346         /* X-LIC-MIMECHARSET */
347         void set_xlicmimecharset(string val);
348         string get_xlicmimecharset();
349
350         /* X-LIC-MIMECID */
351         void set_xlicmimecid(string val);
352         string get_xlicmimecid();
353
354         /* X-LIC-MIMECONTENTTYPE */
355         void set_xlicmimecontenttype(string val);
356         string get_xlicmimecontenttype();
357
358         /* X-LIC-MIMEENCODING */
359         void set_xlicmimeencoding(string val);
360         string get_xlicmimeencoding();
361
362         /* X-LIC-MIMEFILENAME */
363         void set_xlicmimefilename(string val);
364         string get_xlicmimefilename();
365
366         /* X-LIC-MIMEOPTINFO */
367         void set_xlicmimeoptinfo(string val);
368         string get_xlicmimeoptinfo();
369
370 private:
371   icalproperty* imp; /**< The actual C based icalproperty */
372 };
373
374 typedef ICPointerHolder<ICalProperty> ICalPropertyTmpPtr;   /* see icptrholder.h for comments */
375
376 #endif /* ICalProperty_H */