ICU 59.1  59.1
Static Public Member Functions
icu::CaseMap Class Referencefinal

Low-level C++ case mapping functions. More...

#include <casemap.h>

Inheritance diagram for icu::CaseMap:
icu::UMemory

Static Public Member Functions

static int32_t toLower (const char *locale, uint32_t options, const char16_t *src, int32_t srcLength, char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
 Lowercases a UTF-16 string and optionally records edits. More...
 
static int32_t toUpper (const char *locale, uint32_t options, const char16_t *src, int32_t srcLength, char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
 Uppercases a UTF-16 string and optionally records edits. More...
 
static int32_t toTitle (const char *locale, uint32_t options, BreakIterator *iter, const char16_t *src, int32_t srcLength, char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
 Titlecases a UTF-16 string and optionally records edits. More...
 
static int32_t fold (uint32_t options, const char16_t *src, int32_t srcLength, char16_t *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
 Case-folds a UTF-16 string and optionally records edits. More...
 
static int32_t utf8ToLower (const char *locale, uint32_t options, const char *src, int32_t srcLength, char *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
 Lowercases a UTF-8 string and optionally records edits. More...
 
static int32_t utf8ToUpper (const char *locale, uint32_t options, const char *src, int32_t srcLength, char *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
 Uppercases a UTF-8 string and optionally records edits. More...
 
static int32_t utf8ToTitle (const char *locale, uint32_t options, BreakIterator *iter, const char *src, int32_t srcLength, char *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
 Titlecases a UTF-8 string and optionally records edits. More...
 
static int32_t utf8Fold (uint32_t options, const char *src, int32_t srcLength, char *dest, int32_t destCapacity, Edits *edits, UErrorCode &errorCode)
 Case-folds a UTF-8 string and optionally records edits. More...
 

Detailed Description

Low-level C++ case mapping functions.

Draft:
This API may be changed in the future versions and was introduced in ICU 59

Definition at line 30 of file casemap.h.

Member Function Documentation

§ fold()

static int32_t icu::CaseMap::fold ( uint32_t  options,
const char16_t *  src,
int32_t  srcLength,
char16_t *  dest,
int32_t  destCapacity,
Edits edits,
UErrorCode errorCode 
)
static

Case-folds a UTF-16 string and optionally records edits.

Case folding is locale-independent and not context-sensitive, but there is an option for whether to include or exclude mappings for dotted I and dotless i that are marked with 'T' in CaseFolding.txt.

The result may be longer or shorter than the original. The source string and the destination buffer must not overlap.

Parameters
optionsOptions bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT, U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I.
srcThe original string.
srcLengthThe length of the original string. If -1, then src must be NUL-terminated.
destA buffer for the result string. The result will be NUL-terminated if the buffer is large enough. The contents is undefined in case of failure.
destCapacityThe size of the buffer (number of char16_ts). If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string.
editsRecords edits for index mapping, working with styled text, and getting only changes (if any). The Edits contents is undefined if any error occurs. This function calls edits->reset() first. edits can be NULL.
errorCodeReference to an in/out error code value which must not indicate a failure before the function call.
Returns
The length of the result string, if successful. When the result would be longer than destCapacity, the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
See also
u_strFoldCase
Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ toLower()

static int32_t icu::CaseMap::toLower ( const char *  locale,
uint32_t  options,
const char16_t *  src,
int32_t  srcLength,
char16_t *  dest,
int32_t  destCapacity,
Edits edits,
UErrorCode errorCode 
)
static

Lowercases a UTF-16 string and optionally records edits.

Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. The source string and the destination buffer must not overlap.

Parameters
localeThe locale ID. ("" = root locale, NULL = default locale.)
optionsOptions bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT.
srcThe original string.
srcLengthThe length of the original string. If -1, then src must be NUL-terminated.
destA buffer for the result string. The result will be NUL-terminated if the buffer is large enough. The contents is undefined in case of failure.
destCapacityThe size of the buffer (number of char16_ts). If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string.
editsRecords edits for index mapping, working with styled text, and getting only changes (if any). The Edits contents is undefined if any error occurs. This function calls edits->reset() first. edits can be NULL.
errorCodeReference to an in/out error code value which must not indicate a failure before the function call.
Returns
The length of the result string, if successful. When the result would be longer than destCapacity, the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
See also
u_strToLower
Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ toTitle()

static int32_t icu::CaseMap::toTitle ( const char *  locale,
uint32_t  options,
BreakIterator iter,
const char16_t *  src,
int32_t  srcLength,
char16_t *  dest,
int32_t  destCapacity,
Edits edits,
UErrorCode errorCode 
)
static

Titlecases a UTF-16 string and optionally records edits.

Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. The source string and the destination buffer must not overlap.

Titlecasing uses a break iterator to find the first characters of words that are to be titlecased. It titlecases those characters and lowercases all others. (This can be modified with options bits.)

Parameters
localeThe locale ID. ("" = root locale, NULL = default locale.)
optionsOptions bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT, U_TITLECASE_NO_LOWERCASE, U_TITLECASE_NO_BREAK_ADJUSTMENT.
iterA break iterator to find the first characters of words that are to be titlecased. It is set to the source string (setText()) and used one or more times for iteration (first() and next()). If NULL, then a word break iterator for the locale is used (or something equivalent).
srcThe original string.
srcLengthThe length of the original string. If -1, then src must be NUL-terminated.
destA buffer for the result string. The result will be NUL-terminated if the buffer is large enough. The contents is undefined in case of failure.
destCapacityThe size of the buffer (number of char16_ts). If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string.
editsRecords edits for index mapping, working with styled text, and getting only changes (if any). The Edits contents is undefined if any error occurs. This function calls edits->reset() first. edits can be NULL.
errorCodeReference to an in/out error code value which must not indicate a failure before the function call.
Returns
The length of the result string, if successful. When the result would be longer than destCapacity, the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
See also
u_strToTitle
ucasemap_toTitle
Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ toUpper()

static int32_t icu::CaseMap::toUpper ( const char *  locale,
uint32_t  options,
const char16_t *  src,
int32_t  srcLength,
char16_t *  dest,
int32_t  destCapacity,
Edits edits,
UErrorCode errorCode 
)
static

Uppercases a UTF-16 string and optionally records edits.

Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. The source string and the destination buffer must not overlap.

Parameters
localeThe locale ID. ("" = root locale, NULL = default locale.)
optionsOptions bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT.
srcThe original string.
srcLengthThe length of the original string. If -1, then src must be NUL-terminated.
destA buffer for the result string. The result will be NUL-terminated if the buffer is large enough. The contents is undefined in case of failure.
destCapacityThe size of the buffer (number of char16_ts). If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string.
editsRecords edits for index mapping, working with styled text, and getting only changes (if any). The Edits contents is undefined if any error occurs. This function calls edits->reset() first. edits can be NULL.
errorCodeReference to an in/out error code value which must not indicate a failure before the function call.
Returns
The length of the result string, if successful. When the result would be longer than destCapacity, the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
See also
u_strToUpper
Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ utf8Fold()

static int32_t icu::CaseMap::utf8Fold ( uint32_t  options,
const char *  src,
int32_t  srcLength,
char *  dest,
int32_t  destCapacity,
Edits edits,
UErrorCode errorCode 
)
static

Case-folds a UTF-8 string and optionally records edits.

Case folding is locale-independent and not context-sensitive, but there is an option for whether to include or exclude mappings for dotted I and dotless i that are marked with 'T' in CaseFolding.txt.

The result may be longer or shorter than the original. The source string and the destination buffer must not overlap.

Parameters
optionsOptions bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT, U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I.
srcThe original string.
srcLengthThe length of the original string. If -1, then src must be NUL-terminated.
destA buffer for the result string. The result will be NUL-terminated if the buffer is large enough. The contents is undefined in case of failure.
destCapacityThe size of the buffer (number of bytes). If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string.
editsRecords edits for index mapping, working with styled text, and getting only changes (if any). The Edits contents is undefined if any error occurs. This function calls edits->reset() first. edits can be NULL.
errorCodeReference to an in/out error code value which must not indicate a failure before the function call.
Returns
The length of the result string, if successful. When the result would be longer than destCapacity, the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
See also
ucasemap_utf8FoldCase
Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ utf8ToLower()

static int32_t icu::CaseMap::utf8ToLower ( const char *  locale,
uint32_t  options,
const char *  src,
int32_t  srcLength,
char *  dest,
int32_t  destCapacity,
Edits edits,
UErrorCode errorCode 
)
static

Lowercases a UTF-8 string and optionally records edits.

Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. The source string and the destination buffer must not overlap.

Parameters
localeThe locale ID. ("" = root locale, NULL = default locale.)
optionsOptions bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT.
srcThe original string.
srcLengthThe length of the original string. If -1, then src must be NUL-terminated.
destA buffer for the result string. The result will be NUL-terminated if the buffer is large enough. The contents is undefined in case of failure.
destCapacityThe size of the buffer (number of bytes). If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string.
editsRecords edits for index mapping, working with styled text, and getting only changes (if any). The Edits contents is undefined if any error occurs. This function calls edits->reset() first. edits can be NULL.
errorCodeReference to an in/out error code value which must not indicate a failure before the function call.
Returns
The length of the result string, if successful. When the result would be longer than destCapacity, the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
See also
ucasemap_utf8ToLower
Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ utf8ToTitle()

static int32_t icu::CaseMap::utf8ToTitle ( const char *  locale,
uint32_t  options,
BreakIterator iter,
const char *  src,
int32_t  srcLength,
char *  dest,
int32_t  destCapacity,
Edits edits,
UErrorCode errorCode 
)
static

Titlecases a UTF-8 string and optionally records edits.

Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. The source string and the destination buffer must not overlap.

Titlecasing uses a break iterator to find the first characters of words that are to be titlecased. It titlecases those characters and lowercases all others. (This can be modified with options bits.)

Parameters
localeThe locale ID. ("" = root locale, NULL = default locale.)
optionsOptions bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT, U_TITLECASE_NO_LOWERCASE, U_TITLECASE_NO_BREAK_ADJUSTMENT.
iterA break iterator to find the first characters of words that are to be titlecased. It is set to the source string (setText()) and used one or more times for iteration (first() and next()). If NULL, then a word break iterator for the locale is used (or something equivalent).
srcThe original string.
srcLengthThe length of the original string. If -1, then src must be NUL-terminated.
destA buffer for the result string. The result will be NUL-terminated if the buffer is large enough. The contents is undefined in case of failure.
destCapacityThe size of the buffer (number of bytes). If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string.
editsRecords edits for index mapping, working with styled text, and getting only changes (if any). The Edits contents is undefined if any error occurs. This function calls edits->reset() first. edits can be NULL.
errorCodeReference to an in/out error code value which must not indicate a failure before the function call.
Returns
The length of the result string, if successful. When the result would be longer than destCapacity, the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
See also
ucasemap_utf8ToTitle
Draft:
This API may be changed in the future versions and was introduced in ICU 59

§ utf8ToUpper()

static int32_t icu::CaseMap::utf8ToUpper ( const char *  locale,
uint32_t  options,
const char *  src,
int32_t  srcLength,
char *  dest,
int32_t  destCapacity,
Edits edits,
UErrorCode errorCode 
)
static

Uppercases a UTF-8 string and optionally records edits.

Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. The source string and the destination buffer must not overlap.

Parameters
localeThe locale ID. ("" = root locale, NULL = default locale.)
optionsOptions bit set, usually 0. See UCASEMAP_OMIT_UNCHANGED_TEXT.
srcThe original string.
srcLengthThe length of the original string. If -1, then src must be NUL-terminated.
destA buffer for the result string. The result will be NUL-terminated if the buffer is large enough. The contents is undefined in case of failure.
destCapacityThe size of the buffer (number of bytes). If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string.
editsRecords edits for index mapping, working with styled text, and getting only changes (if any). The Edits contents is undefined if any error occurs. This function calls edits->reset() first. edits can be NULL.
errorCodeReference to an in/out error code value which must not indicate a failure before the function call.
Returns
The length of the result string, if successful. When the result would be longer than destCapacity, the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set.
See also
ucasemap_utf8ToUpper
Draft:
This API may be changed in the future versions and was introduced in ICU 59

The documentation for this class was generated from the following file: