summaryrefslogtreecommitdiffstats
path: root/storage/mroonga/vendor/groonga/lib/grn_output.h
blob: 1436410745728d283d069fed4ef82ad39d039842 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* -*- c-basic-offset: 2 -*- */
/*
  Copyright(C) 2010-2016 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-1335  USA
*/

#pragma once

#include "grn.h"
#include "grn_ctx.h"
#include "grn_store.h"
#include "grn_ctx_impl.h"

#ifdef __cplusplus
extern "C" {
#endif

GRN_API void grn_output_array_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
                           const char *name, int nelements);
GRN_API void grn_output_array_close(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type);
GRN_API void grn_output_map_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
                                 const char *name, int nelements);
GRN_API void grn_output_map_close(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type);
GRN_API void grn_output_null(grn_ctx *ctx, grn_obj *outbuf,
                             grn_content_type output_type);
void grn_output_int32(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
                      int32_t value);
GRN_API void grn_output_int64(grn_ctx *ctx, grn_obj *outbuf,
                              grn_content_type output_type,
                              int64_t value);
GRN_API void grn_output_uint64(grn_ctx *ctx, grn_obj *outbuf,
                               grn_content_type output_type,
                               uint64_t value);
void grn_output_float(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
                      double value);
GRN_API void grn_output_cstr(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
                             const char *value);
GRN_API void grn_output_str(grn_ctx *ctx, grn_obj *outbuf,
                            grn_content_type output_type,
                            const char *value, size_t value_len);
GRN_API void grn_output_bool(grn_ctx *ctx, grn_obj *outbuf,
                             grn_content_type output_type,
                             grn_bool value);

GRN_API void grn_output_result_set_open(grn_ctx *ctx,
                                        grn_obj *outbuf,
                                        grn_content_type output_type,
                                        grn_obj *result_set,
                                        grn_obj_format *format,
                                        uint32_t n_additional_elements);
GRN_API void grn_output_result_set_close(grn_ctx *ctx,
                                         grn_obj *outbuf,
                                         grn_content_type output_type,
                                         grn_obj *result_set,
                                         grn_obj_format *format);
GRN_API void grn_output_result_set(grn_ctx *ctx,
                                   grn_obj *outbuf,
                                   grn_content_type output_type,
                                   grn_obj *result_set,
                                   grn_obj_format *format);
GRN_API void grn_output_table_columns(grn_ctx *ctx,
                                      grn_obj *outbuf,
                                      grn_content_type output_type,
                                      grn_obj *table,
                                      grn_obj_format *format);
GRN_API void grn_output_table_records(grn_ctx *ctx,
                                      grn_obj *outbuf,
                                      grn_content_type output_type,
                                      grn_obj *table,
                                      grn_obj_format *format);

grn_rc grn_output_format_set_columns(grn_ctx *ctx, grn_obj_format *format,
                                     grn_obj *table,
                                     const char *columns, int columns_len);

#define GRN_OUTPUT_ARRAY_OPEN(name,nelements) \
  (grn_ctx_output_array_open(ctx, name, nelements))
#define GRN_OUTPUT_ARRAY_CLOSE() \
  (grn_ctx_output_array_close(ctx))
#define GRN_OUTPUT_MAP_OPEN(name,nelements) \
  (grn_ctx_output_map_open(ctx, name, nelements))
#define GRN_OUTPUT_MAP_CLOSE() \
  (grn_ctx_output_map_close(ctx))
#define GRN_OUTPUT_NULL() \
  (grn_ctx_output_null(ctx))
#define GRN_OUTPUT_INT32(value) \
  (grn_ctx_output_int32(ctx, value))
#define GRN_OUTPUT_INT64(value) \
  (grn_ctx_output_int64(ctx, value))
#define GRN_OUTPUT_UINT64(value) \
  (grn_ctx_output_uint64(ctx, value))
#define GRN_OUTPUT_FLOAT(value) \
  (grn_ctx_output_float(ctx, value))
#define GRN_OUTPUT_CSTR(value)\
  (grn_ctx_output_cstr(ctx, value))
#define GRN_OUTPUT_STR(value,value_len)\
  (grn_ctx_output_str(ctx, value, value_len))
#define GRN_OUTPUT_BOOL(value)\
  (grn_ctx_output_bool(ctx, value))
#define GRN_OUTPUT_OBJ(obj,format)\
  (grn_ctx_output_obj(ctx, obj, format))
#define GRN_OUTPUT_RESULT_SET_OPEN(result_set,format,n_additional_elements)\
  (grn_ctx_output_result_set_open(ctx, result_set, format, n_additional_elements))
#define GRN_OUTPUT_RESULT_SET_CLOSE(result_set,format)\
  (grn_ctx_output_result_set_close(ctx, result_set, format))
#define GRN_OUTPUT_RESULT_SET(result_set,format,n_additional_elements)\
  (grn_ctx_output_result_set(ctx, result_set, format, n_additional_elements))
#define GRN_OUTPUT_TABLE_COLUMNS(table,format)\
  (grn_ctx_output_table_columns(ctx, table, format))
#define GRN_OUTPUT_TABLE_RECORDS(table,format)\
  (grn_ctx_output_table_records(ctx, table, format))

#ifdef __cplusplus
}
#endif