Set license using %license
[platform/upstream/libical.git] / src / libicalss / icaldirset.h
1 /* -*- Mode: C -*- */
2 /*======================================================================
3  FILE: icaldirset.h
4  CREATOR: eric 28 November 1999
5
6
7  $Id: icaldirset.h,v 1.8 2008-01-02 20:07:40 dothebart Exp $
8  $Locker:  $
9
10  (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12  This program is free software; you can redistribute it and/or modify
13  it under the terms of either: 
14
15     The LGPL as published by the Free Software Foundation, version
16     2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18   Or:
19
20     The Mozilla Public License Version 1.0. You may obtain a copy of
21     the License at http://www.mozilla.org/MPL/
22
23  The Original Code is eric. The Initial Developer of the Original
24  Code is Eric Busboom
25
26
27 ======================================================================*/
28
29 #ifndef ICALDIRSET_H
30 #define ICALDIRSET_H
31
32 #include <libical/ical.h>
33 #include "icalset.h"
34 #include "icalcluster.h"
35 #include "icalgauge.h"
36
37 /* icaldirset Routines for storing, fetching, and searching for ical
38  * objects in a database */
39
40 typedef struct icaldirset_impl icaldirset;
41
42 icalset* icaldirset_new(const char* path);
43
44 icalset* icaldirset_new_reader(const char* path);
45 icalset* icaldirset_new_writer(const char* path);
46
47
48 icalset* icaldirset_init(icalset* set, const char *dsn, void *options);
49 void icaldirset_free(icalset* set);
50
51 const char* icaldirset_path(icalset* set);
52
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);
57
58 icalerrorenum icaldirset_add_component(icalset* store, icalcomponent* comp);
59 icalerrorenum icaldirset_remove_component(icalset* store, icalcomponent* comp);
60
61 int icaldirset_count_components(icalset* store,
62                                icalcomponent_kind kind);
63
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);
68
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);
73
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,
77                                icalcomponent *newc);
78
79 /* Iterate through the components. If a gauge has been defined, these
80    will skip over components that do not pass the gauge */
81
82 icalcomponent* icaldirset_get_current_component(icalset* store);
83 icalcomponent* icaldirset_get_first_component(icalset* store);
84 icalcomponent* icaldirset_get_next_component(icalset* store);
85
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);
90
91 typedef struct icaldirset_options {
92   int flags;                    /**< flags corresponding to the open() system call O_RDWR, etc. */
93 } icaldirset_options;
94
95 #endif /* !ICALDIRSET_H */
96
97
98