Debian Codegraph @

include/groonga/command.h

raw symbols SCIP
1 /*
2 Copyright(C) 2015-2016 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 as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
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 <groonga/plugin.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26
27 typedef struct _grn_command_input grn_command_input;
28
29 GRN_PLUGIN_EXPORT grn_command_input *
30 grn_command_input_open(grn_ctx *ctx, grn_obj *command);
31 GRN_PLUGIN_EXPORT grn_rc
32 grn_command_input_close(grn_ctx *ctx, grn_command_input *input);
33
34 GRN_PLUGIN_EXPORT grn_obj *
35 grn_command_input_add(grn_ctx *ctx,
36 grn_command_input *input,
37 const char *name,
38 int name_size,
39 bool *added);
40 GRN_PLUGIN_EXPORT grn_obj *
41 grn_command_input_get(grn_ctx *ctx,
42 grn_command_input *input,
43 const char *name,
44 int name_size);
45 GRN_PLUGIN_EXPORT grn_obj *
46 grn_command_input_at(grn_ctx *ctx,
47 grn_command_input *input,
48 unsigned int offset);
49 GRN_PLUGIN_EXPORT grn_obj *
50 grn_command_input_get_arguments(grn_ctx *ctx, grn_command_input *input);
51
52 typedef void
53 grn_command_run_func(grn_ctx *ctx,
54 grn_obj *command,
55 grn_command_input *input,
56 void *user_data);
57
58 /*
59 grn_command_register() registers a command to the database which is
60 associated with `ctx'. `command_name' and `command_name_size'
61 specify the command name. Alphabetic letters ('A'-'Z' and 'a'-'z'),
62 digits ('0'-'9') and an underscore ('_') are capable characters.
63
64 `run' is called for running the command.
65
66 grn_command_register() returns GRN_SUCCESS on success, an error
67 code on failure.
68 */
69 GRN_PLUGIN_EXPORT grn_rc
70 grn_command_register(grn_ctx *ctx,
71 const char *command_name,
72 int command_name_size,
73 grn_command_run_func *run,
74 grn_expr_var *vars,
75 unsigned int n_vars,
76 void *user_data);
77
78 GRN_PLUGIN_EXPORT grn_rc
79 grn_command_run(grn_ctx *ctx, grn_obj *command, grn_command_input *input);
80
81 #ifdef __cplusplus
82 } /* extern "C" */
83 #endif /* __cplusplus */