1 | /* -*- c-basic-offset: 2 -*- */ |
2 | /* |
3 | Copyright(C) 2015-2016 Brazil |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License version 2.1 as published by the Free Software Foundation. |
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 | |
19 | #pragma once |
20 | |
21 | #include "../grn.h" |
22 | |
23 | #include "ts_types.h" |
24 | |
25 | #ifdef __cplusplus |
26 | extern "C" { |
27 | #endif |
28 | |
29 | typedef enum { |
30 | GRN_TS_OBJ_CURSOR /* Wrapper cursor. */ |
31 | } grn_ts_cursor_type; |
32 | |
33 | #define GRN_TS_CURSOR_COMMON_MEMBERS\ |
34 | grn_ts_cursor_type type; /* Cursor type. */ |
35 | |
36 | typedef struct { |
37 | GRN_TS_CURSOR_COMMON_MEMBERS |
38 | } grn_ts_cursor; |
39 | |
40 | /* |
41 | * grn_ts_obj_cursor_open() creates a wrapper cursor. |
42 | * The new cursor will be a wrapper for a Groonga cursor specified by `obj`. |
43 | * On success, `obj` will be closed in grn_ts_cursor_close(). |
44 | * On failure, `obj` is left as is. |
45 | */ |
46 | grn_rc grn_ts_obj_cursor_open(grn_ctx *ctx, grn_obj *obj, |
47 | grn_ts_cursor **cursor); |
48 | |
49 | /* grn_ts_cursor_close() destroys a cursor. */ |
50 | grn_rc grn_ts_cursor_close(grn_ctx *ctx, grn_ts_cursor *cursor); |
51 | |
52 | /* grn_ts_cursor_read() reads records from a cursor. */ |
53 | grn_rc grn_ts_cursor_read(grn_ctx *ctx, grn_ts_cursor *cursor, |
54 | grn_ts_record *out, size_t max_n_out, size_t *n_out); |
55 | |
56 | #ifdef __cplusplus |
57 | } |
58 | #endif |
59 | |
60 | |