Debian Codegraph @

storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.h

raw
1 /* -*- c-basic-offset: 2 -*- */
2 /*
3 Copyright(C) 2013-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-1335 USA
17 */
18
19 #pragma once
20
21 #include "../grn_ctx.h"
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #define GRN_MRB_DATA_PTR(mrb_object) \
28 (mrb_nil_p((mrb_object)) ? NULL : DATA_PTR((mrb_object)))
29
30 void grn_mrb_converter_init(grn_ctx *ctx);
31
32 typedef struct {
33 grn_obj from;
34 grn_obj to;
35 union {
36 int64_t time_value;
37 } value;
38 } grn_mrb_value_to_raw_data_buffer;
39
40 void grn_mrb_value_to_raw_data_buffer_init(mrb_state *mrb,
41 grn_mrb_value_to_raw_data_buffer *buffer);
42 void grn_mrb_value_to_raw_data_buffer_fin(mrb_state *mrb,
43 grn_mrb_value_to_raw_data_buffer *buffer);
44 void grn_mrb_value_to_raw_data(mrb_state *mrb,
45 const char *context,
46 mrb_value mrb_value_,
47 grn_id domain_id,
48 grn_mrb_value_to_raw_data_buffer *buffer,
49 void **raw_value,
50 unsigned int *raw_value_size);
51 mrb_value grn_mrb_value_from_raw_data(mrb_state *mrb,
52 grn_id domain,
53 void *raw_value,
54 unsigned int raw_value_size);
55
56 struct RClass *grn_mrb_class_from_grn_obj(mrb_state *mrb, grn_obj *object);
57 mrb_value grn_mrb_value_from_grn_obj(mrb_state *mrb, grn_obj *object);
58
59 grn_id grn_mrb_class_to_grn_type(mrb_state *mrb, struct RClass *klass);
60 grn_id grn_mrb_value_to_grn_type(mrb_state *mrb, mrb_value value);
61
62 #ifdef __cplusplus
63 }
64 #endif