2 /*======================================================================
4 CREATOR: eric 28 November 1999
7 $Id: icaldirset.h,v 1.8 2008-01-02 20:07:40 dothebart Exp $
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
23 The Original Code is eric. The Initial Developer of the Original
27 ======================================================================*/
32 #include <libical/ical.h>
34 #include "icalcluster.h"
35 #include "icalgauge.h"
37 /* icaldirset Routines for storing, fetching, and searching for ical
38 * objects in a database */
40 typedef struct icaldirset_impl icaldirset;
42 icalset* icaldirset_new(const char* path);
44 icalset* icaldirset_new_reader(const char* path);
45 icalset* icaldirset_new_writer(const char* path);
48 icalset* icaldirset_init(icalset* set, const char *dsn, void *options);
49 void icaldirset_free(icalset* set);
51 const char* icaldirset_path(icalset* set);
53 /* Mark the cluster as changed, so it will be written to disk when it
54 is freed. Commit writes to disk immediately*/
55 void icaldirset_mark(icalset* set);
56 icalerrorenum icaldirset_commit(icalset* set);
58 icalerrorenum icaldirset_add_component(icalset* store, icalcomponent* comp);
59 icalerrorenum icaldirset_remove_component(icalset* store, icalcomponent* comp);
61 int icaldirset_count_components(icalset* store,
62 icalcomponent_kind kind);
64 /* Restrict the component returned by icaldirset_first, _next to those
65 that pass the gauge. _clear removes the gauge. */
66 icalerrorenum icaldirset_select(icalset* store, icalgauge* gauge);
67 void icaldirset_clear(icalset* store);
69 /* Get a component by uid */
70 icalcomponent* icaldirset_fetch(icalset* store, const char* uid);
71 int icaldirset_has_uid(icalset* store, const char* uid);
72 icalcomponent* icaldirset_fetch_match(icalset* set, icalcomponent *c);
74 /* Modify components according to the MODIFY method of CAP. Works on
75 the currently selected components. */
76 icalerrorenum icaldirset_modify(icalset* store, icalcomponent *oldc,
79 /* Iterate through the components. If a gauge has been defined, these
80 will skip over components that do not pass the gauge */
82 icalcomponent* icaldirset_get_current_component(icalset* store);
83 icalcomponent* icaldirset_get_first_component(icalset* store);
84 icalcomponent* icaldirset_get_next_component(icalset* store);
86 /* External iterator for thread safety */
87 icalsetiter icaldirset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge);
88 icalcomponent* icaldirsetiter_to_next(icalset* set, icalsetiter* i);
89 icalcomponent* icaldirsetiter_to_prior(icalset* set, icalsetiter* i);
91 typedef struct icaldirset_options {
92 int flags; /**< flags corresponding to the open() system call O_RDWR, etc. */
95 #endif /* !ICALDIRSET_H */