Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
output.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 2 -*- */
2 /* Copyright(C) 2010-2012 Brazil
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License version 2.1 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Lesser General Public License for more details.
12 
13  You should have received a copy of the GNU Lesser General Public
14  License along with this library; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 #ifndef GRN_OUTPUT_H
18 #define GRN_OUTPUT_H
19 
20 #ifndef GROONGA_IN_H
21 #include "groonga_in.h"
22 #endif /* GROONGA_IN_H */
23 
24 #ifndef GRN_CTX_H
25 #include "ctx.h"
26 #endif /* GRN_CTX_H */
27 
28 #ifndef GRN_STORE_H
29 #include "store.h"
30 #endif /* GRN_STORE_H */
31 
32 #ifndef GRN_CTX_IMPL_H
33 #include "ctx_impl.h"
34 #endif /* GRN_CTX_IMPL_H */
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 GRN_API void grn_output_array_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
41  const char *name, int nelements);
42 GRN_API void grn_output_array_close(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type);
43 GRN_API void grn_output_map_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
44  const char *name, int nelements);
45 GRN_API void grn_output_map_close(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type);
46 void grn_output_int32(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
47  int32_t value);
48 GRN_API void grn_output_int64(grn_ctx *ctx, grn_obj *outbuf,
49  grn_content_type output_type,
50  int64_t value);
51 void grn_output_float(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
52  double value);
53 GRN_API void grn_output_cstr(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
54  const char *value);
55 GRN_API void grn_output_str(grn_ctx *ctx, grn_obj *outbuf,
56  grn_content_type output_type,
57  const char *value, size_t value_len);
58 GRN_API void grn_output_bool(grn_ctx *ctx, grn_obj *outbuf,
59  grn_content_type output_type,
60  grn_bool value);
61 
62 #define GRN_OUTPUT_ARRAY_OPEN(name,nelements) \
63  (grn_ctx_output_array_open(ctx, name, nelements))
64 #define GRN_OUTPUT_ARRAY_CLOSE() \
65  (grn_ctx_output_array_close(ctx))
66 #define GRN_OUTPUT_MAP_OPEN(name,nelements) \
67  (grn_ctx_output_map_open(ctx, name, nelements))
68 #define GRN_OUTPUT_MAP_CLOSE() \
69  (grn_ctx_output_map_close(ctx))
70 #define GRN_OUTPUT_INT32(value) \
71  (grn_ctx_output_int32(ctx, value))
72 #define GRN_OUTPUT_INT64(value) \
73  (grn_ctx_output_int64(ctx, value))
74 #define GRN_OUTPUT_FLOAT(value) \
75  (grn_ctx_output_float(ctx, value))
76 #define GRN_OUTPUT_CSTR(value)\
77  (grn_ctx_output_cstr(ctx, value))
78 #define GRN_OUTPUT_STR(value,value_len)\
79  (grn_ctx_output_str(ctx, value, value_len))
80 #define GRN_OUTPUT_BOOL(value)\
81  (grn_ctx_output_bool(ctx, value))
82 #define GRN_OUTPUT_OBJ(obj,format)\
83  (grn_ctx_output_obj(ctx, obj, format))
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* GRN_OUTPUT_H */