Groonga
Loading...
Searching...
No Matches
command.h
Go to the documentation of this file.
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
24extern "C" {
25#endif /* __cplusplus */
26
27typedef struct _grn_command_input grn_command_input;
28
33
36 grn_command_input *input,
37 const char *name,
38 int name_size,
39 bool *added);
42 grn_command_input *input,
43 const char *name,
44 int name_size);
47 grn_command_input *input,
48 unsigned int offset);
51
52typedef void
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 */
71 const char *command_name,
72 int command_name_size,
74 grn_expr_var *vars,
75 unsigned int n_vars,
76 void *user_data);
77
80
81#ifdef __cplusplus
82} /* extern "C" */
83#endif /* __cplusplus */
GRN_PLUGIN_EXPORT grn_obj * grn_command_input_get(grn_ctx *ctx, grn_command_input *input, const char *name, int name_size)
GRN_PLUGIN_EXPORT grn_obj * grn_command_input_get_arguments(grn_ctx *ctx, grn_command_input *input)
GRN_PLUGIN_EXPORT grn_obj * grn_command_input_add(grn_ctx *ctx, grn_command_input *input, const char *name, int name_size, bool *added)
void grn_command_run_func(grn_ctx *ctx, grn_obj *command, grn_command_input *input, void *user_data)
Definition command.h:53
GRN_PLUGIN_EXPORT grn_rc grn_command_register(grn_ctx *ctx, const char *command_name, int command_name_size, grn_command_run_func *run, grn_expr_var *vars, unsigned int n_vars, void *user_data)
struct _grn_command_input grn_command_input
Definition command.h:27
GRN_PLUGIN_EXPORT grn_command_input * grn_command_input_open(grn_ctx *ctx, grn_obj *command)
GRN_PLUGIN_EXPORT grn_obj * grn_command_input_at(grn_ctx *ctx, grn_command_input *input, unsigned int offset)
GRN_PLUGIN_EXPORT grn_rc grn_command_input_close(grn_ctx *ctx, grn_command_input *input)
GRN_PLUGIN_EXPORT grn_rc grn_command_run(grn_ctx *ctx, grn_obj *command, grn_command_input *input)
grn_rc
Definition groonga.h:61
#define GRN_PLUGIN_EXPORT
Definition plugin.h:50
Definition groonga.h:351
Definition groonga.h:919
Definition groonga.h:1139