annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/casemap.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 // © 2017 and later: Unicode, Inc. and others.
jpayne@69 2 // License & terms of use: http://www.unicode.org/copyright.html
jpayne@69 3
jpayne@69 4 // casemap.h
jpayne@69 5 // created: 2017jan12 Markus W. Scherer
jpayne@69 6
jpayne@69 7 #ifndef __CASEMAP_H__
jpayne@69 8 #define __CASEMAP_H__
jpayne@69 9
jpayne@69 10 #include "unicode/utypes.h"
jpayne@69 11
jpayne@69 12 #if U_SHOW_CPLUSPLUS_API
jpayne@69 13
jpayne@69 14 #include "unicode/stringpiece.h"
jpayne@69 15 #include "unicode/uobject.h"
jpayne@69 16
jpayne@69 17 /**
jpayne@69 18 * \file
jpayne@69 19 * \brief C++ API: Low-level C++ case mapping functions.
jpayne@69 20 */
jpayne@69 21
jpayne@69 22 U_NAMESPACE_BEGIN
jpayne@69 23
jpayne@69 24 class BreakIterator;
jpayne@69 25 class ByteSink;
jpayne@69 26 class Edits;
jpayne@69 27
jpayne@69 28 /**
jpayne@69 29 * Low-level C++ case mapping functions.
jpayne@69 30 *
jpayne@69 31 * @stable ICU 59
jpayne@69 32 */
jpayne@69 33 class U_COMMON_API CaseMap U_FINAL : public UMemory {
jpayne@69 34 public:
jpayne@69 35 /**
jpayne@69 36 * Lowercases a UTF-16 string and optionally records edits.
jpayne@69 37 * Casing is locale-dependent and context-sensitive.
jpayne@69 38 * The result may be longer or shorter than the original.
jpayne@69 39 * The source string and the destination buffer must not overlap.
jpayne@69 40 *
jpayne@69 41 * @param locale The locale ID. ("" = root locale, NULL = default locale.)
jpayne@69 42 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
jpayne@69 43 * @param src The original string.
jpayne@69 44 * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
jpayne@69 45 * @param dest A buffer for the result string. The result will be NUL-terminated if
jpayne@69 46 * the buffer is large enough.
jpayne@69 47 * The contents is undefined in case of failure.
jpayne@69 48 * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
jpayne@69 49 * dest may be NULL and the function will only return the length of the result
jpayne@69 50 * without writing any of the result string.
jpayne@69 51 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 52 * and getting only changes (if any).
jpayne@69 53 * The Edits contents is undefined if any error occurs.
jpayne@69 54 * This function calls edits->reset() first unless
jpayne@69 55 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 56 * @param errorCode Reference to an in/out error code value
jpayne@69 57 * which must not indicate a failure before the function call.
jpayne@69 58 * @return The length of the result string, if successful.
jpayne@69 59 * When the result would be longer than destCapacity,
jpayne@69 60 * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
jpayne@69 61 *
jpayne@69 62 * @see u_strToLower
jpayne@69 63 * @stable ICU 59
jpayne@69 64 */
jpayne@69 65 static int32_t toLower(
jpayne@69 66 const char *locale, uint32_t options,
jpayne@69 67 const char16_t *src, int32_t srcLength,
jpayne@69 68 char16_t *dest, int32_t destCapacity, Edits *edits,
jpayne@69 69 UErrorCode &errorCode);
jpayne@69 70
jpayne@69 71 /**
jpayne@69 72 * Uppercases a UTF-16 string and optionally records edits.
jpayne@69 73 * Casing is locale-dependent and context-sensitive.
jpayne@69 74 * The result may be longer or shorter than the original.
jpayne@69 75 * The source string and the destination buffer must not overlap.
jpayne@69 76 *
jpayne@69 77 * @param locale The locale ID. ("" = root locale, NULL = default locale.)
jpayne@69 78 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
jpayne@69 79 * @param src The original string.
jpayne@69 80 * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
jpayne@69 81 * @param dest A buffer for the result string. The result will be NUL-terminated if
jpayne@69 82 * the buffer is large enough.
jpayne@69 83 * The contents is undefined in case of failure.
jpayne@69 84 * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
jpayne@69 85 * dest may be NULL and the function will only return the length of the result
jpayne@69 86 * without writing any of the result string.
jpayne@69 87 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 88 * and getting only changes (if any).
jpayne@69 89 * The Edits contents is undefined if any error occurs.
jpayne@69 90 * This function calls edits->reset() first unless
jpayne@69 91 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 92 * @param errorCode Reference to an in/out error code value
jpayne@69 93 * which must not indicate a failure before the function call.
jpayne@69 94 * @return The length of the result string, if successful.
jpayne@69 95 * When the result would be longer than destCapacity,
jpayne@69 96 * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
jpayne@69 97 *
jpayne@69 98 * @see u_strToUpper
jpayne@69 99 * @stable ICU 59
jpayne@69 100 */
jpayne@69 101 static int32_t toUpper(
jpayne@69 102 const char *locale, uint32_t options,
jpayne@69 103 const char16_t *src, int32_t srcLength,
jpayne@69 104 char16_t *dest, int32_t destCapacity, Edits *edits,
jpayne@69 105 UErrorCode &errorCode);
jpayne@69 106
jpayne@69 107 #if !UCONFIG_NO_BREAK_ITERATION
jpayne@69 108
jpayne@69 109 /**
jpayne@69 110 * Titlecases a UTF-16 string and optionally records edits.
jpayne@69 111 * Casing is locale-dependent and context-sensitive.
jpayne@69 112 * The result may be longer or shorter than the original.
jpayne@69 113 * The source string and the destination buffer must not overlap.
jpayne@69 114 *
jpayne@69 115 * Titlecasing uses a break iterator to find the first characters of words
jpayne@69 116 * that are to be titlecased. It titlecases those characters and lowercases
jpayne@69 117 * all others. (This can be modified with options bits.)
jpayne@69 118 *
jpayne@69 119 * @param locale The locale ID. ("" = root locale, NULL = default locale.)
jpayne@69 120 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
jpayne@69 121 * U_TITLECASE_NO_LOWERCASE,
jpayne@69 122 * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
jpayne@69 123 * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
jpayne@69 124 * @param iter A break iterator to find the first characters of words that are to be titlecased.
jpayne@69 125 * It is set to the source string (setText())
jpayne@69 126 * and used one or more times for iteration (first() and next()).
jpayne@69 127 * If NULL, then a word break iterator for the locale is used
jpayne@69 128 * (or something equivalent).
jpayne@69 129 * @param src The original string.
jpayne@69 130 * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
jpayne@69 131 * @param dest A buffer for the result string. The result will be NUL-terminated if
jpayne@69 132 * the buffer is large enough.
jpayne@69 133 * The contents is undefined in case of failure.
jpayne@69 134 * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
jpayne@69 135 * dest may be NULL and the function will only return the length of the result
jpayne@69 136 * without writing any of the result string.
jpayne@69 137 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 138 * and getting only changes (if any).
jpayne@69 139 * The Edits contents is undefined if any error occurs.
jpayne@69 140 * This function calls edits->reset() first unless
jpayne@69 141 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 142 * @param errorCode Reference to an in/out error code value
jpayne@69 143 * which must not indicate a failure before the function call.
jpayne@69 144 * @return The length of the result string, if successful.
jpayne@69 145 * When the result would be longer than destCapacity,
jpayne@69 146 * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
jpayne@69 147 *
jpayne@69 148 * @see u_strToTitle
jpayne@69 149 * @see ucasemap_toTitle
jpayne@69 150 * @stable ICU 59
jpayne@69 151 */
jpayne@69 152 static int32_t toTitle(
jpayne@69 153 const char *locale, uint32_t options, BreakIterator *iter,
jpayne@69 154 const char16_t *src, int32_t srcLength,
jpayne@69 155 char16_t *dest, int32_t destCapacity, Edits *edits,
jpayne@69 156 UErrorCode &errorCode);
jpayne@69 157
jpayne@69 158 #endif // UCONFIG_NO_BREAK_ITERATION
jpayne@69 159
jpayne@69 160 /**
jpayne@69 161 * Case-folds a UTF-16 string and optionally records edits.
jpayne@69 162 *
jpayne@69 163 * Case folding is locale-independent and not context-sensitive,
jpayne@69 164 * but there is an option for whether to include or exclude mappings for dotted I
jpayne@69 165 * and dotless i that are marked with 'T' in CaseFolding.txt.
jpayne@69 166 *
jpayne@69 167 * The result may be longer or shorter than the original.
jpayne@69 168 * The source string and the destination buffer must not overlap.
jpayne@69 169 *
jpayne@69 170 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
jpayne@69 171 * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I.
jpayne@69 172 * @param src The original string.
jpayne@69 173 * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
jpayne@69 174 * @param dest A buffer for the result string. The result will be NUL-terminated if
jpayne@69 175 * the buffer is large enough.
jpayne@69 176 * The contents is undefined in case of failure.
jpayne@69 177 * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
jpayne@69 178 * dest may be NULL and the function will only return the length of the result
jpayne@69 179 * without writing any of the result string.
jpayne@69 180 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 181 * and getting only changes (if any).
jpayne@69 182 * The Edits contents is undefined if any error occurs.
jpayne@69 183 * This function calls edits->reset() first unless
jpayne@69 184 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 185 * @param errorCode Reference to an in/out error code value
jpayne@69 186 * which must not indicate a failure before the function call.
jpayne@69 187 * @return The length of the result string, if successful.
jpayne@69 188 * When the result would be longer than destCapacity,
jpayne@69 189 * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
jpayne@69 190 *
jpayne@69 191 * @see u_strFoldCase
jpayne@69 192 * @stable ICU 59
jpayne@69 193 */
jpayne@69 194 static int32_t fold(
jpayne@69 195 uint32_t options,
jpayne@69 196 const char16_t *src, int32_t srcLength,
jpayne@69 197 char16_t *dest, int32_t destCapacity, Edits *edits,
jpayne@69 198 UErrorCode &errorCode);
jpayne@69 199
jpayne@69 200 /**
jpayne@69 201 * Lowercases a UTF-8 string and optionally records edits.
jpayne@69 202 * Casing is locale-dependent and context-sensitive.
jpayne@69 203 * The result may be longer or shorter than the original.
jpayne@69 204 *
jpayne@69 205 * @param locale The locale ID. ("" = root locale, NULL = default locale.)
jpayne@69 206 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
jpayne@69 207 * @param src The original string.
jpayne@69 208 * @param sink A ByteSink to which the result string is written.
jpayne@69 209 * sink.Flush() is called at the end.
jpayne@69 210 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 211 * and getting only changes (if any).
jpayne@69 212 * The Edits contents is undefined if any error occurs.
jpayne@69 213 * This function calls edits->reset() first unless
jpayne@69 214 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 215 * @param errorCode Reference to an in/out error code value
jpayne@69 216 * which must not indicate a failure before the function call.
jpayne@69 217 *
jpayne@69 218 * @see ucasemap_utf8ToLower
jpayne@69 219 * @stable ICU 60
jpayne@69 220 */
jpayne@69 221 static void utf8ToLower(
jpayne@69 222 const char *locale, uint32_t options,
jpayne@69 223 StringPiece src, ByteSink &sink, Edits *edits,
jpayne@69 224 UErrorCode &errorCode);
jpayne@69 225
jpayne@69 226 /**
jpayne@69 227 * Uppercases a UTF-8 string and optionally records edits.
jpayne@69 228 * Casing is locale-dependent and context-sensitive.
jpayne@69 229 * The result may be longer or shorter than the original.
jpayne@69 230 *
jpayne@69 231 * @param locale The locale ID. ("" = root locale, NULL = default locale.)
jpayne@69 232 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
jpayne@69 233 * @param src The original string.
jpayne@69 234 * @param sink A ByteSink to which the result string is written.
jpayne@69 235 * sink.Flush() is called at the end.
jpayne@69 236 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 237 * and getting only changes (if any).
jpayne@69 238 * The Edits contents is undefined if any error occurs.
jpayne@69 239 * This function calls edits->reset() first unless
jpayne@69 240 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 241 * @param errorCode Reference to an in/out error code value
jpayne@69 242 * which must not indicate a failure before the function call.
jpayne@69 243 *
jpayne@69 244 * @see ucasemap_utf8ToUpper
jpayne@69 245 * @stable ICU 60
jpayne@69 246 */
jpayne@69 247 static void utf8ToUpper(
jpayne@69 248 const char *locale, uint32_t options,
jpayne@69 249 StringPiece src, ByteSink &sink, Edits *edits,
jpayne@69 250 UErrorCode &errorCode);
jpayne@69 251
jpayne@69 252 #if !UCONFIG_NO_BREAK_ITERATION
jpayne@69 253
jpayne@69 254 /**
jpayne@69 255 * Titlecases a UTF-8 string and optionally records edits.
jpayne@69 256 * Casing is locale-dependent and context-sensitive.
jpayne@69 257 * The result may be longer or shorter than the original.
jpayne@69 258 *
jpayne@69 259 * Titlecasing uses a break iterator to find the first characters of words
jpayne@69 260 * that are to be titlecased. It titlecases those characters and lowercases
jpayne@69 261 * all others. (This can be modified with options bits.)
jpayne@69 262 *
jpayne@69 263 * @param locale The locale ID. ("" = root locale, NULL = default locale.)
jpayne@69 264 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
jpayne@69 265 * U_TITLECASE_NO_LOWERCASE,
jpayne@69 266 * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
jpayne@69 267 * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
jpayne@69 268 * @param iter A break iterator to find the first characters of words that are to be titlecased.
jpayne@69 269 * It is set to the source string (setUText())
jpayne@69 270 * and used one or more times for iteration (first() and next()).
jpayne@69 271 * If NULL, then a word break iterator for the locale is used
jpayne@69 272 * (or something equivalent).
jpayne@69 273 * @param src The original string.
jpayne@69 274 * @param sink A ByteSink to which the result string is written.
jpayne@69 275 * sink.Flush() is called at the end.
jpayne@69 276 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 277 * and getting only changes (if any).
jpayne@69 278 * The Edits contents is undefined if any error occurs.
jpayne@69 279 * This function calls edits->reset() first unless
jpayne@69 280 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 281 * @param errorCode Reference to an in/out error code value
jpayne@69 282 * which must not indicate a failure before the function call.
jpayne@69 283 *
jpayne@69 284 * @see ucasemap_utf8ToTitle
jpayne@69 285 * @stable ICU 60
jpayne@69 286 */
jpayne@69 287 static void utf8ToTitle(
jpayne@69 288 const char *locale, uint32_t options, BreakIterator *iter,
jpayne@69 289 StringPiece src, ByteSink &sink, Edits *edits,
jpayne@69 290 UErrorCode &errorCode);
jpayne@69 291
jpayne@69 292 #endif // UCONFIG_NO_BREAK_ITERATION
jpayne@69 293
jpayne@69 294 /**
jpayne@69 295 * Case-folds a UTF-8 string and optionally records edits.
jpayne@69 296 *
jpayne@69 297 * Case folding is locale-independent and not context-sensitive,
jpayne@69 298 * but there is an option for whether to include or exclude mappings for dotted I
jpayne@69 299 * and dotless i that are marked with 'T' in CaseFolding.txt.
jpayne@69 300 *
jpayne@69 301 * The result may be longer or shorter than the original.
jpayne@69 302 *
jpayne@69 303 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
jpayne@69 304 * @param src The original string.
jpayne@69 305 * @param sink A ByteSink to which the result string is written.
jpayne@69 306 * sink.Flush() is called at the end.
jpayne@69 307 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 308 * and getting only changes (if any).
jpayne@69 309 * The Edits contents is undefined if any error occurs.
jpayne@69 310 * This function calls edits->reset() first unless
jpayne@69 311 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 312 * @param errorCode Reference to an in/out error code value
jpayne@69 313 * which must not indicate a failure before the function call.
jpayne@69 314 *
jpayne@69 315 * @see ucasemap_utf8FoldCase
jpayne@69 316 * @stable ICU 60
jpayne@69 317 */
jpayne@69 318 static void utf8Fold(
jpayne@69 319 uint32_t options,
jpayne@69 320 StringPiece src, ByteSink &sink, Edits *edits,
jpayne@69 321 UErrorCode &errorCode);
jpayne@69 322
jpayne@69 323 /**
jpayne@69 324 * Lowercases a UTF-8 string and optionally records edits.
jpayne@69 325 * Casing is locale-dependent and context-sensitive.
jpayne@69 326 * The result may be longer or shorter than the original.
jpayne@69 327 * The source string and the destination buffer must not overlap.
jpayne@69 328 *
jpayne@69 329 * @param locale The locale ID. ("" = root locale, NULL = default locale.)
jpayne@69 330 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
jpayne@69 331 * @param src The original string.
jpayne@69 332 * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
jpayne@69 333 * @param dest A buffer for the result string. The result will be NUL-terminated if
jpayne@69 334 * the buffer is large enough.
jpayne@69 335 * The contents is undefined in case of failure.
jpayne@69 336 * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
jpayne@69 337 * dest may be NULL and the function will only return the length of the result
jpayne@69 338 * without writing any of the result string.
jpayne@69 339 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 340 * and getting only changes (if any).
jpayne@69 341 * The Edits contents is undefined if any error occurs.
jpayne@69 342 * This function calls edits->reset() first unless
jpayne@69 343 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 344 * @param errorCode Reference to an in/out error code value
jpayne@69 345 * which must not indicate a failure before the function call.
jpayne@69 346 * @return The length of the result string, if successful.
jpayne@69 347 * When the result would be longer than destCapacity,
jpayne@69 348 * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
jpayne@69 349 *
jpayne@69 350 * @see ucasemap_utf8ToLower
jpayne@69 351 * @stable ICU 59
jpayne@69 352 */
jpayne@69 353 static int32_t utf8ToLower(
jpayne@69 354 const char *locale, uint32_t options,
jpayne@69 355 const char *src, int32_t srcLength,
jpayne@69 356 char *dest, int32_t destCapacity, Edits *edits,
jpayne@69 357 UErrorCode &errorCode);
jpayne@69 358
jpayne@69 359 /**
jpayne@69 360 * Uppercases a UTF-8 string and optionally records edits.
jpayne@69 361 * Casing is locale-dependent and context-sensitive.
jpayne@69 362 * The result may be longer or shorter than the original.
jpayne@69 363 * The source string and the destination buffer must not overlap.
jpayne@69 364 *
jpayne@69 365 * @param locale The locale ID. ("" = root locale, NULL = default locale.)
jpayne@69 366 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
jpayne@69 367 * @param src The original string.
jpayne@69 368 * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
jpayne@69 369 * @param dest A buffer for the result string. The result will be NUL-terminated if
jpayne@69 370 * the buffer is large enough.
jpayne@69 371 * The contents is undefined in case of failure.
jpayne@69 372 * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
jpayne@69 373 * dest may be NULL and the function will only return the length of the result
jpayne@69 374 * without writing any of the result string.
jpayne@69 375 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 376 * and getting only changes (if any).
jpayne@69 377 * The Edits contents is undefined if any error occurs.
jpayne@69 378 * This function calls edits->reset() first unless
jpayne@69 379 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 380 * @param errorCode Reference to an in/out error code value
jpayne@69 381 * which must not indicate a failure before the function call.
jpayne@69 382 * @return The length of the result string, if successful.
jpayne@69 383 * When the result would be longer than destCapacity,
jpayne@69 384 * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
jpayne@69 385 *
jpayne@69 386 * @see ucasemap_utf8ToUpper
jpayne@69 387 * @stable ICU 59
jpayne@69 388 */
jpayne@69 389 static int32_t utf8ToUpper(
jpayne@69 390 const char *locale, uint32_t options,
jpayne@69 391 const char *src, int32_t srcLength,
jpayne@69 392 char *dest, int32_t destCapacity, Edits *edits,
jpayne@69 393 UErrorCode &errorCode);
jpayne@69 394
jpayne@69 395 #if !UCONFIG_NO_BREAK_ITERATION
jpayne@69 396
jpayne@69 397 /**
jpayne@69 398 * Titlecases a UTF-8 string and optionally records edits.
jpayne@69 399 * Casing is locale-dependent and context-sensitive.
jpayne@69 400 * The result may be longer or shorter than the original.
jpayne@69 401 * The source string and the destination buffer must not overlap.
jpayne@69 402 *
jpayne@69 403 * Titlecasing uses a break iterator to find the first characters of words
jpayne@69 404 * that are to be titlecased. It titlecases those characters and lowercases
jpayne@69 405 * all others. (This can be modified with options bits.)
jpayne@69 406 *
jpayne@69 407 * @param locale The locale ID. ("" = root locale, NULL = default locale.)
jpayne@69 408 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
jpayne@69 409 * U_TITLECASE_NO_LOWERCASE,
jpayne@69 410 * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
jpayne@69 411 * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES.
jpayne@69 412 * @param iter A break iterator to find the first characters of words that are to be titlecased.
jpayne@69 413 * It is set to the source string (setUText())
jpayne@69 414 * and used one or more times for iteration (first() and next()).
jpayne@69 415 * If NULL, then a word break iterator for the locale is used
jpayne@69 416 * (or something equivalent).
jpayne@69 417 * @param src The original string.
jpayne@69 418 * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
jpayne@69 419 * @param dest A buffer for the result string. The result will be NUL-terminated if
jpayne@69 420 * the buffer is large enough.
jpayne@69 421 * The contents is undefined in case of failure.
jpayne@69 422 * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
jpayne@69 423 * dest may be NULL and the function will only return the length of the result
jpayne@69 424 * without writing any of the result string.
jpayne@69 425 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 426 * and getting only changes (if any).
jpayne@69 427 * The Edits contents is undefined if any error occurs.
jpayne@69 428 * This function calls edits->reset() first unless
jpayne@69 429 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 430 * @param errorCode Reference to an in/out error code value
jpayne@69 431 * which must not indicate a failure before the function call.
jpayne@69 432 * @return The length of the result string, if successful.
jpayne@69 433 * When the result would be longer than destCapacity,
jpayne@69 434 * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
jpayne@69 435 *
jpayne@69 436 * @see ucasemap_utf8ToTitle
jpayne@69 437 * @stable ICU 59
jpayne@69 438 */
jpayne@69 439 static int32_t utf8ToTitle(
jpayne@69 440 const char *locale, uint32_t options, BreakIterator *iter,
jpayne@69 441 const char *src, int32_t srcLength,
jpayne@69 442 char *dest, int32_t destCapacity, Edits *edits,
jpayne@69 443 UErrorCode &errorCode);
jpayne@69 444
jpayne@69 445 #endif // UCONFIG_NO_BREAK_ITERATION
jpayne@69 446
jpayne@69 447 /**
jpayne@69 448 * Case-folds a UTF-8 string and optionally records edits.
jpayne@69 449 *
jpayne@69 450 * Case folding is locale-independent and not context-sensitive,
jpayne@69 451 * but there is an option for whether to include or exclude mappings for dotted I
jpayne@69 452 * and dotless i that are marked with 'T' in CaseFolding.txt.
jpayne@69 453 *
jpayne@69 454 * The result may be longer or shorter than the original.
jpayne@69 455 * The source string and the destination buffer must not overlap.
jpayne@69 456 *
jpayne@69 457 * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
jpayne@69 458 * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I.
jpayne@69 459 * @param src The original string.
jpayne@69 460 * @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
jpayne@69 461 * @param dest A buffer for the result string. The result will be NUL-terminated if
jpayne@69 462 * the buffer is large enough.
jpayne@69 463 * The contents is undefined in case of failure.
jpayne@69 464 * @param destCapacity The size of the buffer (number of bytes). If it is 0, then
jpayne@69 465 * dest may be NULL and the function will only return the length of the result
jpayne@69 466 * without writing any of the result string.
jpayne@69 467 * @param edits Records edits for index mapping, working with styled text,
jpayne@69 468 * and getting only changes (if any).
jpayne@69 469 * The Edits contents is undefined if any error occurs.
jpayne@69 470 * This function calls edits->reset() first unless
jpayne@69 471 * options includes U_EDITS_NO_RESET. edits can be NULL.
jpayne@69 472 * @param errorCode Reference to an in/out error code value
jpayne@69 473 * which must not indicate a failure before the function call.
jpayne@69 474 * @return The length of the result string, if successful.
jpayne@69 475 * When the result would be longer than destCapacity,
jpayne@69 476 * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
jpayne@69 477 *
jpayne@69 478 * @see ucasemap_utf8FoldCase
jpayne@69 479 * @stable ICU 59
jpayne@69 480 */
jpayne@69 481 static int32_t utf8Fold(
jpayne@69 482 uint32_t options,
jpayne@69 483 const char *src, int32_t srcLength,
jpayne@69 484 char *dest, int32_t destCapacity, Edits *edits,
jpayne@69 485 UErrorCode &errorCode);
jpayne@69 486
jpayne@69 487 private:
jpayne@69 488 CaseMap() = delete;
jpayne@69 489 CaseMap(const CaseMap &other) = delete;
jpayne@69 490 CaseMap &operator=(const CaseMap &other) = delete;
jpayne@69 491 };
jpayne@69 492
jpayne@69 493 U_NAMESPACE_END
jpayne@69 494
jpayne@69 495 #endif /* U_SHOW_CPLUSPLUS_API */
jpayne@69 496
jpayne@69 497 #endif // __CASEMAP_H__