Diffstat (limited to 'libical/src/libicalss/icalfileset.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libical/src/libicalss/icalfileset.h | 105 |
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 | |||
@@ -16,92 +16,119 @@ | |||
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 | ||
37 | extern int icalfileset_safe_saves; | 40 | #ifdef WIN32 |
38 | 41 | #define mode_t int | |
39 | typedef void icalfileset; | 42 | #endif |
40 | 43 | ||
44 | extern int icalfileset_safe_saves; | ||
41 | 45 | ||
42 | /* icalfileset | 46 | typedef struct icalfileset_impl icalfileset; |
43 | icalfilesetfile | ||
44 | icalfilesetdir | ||
45 | */ | ||
46 | 47 | ||
48 | icalset* icalfileset_new(const char* path); | ||
49 | icalset* icalfileset_new_reader(const char* path); | ||
50 | icalset* icalfileset_new_writer(const char* path); | ||
47 | 51 | ||
48 | icalfileset* icalfileset_new(const char* path); | 52 | icalset* icalfileset_init(icalset *set, const char *dsn, void* options); |
49 | 53 | ||
50 | #ifdef _WIN32 | 54 | icalfileset* 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 */ | 56 | icalcluster* icalfileset_produce_icalcluster(const char *path); |
55 | icalfileset* icalfileset_new_open(const char* path, | ||
56 | int flags, mode_t mode); | ||
57 | 57 | ||
58 | void icalfileset_free(icalfileset* cluster); | 58 | void icalfileset_free(icalset* cluster); |
59 | 59 | ||
60 | const char* icalfileset_path(icalfileset* cluster); | 60 | const 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. */ |
64 | void icalfileset_mark(icalfileset* cluster); | 64 | void icalfileset_mark(icalset* set); |
65 | icalerrorenum icalfileset_commit(icalfileset* cluster); | 65 | icalerrorenum icalfileset_commit(icalset* set); |
66 | 66 | ||
67 | icalerrorenum icalfileset_add_component(icalfileset* cluster, | 67 | icalerrorenum icalfileset_add_component(icalset* set, |
68 | icalcomponent* child); | 68 | icalcomponent* child); |
69 | 69 | ||
70 | icalerrorenum icalfileset_remove_component(icalfileset* cluster, | 70 | icalerrorenum icalfileset_remove_component(icalset* set, |
71 | icalcomponent* child); | 71 | icalcomponent* child); |
72 | 72 | ||
73 | int icalfileset_count_components(icalfileset* cluster, | 73 | int 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 |
78 | icalerrorenum icalfileset_select(icalfileset* store, icalgauge* gauge); | 78 | * that pass the gauge. _clear removes the gauge |
79 | void icalfileset_clear(icalfileset* store); | 79 | */ |
80 | icalerrorenum icalfileset_select(icalset* set, icalgauge* gauge); | ||
81 | |||
82 | /** clear the gauge **/ | ||
83 | void icalfileset_clear(icalset* set); | ||
80 | 84 | ||
81 | /* Get and search for a component by uid */ | 85 | /** Get and search for a component by uid **/ |
82 | icalcomponent* icalfileset_fetch(icalfileset* cluster, const char* uid); | 86 | icalcomponent* icalfileset_fetch(icalset* set, const char* uid); |
83 | int icalfileset_has_uid(icalfileset* cluster, const char* uid); | 87 | int icalfileset_has_uid(icalset* set, const char* uid); |
84 | icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *c); | 88 | icalcomponent* 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 |
89 | icalerrorenum icalfileset_modify(icalfileset* store, icalcomponent *oldcomp, | 93 | * currently selected components. |
94 | */ | ||
95 | icalerrorenum 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 | ||
95 | icalcomponent* icalfileset_get_current_component (icalfileset* cluster); | 102 | icalcomponent* icalfileset_get_current_component (icalset* cluster); |
96 | icalcomponent* icalfileset_get_first_component(icalfileset* cluster); | 103 | icalcomponent* icalfileset_get_first_component(icalset* cluster); |
97 | icalcomponent* icalfileset_get_next_component(icalfileset* cluster); | 104 | icalcomponent* icalfileset_get_next_component(icalset* cluster); |
98 | /* Return a reference to the internal component. You probably should | 105 | |
106 | /* External iterator for thread safety */ | ||
107 | icalsetiter icalfileset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge); | ||
108 | icalcomponent * icalfilesetiter_to_next(icalset* set, icalsetiter *iter); | ||
109 | icalcomponent* 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 | ||
101 | icalcomponent* icalfileset_get_component(icalfileset* cluster); | 114 | icalcomponent* 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 | |||
122 | typedef 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 | ||
129 | extern icalfileset_options icalfileset_options_default; | ||
103 | 130 | ||
104 | #endif /* !ICALFILESET_H */ | 131 | #endif /* !ICALFILESET_H */ |
105 | 132 | ||
106 | 133 | ||
107 | 134 | ||