sl@0
|
1 |
/*
|
sl@0
|
2 |
*******************************************************************************
|
sl@0
|
3 |
*
|
sl@0
|
4 |
* Copyright (C) 2005, International Business Machines
|
sl@0
|
5 |
* Corporation and others. All Rights Reserved.
|
sl@0
|
6 |
*
|
sl@0
|
7 |
*******************************************************************************
|
sl@0
|
8 |
* file name: ucasemap.h
|
sl@0
|
9 |
* encoding: US-ASCII
|
sl@0
|
10 |
* tab size: 8 (not used)
|
sl@0
|
11 |
* indentation:4
|
sl@0
|
12 |
*
|
sl@0
|
13 |
* created on: 2005may06
|
sl@0
|
14 |
* created by: Markus W. Scherer
|
sl@0
|
15 |
*
|
sl@0
|
16 |
* Case mapping service object and functions using it.
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef __UCASEMAP_H__
|
sl@0
|
20 |
#define __UCASEMAP_H__
|
sl@0
|
21 |
|
sl@0
|
22 |
#include "unicode/utypes.h"
|
sl@0
|
23 |
#include "unicode/ustring.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
/**
|
sl@0
|
26 |
* \file
|
sl@0
|
27 |
* \brief C API: Unicode case mapping functions using a UCaseMap service object.
|
sl@0
|
28 |
*
|
sl@0
|
29 |
* The service object takes care of memory allocations, data loading, and setup
|
sl@0
|
30 |
* for the attributes, as usual.
|
sl@0
|
31 |
*
|
sl@0
|
32 |
* Currently, the functionality provided here does not overlap with uchar.h
|
sl@0
|
33 |
* and ustring.h.
|
sl@0
|
34 |
*
|
sl@0
|
35 |
* ucasemap_utf8ToLower() and ucasemap_utf8ToUpper() operate directly on
|
sl@0
|
36 |
* UTF-8 strings.
|
sl@0
|
37 |
*/
|
sl@0
|
38 |
|
sl@0
|
39 |
/**
|
sl@0
|
40 |
* UCaseMap is an opaque service object for newer ICU case mapping functions.
|
sl@0
|
41 |
* Older functions did not use a service object.
|
sl@0
|
42 |
* @draft ICU 3.4
|
sl@0
|
43 |
*/
|
sl@0
|
44 |
struct UCaseMap;
|
sl@0
|
45 |
typedef struct UCaseMap UCaseMap; /**< C typedef for struct UCaseMap. @draft ICU 3.4 */
|
sl@0
|
46 |
|
sl@0
|
47 |
/**
|
sl@0
|
48 |
* Open a UCaseMap service object for a locale and a set of options.
|
sl@0
|
49 |
* The locale ID and options are preprocessed so that functions using the
|
sl@0
|
50 |
* service object need not process them in each call.
|
sl@0
|
51 |
*
|
sl@0
|
52 |
* @param locale ICU locale ID, used for language-dependent
|
sl@0
|
53 |
* upper-/lower-/title-casing according to the Unicode standard.
|
sl@0
|
54 |
* Usual semantics: ""=root, NULL=default locale, etc.
|
sl@0
|
55 |
* @param options Options bit set, used for case folding and string comparisons.
|
sl@0
|
56 |
* Same flags as for u_foldCase(), u_strFoldCase(),
|
sl@0
|
57 |
* u_strCaseCompare(), etc.
|
sl@0
|
58 |
* Use 0 or U_FOLD_CASE_DEFAULT for default behavior.
|
sl@0
|
59 |
* @param pErrorCode Must be a valid pointer to an error code value,
|
sl@0
|
60 |
* which must not indicate a failure before the function call.
|
sl@0
|
61 |
* @return Pointer to a UCaseMap service object, if successful.
|
sl@0
|
62 |
*
|
sl@0
|
63 |
* @draft ICU 3.4
|
sl@0
|
64 |
*/
|
sl@0
|
65 |
U_DRAFT UCaseMap * U_EXPORT2
|
sl@0
|
66 |
ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode);
|
sl@0
|
67 |
|
sl@0
|
68 |
/**
|
sl@0
|
69 |
* Close a UCaseMap service object.
|
sl@0
|
70 |
* @param csm Object to be closed.
|
sl@0
|
71 |
* @draft ICU 3.4
|
sl@0
|
72 |
*/
|
sl@0
|
73 |
U_DRAFT void U_EXPORT2
|
sl@0
|
74 |
ucasemap_close(UCaseMap *csm);
|
sl@0
|
75 |
|
sl@0
|
76 |
/**
|
sl@0
|
77 |
* Get the locale ID that is used for language-dependent case mappings.
|
sl@0
|
78 |
* @param csm UCaseMap service object.
|
sl@0
|
79 |
* @return locale ID
|
sl@0
|
80 |
* @draft ICU 3.4
|
sl@0
|
81 |
*/
|
sl@0
|
82 |
U_DRAFT const char * U_EXPORT2
|
sl@0
|
83 |
ucasemap_getLocale(const UCaseMap *csm);
|
sl@0
|
84 |
|
sl@0
|
85 |
/**
|
sl@0
|
86 |
* Get the options bit set that is used for case folding and string comparisons.
|
sl@0
|
87 |
* @param csm UCaseMap service object.
|
sl@0
|
88 |
* @return options bit set
|
sl@0
|
89 |
* @draft ICU 3.4
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
U_DRAFT uint32_t U_EXPORT2
|
sl@0
|
92 |
ucasemap_getOptions(const UCaseMap *csm);
|
sl@0
|
93 |
|
sl@0
|
94 |
/**
|
sl@0
|
95 |
* Set the locale ID that is used for language-dependent case mappings.
|
sl@0
|
96 |
*
|
sl@0
|
97 |
* @param csm UCaseMap service object.
|
sl@0
|
98 |
* @param locale Locale ID, see ucasemap_open().
|
sl@0
|
99 |
* @param pErrorCode Must be a valid pointer to an error code value,
|
sl@0
|
100 |
* which must not indicate a failure before the function call.
|
sl@0
|
101 |
*
|
sl@0
|
102 |
* @see ucasemap_open
|
sl@0
|
103 |
* @draft ICU 3.4
|
sl@0
|
104 |
*/
|
sl@0
|
105 |
U_DRAFT void U_EXPORT2
|
sl@0
|
106 |
ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode);
|
sl@0
|
107 |
|
sl@0
|
108 |
/**
|
sl@0
|
109 |
* Set the options bit set that is used for case folding and string comparisons.
|
sl@0
|
110 |
*
|
sl@0
|
111 |
* @param csm UCaseMap service object.
|
sl@0
|
112 |
* @param options Options bit set, see ucasemap_open().
|
sl@0
|
113 |
* @param pErrorCode Must be a valid pointer to an error code value,
|
sl@0
|
114 |
* which must not indicate a failure before the function call.
|
sl@0
|
115 |
*
|
sl@0
|
116 |
* @see ucasemap_open
|
sl@0
|
117 |
* @draft ICU 3.4
|
sl@0
|
118 |
*/
|
sl@0
|
119 |
U_DRAFT void U_EXPORT2
|
sl@0
|
120 |
ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode);
|
sl@0
|
121 |
|
sl@0
|
122 |
/**
|
sl@0
|
123 |
* Lowercase the characters in a UTF-8 string.
|
sl@0
|
124 |
* Casing is locale-dependent and context-sensitive.
|
sl@0
|
125 |
* The result may be longer or shorter than the original.
|
sl@0
|
126 |
* The source string and the destination buffer must not overlap.
|
sl@0
|
127 |
*
|
sl@0
|
128 |
* @param csm UCaseMap service object.
|
sl@0
|
129 |
* @param dest A buffer for the result string. The result will be NUL-terminated if
|
sl@0
|
130 |
* the buffer is large enough.
|
sl@0
|
131 |
* The contents is undefined in case of failure.
|
sl@0
|
132 |
* @param destCapacity The size of the buffer (number of bytes). If it is 0, then
|
sl@0
|
133 |
* dest may be NULL and the function will only return the length of the result
|
sl@0
|
134 |
* without writing any of the result string.
|
sl@0
|
135 |
* @param src The original string
|
sl@0
|
136 |
* @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
|
sl@0
|
137 |
* @param pErrorCode Must be a valid pointer to an error code value,
|
sl@0
|
138 |
* which must not indicate a failure before the function call.
|
sl@0
|
139 |
* @return The length of the result string, if successful - or in case of a buffer overflow,
|
sl@0
|
140 |
* in which case it will be greater than destCapacity.
|
sl@0
|
141 |
*
|
sl@0
|
142 |
* @see u_strToLower
|
sl@0
|
143 |
* @draft ICU 3.4
|
sl@0
|
144 |
*/
|
sl@0
|
145 |
U_DRAFT int32_t U_EXPORT2
|
sl@0
|
146 |
ucasemap_utf8ToLower(const UCaseMap *csm,
|
sl@0
|
147 |
char *dest, int32_t destCapacity,
|
sl@0
|
148 |
const char *src, int32_t srcLength,
|
sl@0
|
149 |
UErrorCode *pErrorCode);
|
sl@0
|
150 |
|
sl@0
|
151 |
/**
|
sl@0
|
152 |
* Uppercase the characters in a UTF-8 string.
|
sl@0
|
153 |
* Casing is locale-dependent and context-sensitive.
|
sl@0
|
154 |
* The result may be longer or shorter than the original.
|
sl@0
|
155 |
* The source string and the destination buffer must not overlap.
|
sl@0
|
156 |
*
|
sl@0
|
157 |
* @param csm UCaseMap service object.
|
sl@0
|
158 |
* @param dest A buffer for the result string. The result will be NUL-terminated if
|
sl@0
|
159 |
* the buffer is large enough.
|
sl@0
|
160 |
* The contents is undefined in case of failure.
|
sl@0
|
161 |
* @param destCapacity The size of the buffer (number of bytes). If it is 0, then
|
sl@0
|
162 |
* dest may be NULL and the function will only return the length of the result
|
sl@0
|
163 |
* without writing any of the result string.
|
sl@0
|
164 |
* @param src The original string
|
sl@0
|
165 |
* @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
|
sl@0
|
166 |
* @param pErrorCode Must be a valid pointer to an error code value,
|
sl@0
|
167 |
* which must not indicate a failure before the function call.
|
sl@0
|
168 |
* @return The length of the result string, if successful - or in case of a buffer overflow,
|
sl@0
|
169 |
* in which case it will be greater than destCapacity.
|
sl@0
|
170 |
*
|
sl@0
|
171 |
* @see u_strToUpper
|
sl@0
|
172 |
* @draft ICU 3.4
|
sl@0
|
173 |
*/
|
sl@0
|
174 |
U_DRAFT int32_t U_EXPORT2
|
sl@0
|
175 |
ucasemap_utf8ToUpper(const UCaseMap *csm,
|
sl@0
|
176 |
char *dest, int32_t destCapacity,
|
sl@0
|
177 |
const char *src, int32_t srcLength,
|
sl@0
|
178 |
UErrorCode *pErrorCode);
|
sl@0
|
179 |
|
sl@0
|
180 |
#endif
|