Groonga
Loading...
Searching...
No Matches
string.h
Go to the documentation of this file.
1/*
2 Copyright(C) 2009-2018 Brazil
3 Copyright(C) 2021 Sutou Kouhei <kou@clear-code.com>
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 as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20#pragma once
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26/* grn_str: deprecated. use grn_string instead. */
27
28typedef struct {
29 const char *orig;
30 char *norm;
31 int16_t *checks;
32 uint8_t *ctypes;
33 int flags;
34 unsigned int orig_blen;
35 unsigned int norm_blen;
36 unsigned int length;
38} grn_str;
39
40#define GRN_STR_REMOVEBLANK (0x01<<0)
41#define GRN_STR_WITH_CTYPES (0x01<<1)
42#define GRN_STR_WITH_CHECKS (0x01<<2)
43#define GRN_STR_NORMALIZE GRN_OBJ_KEY_NORMALIZE
44
45GRN_API grn_str *grn_str_open(grn_ctx *ctx, const char *str, unsigned int str_len,
46 int flags);
48
49
50/* grn_string */
51
52#define GRN_STRING_REMOVE_BLANK (0x01<<0)
53#define GRN_STRING_WITH_TYPES (0x01<<1)
54#define GRN_STRING_WITH_CHECKS (0x01<<2)
55#define GRN_STRING_REMOVE_TOKENIZED_DELIMITER (0x01<<3)
56
57#define GRN_NORMALIZER_AUTO ((grn_obj *)1)
58
59#define GRN_CHAR_BLANK 0x80
60#define GRN_CHAR_IS_BLANK(c) ((c) & (GRN_CHAR_BLANK))
61#define GRN_CHAR_TYPE(c) ((c) & 0x7f)
62
74
76
78 const char *string,
79 unsigned int length_in_bytes,
80 grn_obj *lexicon_or_normalizer,
81 int flags);
83 const char **original,
84 unsigned int *length_in_bytes);
87 const char **normalized,
88 unsigned int *length_in_bytes,
89 unsigned int *n_characters);
91 char *normalized,
92 unsigned int length_in_bytes,
93 unsigned int n_characters);
94GRN_API const int16_t *grn_string_get_checks(grn_ctx *ctx, grn_obj *string);
96 grn_obj *string,
97 int16_t *checks);
98GRN_API const uint8_t *grn_string_get_types(grn_ctx *ctx, grn_obj *string);
100 grn_obj *string,
101 uint8_t *types);
102GRN_API const uint64_t *grn_string_get_offsets(grn_ctx *ctx, grn_obj *string);
104 grn_obj *string,
105 uint64_t *offsets);
109
110
111GRN_API int grn_charlen(grn_ctx *ctx, const char *str, const char *end);
112
113#ifdef __cplusplus
114}
115#endif
grn_rc
Definition groonga.h:61
#define GRN_API
Definition groonga.h:39
grn_encoding
Definition groonga.h:163
GRN_API grn_obj * grn_string_open(grn_ctx *ctx, const char *string, unsigned int length_in_bytes, grn_obj *lexicon_or_normalizer, int flags)
GRN_API grn_rc grn_string_set_types(grn_ctx *ctx, grn_obj *string, uint8_t *types)
GRN_API grn_encoding grn_string_get_encoding(grn_ctx *ctx, grn_obj *string)
GRN_API const char * grn_char_type_to_string(grn_char_type type)
GRN_API int grn_string_get_flags(grn_ctx *ctx, grn_obj *string)
GRN_API grn_rc grn_string_get_normalized(grn_ctx *ctx, grn_obj *string, const char **normalized, unsigned int *length_in_bytes, unsigned int *n_characters)
GRN_API grn_rc grn_string_get_original(grn_ctx *ctx, grn_obj *string, const char **original, unsigned int *length_in_bytes)
GRN_API uint32_t grn_string_get_normalizer_index(grn_ctx *ctx, grn_obj *string)
GRN_API int grn_charlen(grn_ctx *ctx, const char *str, const char *end)
GRN_API grn_rc grn_str_close(grn_ctx *ctx, grn_str *nstr)
GRN_API grn_str * grn_str_open(grn_ctx *ctx, const char *str, unsigned int str_len, int flags)
GRN_API const uint8_t * grn_string_get_types(grn_ctx *ctx, grn_obj *string)
GRN_API grn_obj * grn_string_get_table(grn_ctx *ctx, grn_obj *string)
grn_char_type
Definition string.h:63
@ GRN_CHAR_HIRAGANA
Definition string.h:68
@ GRN_CHAR_NULL
Definition string.h:64
@ GRN_CHAR_ALPHA
Definition string.h:65
@ GRN_CHAR_DIGIT
Definition string.h:66
@ GRN_CHAR_SYMBOL
Definition string.h:67
@ GRN_CHAR_KATAKANA
Definition string.h:69
@ GRN_CHAR_EMOJI
Definition string.h:72
@ GRN_CHAR_OTHERS
Definition string.h:71
@ GRN_CHAR_KANJI
Definition string.h:70
GRN_API grn_rc grn_string_set_checks(grn_ctx *ctx, grn_obj *string, int16_t *checks)
GRN_API grn_rc grn_string_set_normalized(grn_ctx *ctx, grn_obj *string, char *normalized, unsigned int length_in_bytes, unsigned int n_characters)
GRN_API grn_rc grn_string_set_offsets(grn_ctx *ctx, grn_obj *string, uint64_t *offsets)
GRN_API const int16_t * grn_string_get_checks(grn_ctx *ctx, grn_obj *string)
GRN_API const uint64_t * grn_string_get_offsets(grn_ctx *ctx, grn_obj *string)
Definition groonga.h:351
Definition groonga.h:919
Definition string.h:28
grn_encoding encoding
Definition string.h:37
int flags
Definition string.h:33
unsigned int orig_blen
Definition string.h:34
uint8_t * ctypes
Definition string.h:32
unsigned int norm_blen
Definition string.h:35
int16_t * checks
Definition string.h:31
char * norm
Definition string.h:30
unsigned int length
Definition string.h:36
const char * orig
Definition string.h:29