bump to 1.0.0 and clean up spec file
[platform/upstream/libical.git] / src / libicalss / icalfileset.h
1 /* -*- Mode: C -*- */
2 /*======================================================================
3  FILE: icalfileset.h
4  CREATOR: eric 23 December 1999
5
6
7  $Id: icalfileset.h,v 1.15 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 ICALFILESET_H
30 #define ICALFILESET_H
31
32 #include <libical/ical.h>
33 #include "icalset.h"
34 #include "icalcluster.h"
35 #include "icalgauge.h"
36 #include <sys/types.h> /* For open() flags and mode */
37 #include <sys/stat.h> /* For open() flags and mode */
38 #include <fcntl.h> /* For open() flags and mode */
39
40 #ifdef WIN32
41 #define mode_t int
42 #endif
43
44 typedef struct icalfileset_impl icalfileset;
45
46 icalset* icalfileset_new(const char* path);
47 icalset* icalfileset_new_reader(const char* path);
48 icalset* icalfileset_new_writer(const char* path);
49
50 icalset* icalfileset_init(icalset *set, const char *dsn, void* options);
51
52 icalfileset* icalfileset_new_from_cluster(const char* path, icalcluster *cluster);
53
54 icalcluster* icalfileset_produce_icalcluster(const char *path);
55
56 void icalfileset_free(icalset* cluster);
57
58 const char* icalfileset_path(icalset* cluster);
59
60 /* Mark the cluster as changed, so it will be written to disk when it
61    is freed. Commit writes to disk immediately. */
62 void icalfileset_mark(icalset* set);
63 icalerrorenum icalfileset_commit(icalset* set); 
64
65 icalerrorenum icalfileset_add_component(icalset* set,
66                                         icalcomponent* child);
67
68 icalerrorenum icalfileset_remove_component(icalset* set,
69                                            icalcomponent* child);
70
71 int icalfileset_count_components(icalset* set,
72                                  icalcomponent_kind kind);
73
74 /**
75  * Restrict the component returned by icalfileset_first, _next to those
76  * that pass the gauge. _clear removes the gauge 
77  */
78 icalerrorenum icalfileset_select(icalset* set, icalgauge* gauge);
79
80 /** clear the gauge **/
81 void icalfileset_clear(icalset* set);
82
83 /** Get and search for a component by uid **/
84 icalcomponent* icalfileset_fetch(icalset* set, const char* uid);
85 int icalfileset_has_uid(icalset* set, const char* uid);
86 icalcomponent* icalfileset_fetch_match(icalset* set, icalcomponent *c);
87
88
89 /**
90  *  Modify components according to the MODIFY method of CAP. Works on the
91  *  currently selected components. 
92  */
93 icalerrorenum icalfileset_modify(icalset* set, 
94                                  icalcomponent *oldcomp,
95                                icalcomponent *newcomp);
96
97 /* Iterate through components. If a gauge has been defined, these
98    will skip over components that do not pass the gauge */
99
100 icalcomponent* icalfileset_get_current_component (icalset* cluster);
101 icalcomponent* icalfileset_get_first_component(icalset* cluster);
102 icalcomponent* icalfileset_get_next_component(icalset* cluster);
103
104 /* External iterator for thread safety */
105 icalsetiter icalfileset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge);
106 icalcomponent * icalfilesetiter_to_next(icalset* set, icalsetiter *iter);
107 icalcomponent* icalfileset_form_a_matched_recurrence_component(icalsetiter* itr);
108
109 /** Return a reference to the internal component. You probably should
110    not be using this. */
111
112 icalcomponent* icalfileset_get_component(icalset* cluster);
113
114 /** 
115  * @brief options for opening an icalfileset.
116  *
117  * These options should be passed to the icalset_new() function
118  */
119
120 typedef struct icalfileset_options {
121   int          flags;           /**< flags for open() O_RDONLY, etc  */
122   mode_t       mode;            /**< file mode */
123   int          safe_saves;      /**< to lock or not */
124   icalcluster  *cluster;        /**< use this cluster to initialize data */
125 } icalfileset_options;
126
127 extern icalfileset_options icalfileset_options_default;
128
129 #endif /* !ICALFILESET_H */
130
131
132