Back to index

lightning-sunbird  0.9+nobinonly
icalcomponent.h
Go to the documentation of this file.
00001 /* -*- Mode: C -*- */
00002 /*======================================================================
00003  FILE: icalcomponent.h
00004  CREATOR: eric 20 March 1999
00005 
00006 
00007  (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
00008 
00009  This program is free software; you can redistribute it and/or modify
00010  it under the terms of either: 
00011 
00012     The LGPL as published by the Free Software Foundation, version
00013     2.1, available at: http://www.fsf.org/copyleft/lesser.html
00014 
00015   Or:
00016 
00017     The Mozilla Public License Version 1.0. You may obtain a copy of
00018     the License at http://www.mozilla.org/MPL/
00019 
00020   The original code is icalcomponent.h
00021 
00022 ======================================================================*/
00023 
00024 #ifndef ICALCOMPONENT_H
00025 #define ICALCOMPONENT_H
00026 
00027 #include "icalproperty.h"
00028 #include "icalvalue.h"
00029 #include "icalenums.h" /* defines icalcomponent_kind */
00030 #include "pvl.h"
00031 
00032 typedef struct icalcomponent_impl icalcomponent;
00033 
00034 #ifndef ICALTIMEZONE_DEFINED
00035 #define ICALTIMEZONE_DEFINED
00036 
00039 typedef struct _icaltimezone              icaltimezone;
00040 #endif
00041 
00042 
00043 /* This is exposed so that callers will not have to allocate and
00044    deallocate iterators. Pretend that you can't see it. */
00045 typedef struct icalcompiter
00046 {
00047        icalcomponent_kind kind;
00048        pvl_elem iter;
00049 
00050 } icalcompiter;
00051 
00052 icalcomponent* icalcomponent_new(icalcomponent_kind kind);
00053 icalcomponent* icalcomponent_new_clone(icalcomponent* component);
00054 icalcomponent* icalcomponent_new_from_string(char* str);
00055 icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...);
00056 icalcomponent* icalcomponent_new_x(const char* x_name);
00057 void icalcomponent_free(icalcomponent* component);
00058 
00059 char* icalcomponent_as_ical_string(icalcomponent* component);
00060 
00061 int icalcomponent_is_valid(icalcomponent* component);
00062 
00063 icalcomponent_kind icalcomponent_isa(const icalcomponent* component);
00064 
00065 int icalcomponent_isa_component (void* component);
00066 
00067 /* 
00068  * Working with properties
00069  */
00070 
00071 void icalcomponent_add_property(icalcomponent* component,
00072                             icalproperty* property);
00073 
00074 void icalcomponent_remove_property(icalcomponent* component,
00075                                icalproperty* property);
00076 
00077 int icalcomponent_count_properties(icalcomponent* component,
00078                                icalproperty_kind kind);
00079 
00080 /* Iterate through the properties */
00081 icalproperty* icalcomponent_get_current_property(icalcomponent* component);
00082 
00083 icalproperty* icalcomponent_get_first_property(icalcomponent* component,
00084                                          icalproperty_kind kind);
00085 icalproperty* icalcomponent_get_next_property(icalcomponent* component,
00086                                          icalproperty_kind kind);
00087 
00088 icalproperty* icalcomponent_get_first_x_property(icalcomponent* component,
00089                                          const char *name);
00090 icalproperty* icalcomponent_get_next_x_property(icalcomponent* component,
00091                                          const char *name);
00092 
00093 
00094 /* 
00095  * Working with components
00096  */ 
00097 
00098 
00099 /* Return the first VEVENT, VTODO or VJOURNAL sub-component of cop, or
00100    comp if it is one of those types */
00101 
00102 icalcomponent* icalcomponent_get_inner(icalcomponent* comp);
00103 
00104 
00105 void icalcomponent_add_component(icalcomponent* parent,
00106                             icalcomponent* child);
00107 
00108 void icalcomponent_remove_component(icalcomponent* parent,
00109                             icalcomponent* child);
00110 
00111 int icalcomponent_count_components(icalcomponent* component,
00112                                icalcomponent_kind kind);
00113 
00118 void icalcomponent_merge_component(icalcomponent* comp,
00119                                icalcomponent* comp_to_merge);
00120 
00121 
00122 /* Iteration Routines. There are two forms of iterators, internal and
00123 external. The internal ones came first, and are almost completely
00124 sufficient, but they fail badly when you want to construct a loop that
00125 removes components from the container.*/
00126 
00127 
00128 /* Iterate through components */
00129 icalcomponent* icalcomponent_get_current_component (icalcomponent* component);
00130 
00131 icalcomponent* icalcomponent_get_first_component(icalcomponent* component,
00132                                          icalcomponent_kind kind);
00133 icalcomponent* icalcomponent_get_next_component(icalcomponent* component,
00134                                          icalcomponent_kind kind);
00135 
00136 /* Using external iterators */
00137 icalcompiter icalcomponent_begin_component(icalcomponent* component,
00138                                       icalcomponent_kind kind);
00139 icalcompiter icalcomponent_end_component(icalcomponent* component,
00140                                     icalcomponent_kind kind);
00141 icalcomponent* icalcompiter_next(icalcompiter* i);
00142 icalcomponent* icalcompiter_prior(icalcompiter* i);
00143 icalcomponent* icalcompiter_deref(icalcompiter* i);
00144 
00145 
00146 /* Working with embedded error properties */
00147 
00148 
00149 /* Check the component against itip rules and insert error properties*/
00150 /* Working with embedded error properties */
00151 int icalcomponent_check_restrictions(icalcomponent* comp);
00152 
00154 int icalcomponent_count_errors(icalcomponent* component);
00155 
00157 void icalcomponent_strip_errors(icalcomponent* component);
00158 
00160 void icalcomponent_convert_errors(icalcomponent* component);
00161 
00162 /* Internal operations. They are private, and you should not be using them. */
00163 icalcomponent* icalcomponent_get_parent(icalcomponent* component);
00164 void icalcomponent_set_parent(icalcomponent* component, 
00165                            icalcomponent* parent);
00166 
00167 /* Kind conversion routines */
00168 
00169 int icalcomponent_kind_is_valid(const icalcomponent_kind kind);
00170 
00171 icalcomponent_kind icalcomponent_string_to_kind(const char* string);
00172 
00173 const char* icalcomponent_kind_to_string(icalcomponent_kind kind);
00174 
00175 
00176 /************* Derived class methods.  ****************************
00177 
00178 If the code was in an OO language, the remaining routines would be
00179 members of classes derived from icalcomponent. Don't call them on the
00180 wrong component subtypes. */
00181 
00184 icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c);
00185 
00188 struct icaltime_span icalcomponent_get_span(icalcomponent* comp);
00189 
00190 /******************** Convienience routines **********************/
00191 
00192 void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v);
00193 struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp);
00194 
00195 /* For the icalcomponent routines only, dtend and duration are tied
00196    together. If you call the set routine for one and the other exists,
00197    the routine will calculate the change to the other. That is, if
00198    there is a DTEND and you call set_duration, the routine will modify
00199    DTEND to be the sum of DTSTART and the duration. If you call a get
00200    routine for one and the other exists, the routine will calculate
00201    the return value. If you call a set routine and neither exists, the
00202    routine will create the apcompriate comperty */
00203 
00204 
00205 struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp);
00206 void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v);
00207 
00208 struct icaltimetype icalcomponent_get_due(icalcomponent* comp);
00209 void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v);
00210 
00211 void icalcomponent_set_duration(icalcomponent* comp, 
00212                             struct icaldurationtype v);
00213 struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp);
00214 
00215 void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method);
00216 icalproperty_method icalcomponent_get_method(icalcomponent* comp);
00217 
00218 struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp);
00219 void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v);
00220 
00221 void icalcomponent_set_summary(icalcomponent* comp, const char* v);
00222 const char* icalcomponent_get_summary(icalcomponent* comp);
00223 
00224 void icalcomponent_set_comment(icalcomponent* comp, const char* v);
00225 const char* icalcomponent_get_comment(icalcomponent* comp);
00226 
00227 void icalcomponent_set_uid(icalcomponent* comp, const char* v);
00228 const char* icalcomponent_get_uid(icalcomponent* comp);
00229 
00230 void icalcomponent_set_relcalid(icalcomponent* comp, const char* v);
00231 const char* icalcomponent_get_relcalid(icalcomponent* comp);
00232 
00233 void icalcomponent_set_recurrenceid(icalcomponent* comp, 
00234                                 struct icaltimetype v);
00235 struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
00236 
00237 void icalcomponent_set_description(icalcomponent* comp, const char* v);
00238 const char* icalcomponent_get_description(icalcomponent* comp);
00239 
00240 void icalcomponent_set_location(icalcomponent* comp, const char* v);
00241 const char* icalcomponent_get_location(icalcomponent* comp);
00242 
00243 void icalcomponent_set_sequence(icalcomponent* comp, int v);
00244 int icalcomponent_get_sequence(icalcomponent* comp);
00245 
00246 void icalcomponent_set_status(icalcomponent* comp, enum icalproperty_status v);
00247 enum icalproperty_status icalcomponent_get_status(icalcomponent* comp);
00248 
00249 
00252 void icalcomponent_foreach_tzid(icalcomponent* comp,
00253                             void (*callback)(icalparameter *param, void *data),
00254                             void *callback_data);
00255 
00258 icaltimezone* icalcomponent_get_timezone(icalcomponent* comp,
00259                                     const char *tzid);
00260 
00261 int icalproperty_recurrence_is_excluded(icalcomponent *comp,
00262                                        struct icaltimetype *dtstart,
00263                                        struct icaltimetype *recurtime); 
00264 
00265 void icalcomponent_foreach_recurrence(icalcomponent* comp,
00266                                   struct icaltimetype start,
00267                                   struct icaltimetype end,
00268                      void (*callback)(icalcomponent *comp, 
00269                                          struct icaltime_span *span, 
00270                                          void *data),
00271                            void *callback_data);
00272 
00273 
00274 /*************** Type Specific routines ***************/
00275 
00276 icalcomponent* icalcomponent_new_vcalendar();
00277 icalcomponent* icalcomponent_new_vevent();
00278 icalcomponent* icalcomponent_new_vtodo();
00279 icalcomponent* icalcomponent_new_vjournal();
00280 icalcomponent* icalcomponent_new_valarm();
00281 icalcomponent* icalcomponent_new_vfreebusy();
00282 icalcomponent* icalcomponent_new_vtimezone();
00283 icalcomponent* icalcomponent_new_xstandard();
00284 icalcomponent* icalcomponent_new_xdaylight();
00285 icalcomponent* icalcomponent_new_vagenda();
00286 icalcomponent* icalcomponent_new_vquery();
00287 
00288 #endif /* !ICALCOMPONENT_H */