summaryrefslogtreecommitdiff
path: root/storage/mroonga/vendor/groonga/lib/mrb/mrb_converter.h
blob: c2cb58c0e6d07509d78f967b3988a169fcbac399 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* -*- c-basic-offset: 2 -*- */
/*
  Copyright(C) 2013 Brazil

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License version 2.1 as published by the Free Software Foundation.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

#ifndef GRN_MRB_CONVERTER_H
#define GRN_MRB_CONVERTER_H

#include "../grn_ctx.h"

#ifdef __cplusplus
extern "C" {
#endif

void grn_mrb_converter_init(grn_ctx *ctx);

typedef struct {
  grn_obj from;
  grn_obj to;
  union {
    int64_t time_value;
  } value;
} grn_mrb_value_to_raw_data_buffer;

void grn_mrb_value_to_raw_data_buffer_init(mrb_state *mrb,
                                           grn_mrb_value_to_raw_data_buffer *buffer);
void grn_mrb_value_to_raw_data_buffer_fin(mrb_state *mrb,
                                          grn_mrb_value_to_raw_data_buffer *buffer);
void grn_mrb_value_to_raw_data(mrb_state *mrb,
                               const char *context,
                               mrb_value mrb_value_,
                               grn_id domain_id,
                               grn_mrb_value_to_raw_data_buffer *buffer,
                               void **raw_value,
                               unsigned int *raw_value_size);

struct RClass *grn_mrb_class_from_grn_obj(mrb_state *mrb, grn_obj *object);
mrb_value      grn_mrb_value_from_grn_obj(mrb_state *mrb, grn_obj *object);

grn_id grn_mrb_class_to_grn_type(mrb_state *mrb, struct RClass *klass);
grn_id grn_mrb_value_to_grn_type(mrb_state *mrb, mrb_value value);

#ifdef __cplusplus
}
#endif

#endif /* GRN_MRB_CONVERTER_H */