1 | /* -*- c-basic-offset: 2 -*- */ |
2 | /* |
3 | Copyright(C) 2010-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 | #include "grn_ctx.h" |
23 | #include "grn_store.h" |
24 | #include "grn_ctx_impl.h" |
25 | |
26 | #ifdef __cplusplus |
27 | extern "C" { |
28 | #endif |
29 | |
30 | GRN_API void grn_output_array_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, |
31 | const char *name, int nelements); |
32 | GRN_API void grn_output_array_close(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type); |
33 | GRN_API void grn_output_map_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, |
34 | const char *name, int nelements); |
35 | GRN_API void grn_output_map_close(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type); |
36 | GRN_API void grn_output_null(grn_ctx *ctx, grn_obj *outbuf, |
37 | grn_content_type output_type); |
38 | void grn_output_int32(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, |
39 | int32_t value); |
40 | GRN_API void grn_output_int64(grn_ctx *ctx, grn_obj *outbuf, |
41 | grn_content_type output_type, |
42 | int64_t value); |
43 | GRN_API void grn_output_uint64(grn_ctx *ctx, grn_obj *outbuf, |
44 | grn_content_type output_type, |
45 | uint64_t value); |
46 | void grn_output_float(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, |
47 | double value); |
48 | GRN_API void grn_output_cstr(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, |
49 | const char *value); |
50 | GRN_API void grn_output_str(grn_ctx *ctx, grn_obj *outbuf, |
51 | grn_content_type output_type, |
52 | const char *value, size_t value_len); |
53 | GRN_API void grn_output_bool(grn_ctx *ctx, grn_obj *outbuf, |
54 | grn_content_type output_type, |
55 | grn_bool value); |
56 | |
57 | GRN_API void grn_output_result_set_open(grn_ctx *ctx, |
58 | grn_obj *outbuf, |
59 | grn_content_type output_type, |
60 | grn_obj *result_set, |
61 | grn_obj_format *format, |
62 | uint32_t n_additional_elements); |
63 | GRN_API void grn_output_result_set_close(grn_ctx *ctx, |
64 | grn_obj *outbuf, |
65 | grn_content_type output_type, |
66 | grn_obj *result_set, |
67 | grn_obj_format *format); |
68 | GRN_API void grn_output_result_set(grn_ctx *ctx, |
69 | grn_obj *outbuf, |
70 | grn_content_type output_type, |
71 | grn_obj *result_set, |
72 | grn_obj_format *format); |
73 | GRN_API void grn_output_table_columns(grn_ctx *ctx, |
74 | grn_obj *outbuf, |
75 | grn_content_type output_type, |
76 | grn_obj *table, |
77 | grn_obj_format *format); |
78 | GRN_API void grn_output_table_records(grn_ctx *ctx, |
79 | grn_obj *outbuf, |
80 | grn_content_type output_type, |
81 | grn_obj *table, |
82 | grn_obj_format *format); |
83 | |
84 | grn_rc grn_output_format_set_columns(grn_ctx *ctx, grn_obj_format *format, |
85 | grn_obj *table, |
86 | const char *columns, int columns_len); |
87 | |
88 | #define GRN_OUTPUT_ARRAY_OPEN(name,nelements) \ |
89 | (grn_ctx_output_array_open(ctx, name, nelements)) |
90 | #define GRN_OUTPUT_ARRAY_CLOSE() \ |
91 | (grn_ctx_output_array_close(ctx)) |
92 | #define GRN_OUTPUT_MAP_OPEN(name,nelements) \ |
93 | (grn_ctx_output_map_open(ctx, name, nelements)) |
94 | #define GRN_OUTPUT_MAP_CLOSE() \ |
95 | (grn_ctx_output_map_close(ctx)) |
96 | #define GRN_OUTPUT_NULL() \ |
97 | (grn_ctx_output_null(ctx)) |
98 | #define GRN_OUTPUT_INT32(value) \ |
99 | (grn_ctx_output_int32(ctx, value)) |
100 | #define GRN_OUTPUT_INT64(value) \ |
101 | (grn_ctx_output_int64(ctx, value)) |
102 | #define GRN_OUTPUT_UINT64(value) \ |
103 | (grn_ctx_output_uint64(ctx, value)) |
104 | #define GRN_OUTPUT_FLOAT(value) \ |
105 | (grn_ctx_output_float(ctx, value)) |
106 | #define GRN_OUTPUT_CSTR(value)\ |
107 | (grn_ctx_output_cstr(ctx, value)) |
108 | #define GRN_OUTPUT_STR(value,value_len)\ |
109 | (grn_ctx_output_str(ctx, value, value_len)) |
110 | #define GRN_OUTPUT_BOOL(value)\ |
111 | (grn_ctx_output_bool(ctx, value)) |
112 | #define GRN_OUTPUT_OBJ(obj,format)\ |
113 | (grn_ctx_output_obj(ctx, obj, format)) |
114 | #define GRN_OUTPUT_RESULT_SET_OPEN(result_set,format,n_additional_elements)\ |
115 | (grn_ctx_output_result_set_open(ctx, result_set, format, n_additional_elements)) |
116 | #define GRN_OUTPUT_RESULT_SET_CLOSE(result_set,format)\ |
117 | (grn_ctx_output_result_set_close(ctx, result_set, format)) |
118 | #define GRN_OUTPUT_RESULT_SET(result_set,format,n_additional_elements)\ |
119 | (grn_ctx_output_result_set(ctx, result_set, format, n_additional_elements)) |
120 | #define GRN_OUTPUT_TABLE_COLUMNS(table,format)\ |
121 | (grn_ctx_output_table_columns(ctx, table, format)) |
122 | #define GRN_OUTPUT_TABLE_RECORDS(table,format)\ |
123 | (grn_ctx_output_table_records(ctx, table, format)) |
124 | |
125 | #ifdef __cplusplus |
126 | } |
127 | #endif |
128 | |