Back to index

lightning-sunbird  0.9+nobinonly
icalset.h
Go to the documentation of this file.
00001 /* -*- Mode: C -*- */
00016 /*
00017  $Id: icalset.h,v 1.13 2002/09/26 22:25:12 lindner Exp $
00018  $Locker:  $
00019 
00020  (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
00021 
00022  This program is free software; you can redistribute it and/or modify
00023  it under the terms of either: 
00024 
00025     The LGPL as published by the Free Software Foundation, version
00026     2.1, available at: http://www.fsf.org/copyleft/lesser.html
00027 
00028   Or:
00029 
00030     The Mozilla Public License Version 1.0. You may obtain a copy of
00031     the License at http://www.mozilla.org/MPL/
00032 
00033  The Original Code is eric. The Initial Developer of the Original
00034  Code is Eric Busboom
00035 
00036 
00037 ======================================================================*/
00038 
00039 #ifndef ICALSET_H
00040 #define ICALSET_H
00041 
00042 #include <limits.h> /* For PATH_MAX */
00043 #include "ical.h"
00044 #include "icalgauge.h"
00045 
00046 #ifdef PATH_MAX
00047 #define ICAL_PATH_MAX PATH_MAX
00048 #else
00049 #define ICAL_PATH_MAX 1024
00050 #endif
00051 
00052 
00053 typedef struct icalset_impl icalset;
00054 
00055 typedef enum icalset_kind {
00056     ICAL_FILE_SET,
00057     ICAL_DIR_SET,
00058     ICAL_BDB_SET
00059 } icalset_kind;
00060 
00061 typedef struct icalsetiter
00062 {
00063        icalcompiter iter;    /* icalcomponent_kind, pvl_elem iter */
00064        icalgauge* gauge;
00065         icalrecur_iterator* ritr; /*the last iterator*/
00066         icalcomponent* last_component; /*the pending recurring component to be processed  */
00067        const char* tzid; /* the calendar's timezone id */
00068 } icalsetiter;
00069 
00070 struct icalset_impl {
00071         icalset_kind kind;
00072        int size;
00073         char *dsn;
00074         icalset* (*init)(icalset* set, const char *dsn, void *options);
00075        void (*free)(icalset* set);
00076        const char* (*path)(icalset* set);
00077        void (*mark)(icalset* set);
00078        icalerrorenum (*commit)(icalset* set); 
00079        icalerrorenum (*add_component)(icalset* set, icalcomponent* comp);
00080        icalerrorenum (*remove_component)(icalset* set, icalcomponent* comp);
00081        int (*count_components)(icalset* set,
00082                           icalcomponent_kind kind);
00083        icalerrorenum (*select)(icalset* set, icalgauge* gauge);
00084        void (*clear)(icalset* set);
00085        icalcomponent* (*fetch)(icalset* set, const char* uid);
00086        icalcomponent* (*fetch_match)(icalset* set, icalcomponent *comp);
00087        int (*has_uid)(icalset* set, const char* uid);
00088        icalerrorenum (*modify)(icalset* set, icalcomponent *old,
00089                                  icalcomponent *newc);
00090        icalcomponent* (*get_current_component)(icalset* set);  
00091        icalcomponent* (*get_first_component)(icalset* set);
00092        icalcomponent* (*get_next_component)(icalset* set);
00093        icalsetiter (*icalset_begin_component)(icalset* set,
00094                                     icalcomponent_kind kind, icalgauge* gauge);
00095        icalcomponent* (*icalsetiter_to_next)(icalset* set, icalsetiter* i);
00096        icalcomponent* (*icalsetiter_to_prior)(icalset* set, icalsetiter* i);
00097 };
00098 
00100 int icalset_register_class(icalset *set);
00101 
00102 
00114 icalset* icalset_new(icalset_kind kind, const char* dsn, void* options);
00115 
00116 icalset* icalset_new_file(const char* path);
00117 icalset* icalset_new_file_reader(const char* path);
00118 icalset* icalset_new_file_writer(const char* path);
00119 
00120 icalset* icalset_new_dir(const char* path);
00121 icalset* icalset_new_file_reader(const char* path);
00122 icalset* icalset_new_file_writer(const char* path);
00123 
00124 void icalset_free(icalset* set);
00125 
00126 const char* icalset_path(icalset* set);
00127 
00130 void icalset_mark(icalset* set);
00131 
00133 icalerrorenum icalset_commit(icalset* set); 
00134 
00135 icalerrorenum icalset_add_component(icalset* set, icalcomponent* comp);
00136 icalerrorenum icalset_remove_component(icalset* set, icalcomponent* comp);
00137 
00138 int icalset_count_components(icalset* set,
00139                           icalcomponent_kind kind);
00140 
00143 icalerrorenum icalset_select(icalset* set, icalgauge* gauge);
00144 
00146 void icalset_clear_select(icalset* set);
00147 
00149 icalcomponent* icalset_fetch(icalset* set, const char* uid);
00150 
00151 int icalset_has_uid(icalset* set, const char* uid);
00152 icalcomponent* icalset_fetch_match(icalset* set, icalcomponent *c);
00153 
00156 icalerrorenum icalset_modify(icalset* set, icalcomponent *oldc,
00157                             icalcomponent *newc);
00158 
00162 icalcomponent* icalset_get_current_component(icalset* set);
00163 icalcomponent* icalset_get_first_component(icalset* set);
00164 icalcomponent* icalset_get_next_component(icalset* set);
00165 
00167 extern icalsetiter icalsetiter_null;
00168 
00169 icalsetiter icalset_begin_component(icalset* set,
00170                              icalcomponent_kind kind, icalgauge* gauge);
00171 
00173 icalcomponent* icalsetiter_next(icalsetiter* i);
00174 icalcomponent* icalsetiter_prior(icalsetiter* i);
00175 icalcomponent* icalsetiter_deref(icalsetiter* i);
00176 
00178 icalcomponent* icalsetiter_to_next(icalset* set, icalsetiter* i);
00179 icalcomponent* icalsetiter_to_prior(icalset* set, icalsetiter* i);
00180 
00181 #endif /* !ICALSET_H */
00182 
00183 
00184