YAZ 5.35.1
icu_I18N.h
Go to the documentation of this file.
1/* This file is part of the YAZ toolkit.
2 * Copyright (C) Index Data.
3 * All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of Index Data nor the names of its contributors
13 * may be used to endorse or promote products derived from this
14 * software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
35#ifndef ICU_I18NL_H
36#define ICU_I18NL_H
37
38#include <yaz/yconfig.h>
39
40#include <unicode/utypes.h> /* Basic ICU data types */
41#include <unicode/uchar.h> /* char names */
42
43#include <unicode/ucol.h>
44#include <unicode/ubrk.h>
45
46#include <yaz/icu.h>
47
48/* declared structs and functions */
49
50int icu_check_status(UErrorCode status);
51
53{
54 UChar * utf16;
55 int32_t utf16_len;
56 int32_t utf16_cap;
57};
58
59struct icu_buf_utf16 * icu_buf_utf16_create(size_t capacity);
60
62
64 size_t capacity);
65
67 const struct icu_buf_utf16 * src16);
68
70 const struct icu_buf_utf16 * src16);
71
72void icu_buf_utf16_log(const char *lead, struct icu_buf_utf16 *src16);
73
75
76struct icu_buf_utf8;
77
79{
80 uint8_t * utf8;
81 int32_t utf8_len;
82 int32_t utf8_cap;
83};
84
85struct icu_buf_utf8 * icu_buf_utf8_create(size_t capacity);
86
88
90 size_t capacity);
91
93
94
95UErrorCode icu_utf16_from_utf8_cstr(struct icu_buf_utf16 * dest16,
96 const char * src8cstr,
97 UErrorCode * status);
98
99const char *icu_buf_utf8_to_cstr(struct icu_buf_utf8 *src8);
100
101
102UErrorCode icu_utf16_to_utf8(struct icu_buf_utf8 *dest8,
103 const struct icu_buf_utf16 *src16,
104 UErrorCode * status);
105
106struct icu_casemap;
107
108struct icu_casemap *icu_casemap_create(char action, UErrorCode *status);
109
110struct icu_casemap *icu_casemap_clone(struct icu_casemap *old);
111
112void icu_casemap_destroy(struct icu_casemap *casemap);
113
114int icu_casemap_casemap(struct icu_casemap *casemap,
115 struct icu_buf_utf16 *dest16,
116 struct icu_buf_utf16 *src16,
117 UErrorCode *status,
118 const char *locale);
119
121 struct icu_buf_utf16 *src16,
122 const char *locale, char action,
123 UErrorCode *status);
124
125void icu_sortkey8_from_utf16(UCollator *coll,
126 struct icu_buf_utf8 *dest8,
127 struct icu_buf_utf16 *src16,
128 UErrorCode *status);
129
130struct icu_tokenizer;
131struct icu_tokenizer * icu_tokenizer_create(const char *locale, char action,
132 UErrorCode *status);
133
134struct icu_tokenizer *icu_tokenizer_clone(struct icu_tokenizer *old);
135void icu_tokenizer_destroy(struct icu_tokenizer *tokenizer);
136
137int icu_tokenizer_attach(struct icu_tokenizer *tokenizer,
138 struct icu_buf_utf16 *src16, UErrorCode *status);
139
140int32_t icu_tokenizer_next_token(struct icu_tokenizer *tokenizer,
141 struct icu_buf_utf16 *tkn16,
142 UErrorCode *status,
143 size_t *start, size_t *len);
144
145int32_t icu_tokenizer_token_count(struct icu_tokenizer * tokenizer);
146
147struct icu_transform;
148
149struct icu_transform * icu_transform_create(const char *id, char action,
150 const char *rules,
151 UErrorCode *status);
152struct icu_transform *icu_transform_clone(struct icu_transform *old);
153void icu_transform_destroy(struct icu_transform * transform);
154
155int icu_transform_trans(struct icu_transform *transform,
156 struct icu_buf_utf16 *dest16,
157 const struct icu_buf_utf16 *src16,
158 UErrorCode *status);
159
160struct icu_chain_step;
161
163
165 int sort, UErrorCode *status);
166
167#endif /* ICU_I18NL_H */
168
169/*
170 * Local variables:
171 * c-basic-offset: 4
172 * c-file-style: "Stroustrup"
173 * indent-tabs-mode: nil
174 * End:
175 * vim: shiftwidth=4 tabstop=8 expandtab
176 */
177
ICU utilities.
struct icu_chain * yaz_icu_chain_t
opaque ICU chain
Definition icu.h:45
struct icu_buf_utf16 * icu_buf_utf16_resize(struct icu_buf_utf16 *buf16, size_t capacity)
void icu_buf_utf8_destroy(struct icu_buf_utf8 *buf8)
void icu_sortkey8_from_utf16(UCollator *coll, struct icu_buf_utf8 *dest8, struct icu_buf_utf16 *src16, UErrorCode *status)
UErrorCode icu_utf16_from_utf8_cstr(struct icu_buf_utf16 *dest16, const char *src8cstr, UErrorCode *status)
yaz_icu_chain_t icu_chain_create(const char *locale, int sort, UErrorCode *status)
struct icu_casemap * icu_casemap_create(char action, UErrorCode *status)
struct icu_tokenizer * icu_tokenizer_create(const char *locale, char action, UErrorCode *status)
struct icu_buf_utf16 * icu_buf_utf16_append(struct icu_buf_utf16 *dest16, const struct icu_buf_utf16 *src16)
int32_t icu_tokenizer_token_count(struct icu_tokenizer *tokenizer)
int icu_tokenizer_attach(struct icu_tokenizer *tokenizer, struct icu_buf_utf16 *src16, UErrorCode *status)
struct icu_buf_utf16 * icu_buf_utf16_clear(struct icu_buf_utf16 *buf16)
struct icu_buf_utf16 * icu_buf_utf16_create(size_t capacity)
struct icu_buf_utf8 * icu_buf_utf8_create(size_t capacity)
struct icu_buf_utf8 * icu_buf_utf8_resize(struct icu_buf_utf8 *buf8, size_t capacity)
int icu_transform_trans(struct icu_transform *transform, struct icu_buf_utf16 *dest16, const struct icu_buf_utf16 *src16, UErrorCode *status)
void icu_buf_utf16_destroy(struct icu_buf_utf16 *buf16)
const char * icu_buf_utf8_to_cstr(struct icu_buf_utf8 *src8)
int icu_utf16_casemap(struct icu_buf_utf16 *dest16, struct icu_buf_utf16 *src16, const char *locale, char action, UErrorCode *status)
int icu_chain_token_number(yaz_icu_chain_t chain)
void icu_tokenizer_destroy(struct icu_tokenizer *tokenizer)
void icu_buf_utf16_log(const char *lead, struct icu_buf_utf16 *src16)
struct icu_casemap * icu_casemap_clone(struct icu_casemap *old)
int icu_casemap_casemap(struct icu_casemap *casemap, struct icu_buf_utf16 *dest16, struct icu_buf_utf16 *src16, UErrorCode *status, const char *locale)
struct icu_buf_utf8 * icu_buf_utf8_clear(struct icu_buf_utf8 *buf8)
int icu_check_status(UErrorCode status)
void icu_transform_destroy(struct icu_transform *transform)
struct icu_transform * icu_transform_clone(struct icu_transform *old)
struct icu_transform * icu_transform_create(const char *id, char action, const char *rules, UErrorCode *status)
UErrorCode icu_utf16_to_utf8(struct icu_buf_utf8 *dest8, const struct icu_buf_utf16 *src16, UErrorCode *status)
struct icu_buf_utf16 * icu_buf_utf16_copy(struct icu_buf_utf16 *dest16, const struct icu_buf_utf16 *src16)
int32_t icu_tokenizer_next_token(struct icu_tokenizer *tokenizer, struct icu_buf_utf16 *tkn16, UErrorCode *status, size_t *start, size_t *len)
void icu_casemap_destroy(struct icu_casemap *casemap)
struct icu_tokenizer * icu_tokenizer_clone(struct icu_tokenizer *old)
UChar * utf16
Definition icu_I18N.h:54
int32_t utf16_cap
Definition icu_I18N.h:56
int32_t utf16_len
Definition icu_I18N.h:55
int32_t utf8_cap
Definition icu_I18N.h:82
uint8_t * utf8
Definition icu_I18N.h:80
int32_t utf8_len
Definition icu_I18N.h:81
Header with fundamental macros.