ucasemap.h File Reference

C API: Unicode case mapping functions using a UCaseMap service object. More...

#include "unicode/utypes.h"
#include "unicode/ustring.h"

Go to the source code of this file.

Typedefs

typedef UCaseMap UCaseMap
 C typedef for struct UCaseMap.

Functions

UCaseMapucasemap_open (const char *locale, uint32_t options, UErrorCode *pErrorCode)
 Open a UCaseMap service object for a locale and a set of options.
void ucasemap_close (UCaseMap *csm)
 Close a UCaseMap service object.
const char * ucasemap_getLocale (const UCaseMap *csm)
 Get the locale ID that is used for language-dependent case mappings.
uint32_t ucasemap_getOptions (const UCaseMap *csm)
 Get the options bit set that is used for case folding and string comparisons.
void ucasemap_setLocale (UCaseMap *csm, const char *locale, UErrorCode *pErrorCode)
 Set the locale ID that is used for language-dependent case mappings.
void ucasemap_setOptions (UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode)
 Set the options bit set that is used for case folding and string comparisons.
int32_t ucasemap_utf8ToLower (const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, UErrorCode *pErrorCode)
 Lowercase the characters in a UTF-8 string.
int32_t ucasemap_utf8ToUpper (const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, UErrorCode *pErrorCode)
 Uppercase the characters in a UTF-8 string.


Detailed Description

C API: Unicode case mapping functions using a UCaseMap service object.

The service object takes care of memory allocations, data loading, and setup for the attributes, as usual.

Currently, the functionality provided here does not overlap with uchar.h and ustring.h.

ucasemap_utf8ToLower() and ucasemap_utf8ToUpper() operate directly on UTF-8 strings.

Definition in file ucasemap.h.


Typedef Documentation

typedef struct UCaseMap UCaseMap

C typedef for struct UCaseMap.

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

Definition at line 45 of file ucasemap.h.


Function Documentation

void ucasemap_close ( UCaseMap csm  ) 

Close a UCaseMap service object.

Parameters:
csm Object to be closed.
Draft:
This API may be changed in the future versions and was introduced in ICU 3.4

const char* ucasemap_getLocale ( const UCaseMap csm  ) 

Get the locale ID that is used for language-dependent case mappings.

Parameters:
csm UCaseMap service object.
Returns:
locale ID
Draft:
This API may be changed in the future versions and was introduced in ICU 3.4

uint32_t ucasemap_getOptions ( const UCaseMap csm  ) 

Get the options bit set that is used for case folding and string comparisons.

Parameters:
csm UCaseMap service object.
Returns:
options bit set
Draft:
This API may be changed in the future versions and was introduced in ICU 3.4

UCaseMap* ucasemap_open ( const char *  locale,
uint32_t  options,
UErrorCode pErrorCode 
)

Open a UCaseMap service object for a locale and a set of options.

The locale ID and options are preprocessed so that functions using the service object need not process them in each call.

Parameters:
locale ICU locale ID, used for language-dependent upper-/lower-/title-casing according to the Unicode standard. Usual semantics: ""=root, NULL=default locale, etc.
options Options bit set, used for case folding and string comparisons. Same flags as for u_foldCase(), u_strFoldCase(), u_strCaseCompare(), etc. Use 0 or U_FOLD_CASE_DEFAULT for default behavior.
pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
Returns:
Pointer to a UCaseMap service object, if successful.
Draft:
This API may be changed in the future versions and was introduced in ICU 3.4

void ucasemap_setLocale ( UCaseMap csm,
const char *  locale,
UErrorCode pErrorCode 
)

Set the locale ID that is used for language-dependent case mappings.

Parameters:
csm UCaseMap service object.
locale Locale ID, see ucasemap_open().
pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
See also:
ucasemap_open
Draft:
This API may be changed in the future versions and was introduced in ICU 3.4

void ucasemap_setOptions ( UCaseMap csm,
uint32_t  options,
UErrorCode pErrorCode 
)

Set the options bit set that is used for case folding and string comparisons.

Parameters:
csm UCaseMap service object.
options Options bit set, see ucasemap_open().
pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
See also:
ucasemap_open
Draft:
This API may be changed in the future versions and was introduced in ICU 3.4

int32_t ucasemap_utf8ToLower ( const UCaseMap csm,
char *  dest,
int32_t  destCapacity,
const char *  src,
int32_t  srcLength,
UErrorCode pErrorCode 
)

Lowercase the characters in a UTF-8 string.

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:
csm UCaseMap service object.
dest A 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.
destCapacity The 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.
src The original string
srcLength The length of the original string. If -1, then src must be NUL-terminated.
pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
Returns:
The length of the result string, if successful - or in case of a buffer overflow, in which case it will be greater than destCapacity.
See also:
u_strToLower
Draft:
This API may be changed in the future versions and was introduced in ICU 3.4

int32_t ucasemap_utf8ToUpper ( const UCaseMap csm,
char *  dest,
int32_t  destCapacity,
const char *  src,
int32_t  srcLength,
UErrorCode pErrorCode 
)

Uppercase the characters in a UTF-8 string.

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:
csm UCaseMap service object.
dest A 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.
destCapacity The 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.
src The original string
srcLength The length of the original string. If -1, then src must be NUL-terminated.
pErrorCode Must be a valid pointer to an error code value, which must not indicate a failure before the function call.
Returns:
The length of the result string, if successful - or in case of a buffer overflow, in which case it will be greater than destCapacity.
See also:
u_strToUpper
Draft:
This API may be changed in the future versions and was introduced in ICU 3.4


Generated on Mon Aug 13 07:17:25 2007 for ICU 3.6 by  doxygen 1.5.2