1 /*
2   Copyright(C) 2009-2016 Brazil
3 
4   This library is free software; you can redistribute it and/or
5   modify it under the terms of the GNU Lesser General Public
6   License as published by the Free Software Foundation; either
7   version 2.1 of the License, or (at your option) any later version.
8 
9   This library is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   Lesser General Public License for more details.
13 
14   You should have received a copy of the GNU Lesser General Public
15   License along with this library; if not, write to the Free Software
16   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18 module groonga_d.array;
19 
20 
21 private static import groonga_d.groonga;
22 
23 extern(C):
24 nothrow @nogc:
25 
26 extern struct _grn_array;
27 extern struct _grn_array_cursor;
28 
29 alias grn_array = _grn_array;
30 alias grn_array_cursor = _grn_array_cursor;
31 
32 //GRN_API
33 grn_array* grn_array_create(groonga_d.groonga.grn_ctx* ctx, const (char)* path, uint value_size, uint flags);
34 
35 //GRN_API
36 grn_array* grn_array_open(groonga_d.groonga.grn_ctx* ctx, const (char)* path);
37 
38 //GRN_API
39 groonga_d.groonga.grn_rc grn_array_close(groonga_d.groonga.grn_ctx* ctx, grn_array* array);
40 
41 //GRN_API
42 groonga_d.groonga.grn_id grn_array_add(groonga_d.groonga.grn_ctx* ctx, grn_array* array, void** value);
43 
44 //GRN_API
45 groonga_d.groonga.grn_id grn_array_push(groonga_d.groonga.grn_ctx* ctx, grn_array* array, void function(groonga_d.groonga.grn_ctx* ctx, grn_array* array, groonga_d.groonga.grn_id id, void* func_arg) func, void* func_arg);
46 
47 //GRN_API
48 groonga_d.groonga.grn_id grn_array_pull(groonga_d.groonga.grn_ctx* ctx, grn_array* array, groonga_d.groonga.grn_bool blockp, void function(groonga_d.groonga.grn_ctx* ctx, grn_array* array, groonga_d.groonga.grn_id id, void* func_arg) func, void* func_arg);
49 
50 //GRN_API
51 void grn_array_unblock(groonga_d.groonga.grn_ctx* ctx, grn_array* array);
52 
53 //GRN_API
54 int grn_array_get_value(groonga_d.groonga.grn_ctx* ctx, grn_array* array, groonga_d.groonga.grn_id id, void* valuebuf);
55 
56 //GRN_API
57 groonga_d.groonga.grn_rc grn_array_set_value(groonga_d.groonga.grn_ctx* ctx, grn_array* array, groonga_d.groonga.grn_id id, const (void)* value, int flags);
58 
59 //GRN_API
60 grn_array_cursor* grn_array_cursor_open(groonga_d.groonga.grn_ctx* ctx, grn_array* array, groonga_d.groonga.grn_id min, groonga_d.groonga.grn_id max, int offset, int limit, int flags);
61 
62 //GRN_API
63 groonga_d.groonga.grn_id grn_array_cursor_next(groonga_d.groonga.grn_ctx* ctx, grn_array_cursor* cursor);
64 
65 //GRN_API
66 int grn_array_cursor_get_value(groonga_d.groonga.grn_ctx* ctx, grn_array_cursor* cursor, void** value);
67 
68 //GRN_API
69 groonga_d.groonga.grn_rc grn_array_cursor_set_value(groonga_d.groonga.grn_ctx* ctx, grn_array_cursor* cursor, const (void)* value, int flags);
70 
71 //GRN_API
72 groonga_d.groonga.grn_rc grn_array_cursor_delete(groonga_d.groonga.grn_ctx* ctx, grn_array_cursor* cursor, groonga_d.groonga.grn_table_delete_optarg* optarg);
73 
74 //GRN_API
75 void grn_array_cursor_close(groonga_d.groonga.grn_ctx* ctx, grn_array_cursor* cursor);
76 
77 //GRN_API
78 groonga_d.groonga.grn_rc grn_array_delete_by_id(groonga_d.groonga.grn_ctx* ctx, grn_array* array, groonga_d.groonga.grn_id id, groonga_d.groonga.grn_table_delete_optarg* optarg);
79 
80 //GRN_API
81 groonga_d.groonga.grn_id grn_array_next(groonga_d.groonga.grn_ctx* ctx, grn_array* array, groonga_d.groonga.grn_id id);
82 
83 //GRN_API
84 void* _grn_array_get_value(groonga_d.groonga.grn_ctx* ctx, grn_array* array, groonga_d.groonga.grn_id id);
85 
86 /+
87 #define GRN_ARRAY_EACH(ctx, array, head, tail, id, value, block) grn_array_cursor *_sc = grn_array_cursor_open(ctx, array, head, tail, 0, -1, 0); if (_sc) { groonga_d.groonga.grn_id id; while ((id = grn_array_cursor_next(ctx, _sc))) { grn_array_cursor_get_value(ctx, _sc, (void **)(value)); block } grn_array_cursor_close(ctx, _sc); }
88 
89 #define GRN_ARRAY_EACH_BEGIN(ctx, array, cursor, head, tail, id) do { grn_array_cursor *cursor; cursor = grn_array_cursor_open((ctx), (array), (head), (tail), 0, -1, 0); if (cursor) { groonga_d.groonga.grn_id id; while ((id = grn_array_cursor_next(ctx, cursor))) {
90 
91 #define GRN_ARRAY_EACH_END(ctx, cursor) } grn_array_cursor_close(ctx, cursor); } } while (0)
92 +/