summaryrefslogtreecommitdiffabout
path: root/libical/src/libicalss/icalfileset.h
Unidiff
Diffstat (limited to 'libical/src/libicalss/icalfileset.h') (more/less context) (show whitespace changes)
-rw-r--r--libical/src/libicalss/icalfileset.h105
1 files changed, 66 insertions, 39 deletions
diff --git a/libical/src/libicalss/icalfileset.h b/libical/src/libicalss/icalfileset.h
index 51254d2..dc044ea 100644
--- a/libical/src/libicalss/icalfileset.h
+++ b/libical/src/libicalss/icalfileset.h
@@ -8,100 +8,127 @@
8 $Locker$ 8 $Locker$
9 9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org 10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11 11
12 This program is free software; you can redistribute it and/or modify 12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either: 13 it under the terms of either:
14 14
15 The LGPL as published by the Free Software Foundation, version 15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html 16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17 17
18 Or: 18 Or:
19 19
20 The Mozilla Public License Version 1.0. You may obtain a copy of 20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/ 21 the License at http://www.mozilla.org/MPL/
22 22
23 The Original Code is eric. The Initial Developer of the Original 23 The Original Code is eric. The Initial Developer of the Original
24 Code is Eric Busboom 24 Code is Eric Busboom
25 25
26 26
27======================================================================*/ 27======================================================================*/
28 28
29#ifndef ICALFILESET_H 29#ifndef ICALFILESET_H
30#define ICALFILESET_H 30#define ICALFILESET_H
31 31
32#include "icalerror.h"
33#include "ical.h" 32#include "ical.h"
34#include "icalset.h" 33#include "icalset.h"
34#include "icalcluster.h"
35#include "icalgauge.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 */
36 39
37extern int icalfileset_safe_saves; 40#ifdef WIN32
38 41#define mode_t int
39typedef void icalfileset; 42#endif
40 43
44extern int icalfileset_safe_saves;
41 45
42/* icalfileset 46typedef struct icalfileset_impl icalfileset;
43 icalfilesetfile
44 icalfilesetdir
45*/
46 47
48icalset* icalfileset_new(const char* path);
49icalset* icalfileset_new_reader(const char* path);
50icalset* icalfileset_new_writer(const char* path);
47 51
48icalfileset* icalfileset_new(const char* path); 52icalset* icalfileset_init(icalset *set, const char *dsn, void* options);
49 53
50#ifdef _WIN32 54icalfileset* icalfileset_new_from_cluster(const char* path, icalcluster *cluster);
51#define mode_t int
52#endif
53 55
54/* Like _new, but takes open() flags for opening the file */ 56icalcluster* icalfileset_produce_icalcluster(const char *path);
55icalfileset* icalfileset_new_open(const char* path,
56 int flags, mode_t mode);
57 57
58void icalfileset_free(icalfileset* cluster); 58void icalfileset_free(icalset* cluster);
59 59
60const char* icalfileset_path(icalfileset* cluster); 60const char* icalfileset_path(icalset* cluster);
61 61
62/* Mark the cluster as changed, so it will be written to disk when it 62/* Mark the cluster as changed, so it will be written to disk when it
63 is freed. Commit writes to disk immediately. */ 63 is freed. Commit writes to disk immediately. */
64void icalfileset_mark(icalfileset* cluster); 64void icalfileset_mark(icalset* set);
65icalerrorenum icalfileset_commit(icalfileset* cluster); 65icalerrorenum icalfileset_commit(icalset* set);
66 66
67icalerrorenum icalfileset_add_component(icalfileset* cluster, 67icalerrorenum icalfileset_add_component(icalset* set,
68 icalcomponent* child); 68 icalcomponent* child);
69 69
70icalerrorenum icalfileset_remove_component(icalfileset* cluster, 70icalerrorenum icalfileset_remove_component(icalset* set,
71 icalcomponent* child); 71 icalcomponent* child);
72 72
73int icalfileset_count_components(icalfileset* cluster, 73int icalfileset_count_components(icalset* set,
74 icalcomponent_kind kind); 74 icalcomponent_kind kind);
75 75
76/* Restrict the component returned by icalfileset_first, _next to those 76/**
77 that pass the gauge. _clear removes the gauge */ 77 * Restrict the component returned by icalfileset_first, _next to those
78icalerrorenum icalfileset_select(icalfileset* store, icalgauge* gauge); 78 * that pass the gauge. _clear removes the gauge
79void icalfileset_clear(icalfileset* store); 79 */
80icalerrorenum icalfileset_select(icalset* set, icalgauge* gauge);
81
82/** clear the gauge **/
83void icalfileset_clear(icalset* set);
80 84
81/* Get and search for a component by uid */ 85/** Get and search for a component by uid **/
82icalcomponent* icalfileset_fetch(icalfileset* cluster, const char* uid); 86icalcomponent* icalfileset_fetch(icalset* set, const char* uid);
83int icalfileset_has_uid(icalfileset* cluster, const char* uid); 87int icalfileset_has_uid(icalset* set, const char* uid);
84icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *c); 88icalcomponent* icalfileset_fetch_match(icalset* set, icalcomponent *c);
85 89
86 90
87/* Modify components according to the MODIFY method of CAP. Works on 91/**
88 the currently selected components. */ 92 * Modify components according to the MODIFY method of CAP. Works on the
89icalerrorenum icalfileset_modify(icalfileset* store, icalcomponent *oldcomp, 93 * currently selected components.
94 */
95icalerrorenum icalfileset_modify(icalset* set,
96 icalcomponent *oldcomp,
90 icalcomponent *newcomp); 97 icalcomponent *newcomp);
91 98
92/* Iterate through components. If a guage has been defined, these 99/* Iterate through components. If a gauge has been defined, these
93 will skip over components that do not pass the gauge */ 100 will skip over components that do not pass the gauge */
94 101
95icalcomponent* icalfileset_get_current_component (icalfileset* cluster); 102icalcomponent* icalfileset_get_current_component (icalset* cluster);
96icalcomponent* icalfileset_get_first_component(icalfileset* cluster); 103icalcomponent* icalfileset_get_first_component(icalset* cluster);
97icalcomponent* icalfileset_get_next_component(icalfileset* cluster); 104icalcomponent* icalfileset_get_next_component(icalset* cluster);
98/* Return a reference to the internal component. You probably should 105
106/* External iterator for thread safety */
107icalsetiter icalfileset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge);
108icalcomponent * icalfilesetiter_to_next(icalset* set, icalsetiter *iter);
109icalcomponent* icalfileset_form_a_matched_recurrence_component(icalsetiter* itr);
110
111/** Return a reference to the internal component. You probably should
99 not be using this. */ 112 not be using this. */
100 113
101icalcomponent* icalfileset_get_component(icalfileset* cluster); 114icalcomponent* icalfileset_get_component(icalset* cluster);
115
116/**
117 * @brief options for opening an icalfileset.
118 *
119 * These options should be passed to the icalset_new() function
120 */
121
122typedef struct icalfileset_options {
123 int flags; /**< flags for open() O_RDONLY, etc */
124 mode_t mode; /**< file mode */
125 int safe_saves;/**< to lock or not */
126 icalcluster *cluster;/**< use this cluster to initialize data */
127} icalfileset_options;
102 128
129extern icalfileset_options icalfileset_options_default;
103 130
104#endif /* !ICALFILESET_H */ 131#endif /* !ICALFILESET_H */
105 132
106 133
107 134