]> git.notmuchmail.org Git - notmuch/blob - bindings/ruby/defs.h
Initial ruby bindings
[notmuch] / bindings / ruby / defs.h
1 /* The Ruby interface to the notmuch mail library
2  *
3  * Copyright © 2010 Ali Polatel
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see http://www.gnu.org/licenses/ .
17  *
18  * Author: Ali Polatel <alip@exherbo.org>
19  */
20
21 #ifndef DEFS_H
22 #define DEFS_H
23
24 #include <notmuch.h>
25 #include <ruby.h>
26
27 VALUE notmuch_rb_cDatabase;
28 VALUE notmuch_rb_cDirectory;
29 VALUE notmuch_rb_cFileNames;
30 VALUE notmuch_rb_cQuery;
31 VALUE notmuch_rb_cThreads;
32 VALUE notmuch_rb_cThread;
33 VALUE notmuch_rb_cMessages;
34 VALUE notmuch_rb_cMessage;
35 VALUE notmuch_rb_cTags;
36
37 VALUE notmuch_rb_eBaseError;
38 VALUE notmuch_rb_eDatabaseError;
39 VALUE notmuch_rb_eMemoryError;
40 VALUE notmuch_rb_eReadOnlyError;
41 VALUE notmuch_rb_eXapianError;
42 VALUE notmuch_rb_eFileError;
43 VALUE notmuch_rb_eFileNotEmailError;
44 VALUE notmuch_rb_eNullPointerError;
45 VALUE notmuch_rb_eTagTooLongError;
46 VALUE notmuch_rb_eUnbalancedFreezeThawError;
47
48 ID ID_call;
49 ID ID_db_create;
50 ID ID_db_mode;
51
52 typedef struct {
53     notmuch_database_t *nm_db;
54 } notmuch_rb_database_t;
55
56 typedef struct {
57     notmuch_directory_t *nm_dir;
58     VALUE db;
59 } notmuch_rb_directory_t;
60
61 typedef struct {
62     notmuch_filenames_t *nm_flist;
63     VALUE dir;
64 } notmuch_rb_filenames_t;
65
66 typedef struct {
67     notmuch_query_t *nm_query;
68     VALUE db;
69 } notmuch_rb_query_t;
70
71 typedef struct {
72     notmuch_threads_t *nm_threads;
73     VALUE query;
74 } notmuch_rb_threads_t;
75
76 typedef struct {
77     notmuch_messages_t *nm_messages;
78     VALUE parent;
79 } notmuch_rb_messages_t;
80
81 typedef struct {
82     notmuch_thread_t *nm_thread;
83     VALUE threads;
84 } notmuch_rb_thread_t;
85
86 typedef struct {
87     notmuch_message_t *nm_message;
88     VALUE parent;
89 } notmuch_rb_message_t;
90
91 typedef struct {
92     notmuch_tags_t *nm_tags;
93     VALUE parent;
94 } notmuch_rb_tags_t;
95
96 /* status.c */
97 void
98 notmuch_rb_status_raise(notmuch_status_t status);
99
100 /* gc.c */
101 void
102 notmuch_rb_database_free(notmuch_rb_database_t *db);
103
104 void
105 notmuch_rb_directory_mark(notmuch_rb_directory_t *dir);
106
107 void
108 notmuch_rb_directory_free(notmuch_rb_directory_t *dir);
109
110 void
111 notmuch_rb_filenames_mark(notmuch_rb_filenames_t *flist);
112
113 void
114 notmuch_rb_filenames_free(notmuch_rb_filenames_t *flist);
115
116 void
117 notmuch_rb_query_mark(notmuch_rb_query_t *query);
118
119 void
120 notmuch_rb_query_free(notmuch_rb_query_t *query);
121
122 void
123 notmuch_rb_threads_mark(notmuch_rb_threads_t *threads);
124
125 void
126 notmuch_rb_threads_free(notmuch_rb_threads_t *threads);
127
128 void
129 notmuch_rb_messages_mark(notmuch_rb_messages_t *messages);
130
131 void
132 notmuch_rb_messages_free(notmuch_rb_messages_t *messages);
133
134 void
135 notmuch_rb_thread_mark(notmuch_rb_thread_t *thread);
136
137 void
138 notmuch_rb_thread_free(notmuch_rb_thread_t *thread);
139
140 void
141 notmuch_rb_message_mark(notmuch_rb_message_t *message);
142
143 void
144 notmuch_rb_message_free(notmuch_rb_message_t *message);
145
146 void
147 notmuch_rb_tags_mark(notmuch_rb_tags_t *tags);
148
149 void
150 notmuch_rb_tags_free(notmuch_rb_tags_t *tags);
151
152 /* database.c */
153 VALUE
154 notmuch_rb_database_new(int argc, VALUE *argv, VALUE klass);
155
156 VALUE
157 notmuch_rb_database_close(VALUE self);
158
159 VALUE
160 notmuch_rb_database_path(VALUE self);
161
162 VALUE
163 notmuch_rb_database_version(VALUE self);
164
165 VALUE
166 notmuch_rb_database_needs_upgrade(VALUE self);
167
168 VALUE
169 notmuch_rb_database_upgrade(VALUE self);
170
171 VALUE
172 notmuch_rb_database_get_directory(VALUE self, VALUE pathv);
173
174 VALUE
175 notmuch_rb_database_add_message(VALUE self, VALUE pathv);
176
177 VALUE
178 notmuch_rb_database_remove_message(VALUE self, VALUE pathv);
179
180 VALUE
181 notmuch_rb_database_query_create(VALUE self, VALUE qstrv);
182
183 /* directory.c */
184 VALUE
185 notmuch_rb_directory_get_mtime(VALUE self);
186
187 VALUE
188 notmuch_rb_directory_set_mtime(VALUE self, VALUE mtimev);
189
190 VALUE
191 notmuch_rb_directory_get_child_files(VALUE self);
192
193 VALUE
194 notmuch_rb_directory_get_child_directories(VALUE self);
195
196 /* filenames.c */
197 VALUE
198 notmuch_rb_filenames_each(VALUE self);
199
200 /* query.c */
201 VALUE
202 notmuch_rb_query_set_sort(VALUE self, VALUE sortv);
203
204 VALUE
205 notmuch_rb_query_search_threads(VALUE self);
206
207 VALUE
208 notmuch_rb_query_search_messages(VALUE self);
209
210 /* threads.c */
211 VALUE
212 notmuch_rb_threads_each(VALUE self);
213
214 /* messages.c */
215 VALUE
216 notmuch_rb_messages_each(VALUE self);
217
218 VALUE
219 notmuch_rb_messages_collect_tags(VALUE self);
220
221 /* thread.c */
222 VALUE
223 notmuch_rb_thread_get_thread_id(VALUE self);
224
225 VALUE
226 notmuch_rb_thread_get_total_messages(VALUE self);
227
228 VALUE
229 notmuch_rb_thread_get_toplevel_messages(VALUE self);
230
231 VALUE
232 notmuch_rb_thread_get_matched_messages(VALUE self);
233
234 VALUE
235 notmuch_rb_thread_get_authors(VALUE self);
236
237 VALUE
238 notmuch_rb_thread_get_subject(VALUE self);
239
240 VALUE
241 notmuch_rb_thread_get_oldest_date(VALUE self);
242
243 VALUE
244 notmuch_rb_thread_get_newest_date(VALUE self);
245
246 VALUE
247 notmuch_rb_thread_get_tags(VALUE self);
248
249 /* message.c */
250 VALUE
251 notmuch_rb_message_get_message_id(VALUE self);
252
253 VALUE
254 notmuch_rb_message_get_thread_id(VALUE self);
255
256 VALUE
257 notmuch_rb_message_get_replies(VALUE self);
258
259 VALUE
260 notmuch_rb_message_get_filename(VALUE self);
261
262 VALUE
263 notmuch_rb_message_get_flag(VALUE self, VALUE flagv);
264
265 VALUE
266 notmuch_rb_message_set_flag(VALUE self, VALUE flagv, VALUE valuev);
267
268 VALUE
269 notmuch_rb_message_get_date(VALUE self);
270
271 VALUE
272 notmuch_rb_message_get_header(VALUE self, VALUE headerv);
273
274 VALUE
275 notmuch_rb_message_get_tags(VALUE self);
276
277 VALUE
278 notmuch_rb_message_add_tag(VALUE self, VALUE tagv);
279
280 VALUE
281 notmuch_rb_message_remove_tag(VALUE self, VALUE tagv);
282
283 VALUE
284 notmuch_rb_message_remove_all_tags(VALUE self);
285
286 VALUE
287 notmuch_rb_message_freeze(VALUE self);
288
289 VALUE
290 notmuch_rb_message_thaw(VALUE self);
291
292 /* tags.c */
293 VALUE
294 notmuch_rb_tags_each(VALUE self);
295
296 /* init.c */
297 void
298 Init_notmuch(void);
299
300 #endif