1/* -*- c-basic-offset: 2 -*- */
2/*
3 Copyright(C) 2015-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
23#include "ts_buf.h"
24#include "ts_types.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/* grn_ts_obj_increment_ref_count() increments an object reference count. */
31grn_rc grn_ts_obj_increment_ref_count(grn_ctx *ctx, grn_obj *obj);
32
33/* grn_ts_obj_is_table() returns whether or not an object is a table. */
34grn_ts_bool grn_ts_obj_is_table(grn_ctx *ctx, grn_obj *obj);
35
36/* grn_ts_obj_is_column() returns whether or not an object is a column. */
37grn_ts_bool grn_ts_obj_is_column(grn_ctx *ctx, grn_obj *obj);
38
39/*
40 * grn_ts_ja_get_value() gets a value from ja and writes it to buf. Note that
41 * the value is appended to the end of buf.
42 */
43grn_rc grn_ts_ja_get_value(grn_ctx *ctx, grn_obj *ja, grn_ts_id id,
44 grn_ts_buf *buf, size_t *value_size);
45
46/* grn_ts_table_has_key() returns whether or not a table has _key. */
47grn_ts_bool grn_ts_table_has_key(grn_ctx *ctx, grn_obj *table);
48
49/* grn_ts_table_has_value() returns whether or not a table has _value. */
50grn_ts_bool grn_ts_table_has_value(grn_ctx *ctx, grn_obj *table);
51
52/*
53 * grn_ts_table_get_value() gets a reference to a value (_value). On failure,
54 * this function returns NULL.
55 */
56const void *grn_ts_table_get_value(grn_ctx *ctx, grn_obj *table, grn_ts_id id);
57
58#ifdef __cplusplus
59}
60#endif
61
62