ICU 56.1: unorm2.h Source File

ICU 56.1 56.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

unorm2.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 2009-2015, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 *******************************************************************************
8 * file name: unorm2.h
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:4
12 *
13 * created on: 2009dec15
14 * created by: Markus W. Scherer
15 */
16
17 #ifndef __UNORM2_H__
18 #define __UNORM2_H__
19
31 #include "unicode/utypes.h"
32 #include "unicode/localpointer.h"
33 #include "unicode/uset.h"
34
42 typedef enum {
51 UNORM2_COMPOSE,
60 UNORM2_DECOMPOSE,
73 UNORM2_FCD,
83 UNORM2_COMPOSE_CONTIGUOUS
84 } UNormalization2Mode;
85
91 typedef enum UNormalizationCheckResult {
96 UNORM_NO,
101 UNORM_YES,
109 UNORM_MAYBE
110 } UNormalizationCheckResult;
111
116 struct UNormalizer2;
117 typedef struct UNormalizer2 UNormalizer2;
119 #if !UCONFIG_NO_NORMALIZATION
120
132 U_STABLE const UNormalizer2 * U_EXPORT2
133 unorm2_getNFCInstance(UErrorCode *pErrorCode);
134
146 U_STABLE const UNormalizer2 * U_EXPORT2
147 unorm2_getNFDInstance(UErrorCode *pErrorCode);
148
160 U_STABLE const UNormalizer2 * U_EXPORT2
161 unorm2_getNFKCInstance(UErrorCode *pErrorCode);
162
174 U_STABLE const UNormalizer2 * U_EXPORT2
175 unorm2_getNFKDInstance(UErrorCode *pErrorCode);
176
188 U_STABLE const UNormalizer2 * U_EXPORT2
189 unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode);
190
212 U_STABLE const UNormalizer2 * U_EXPORT2
213 unorm2_getInstance(const char *packageName,
214 const char *name,
215 UNormalization2Mode mode,
216 UErrorCode *pErrorCode);
217
233 U_STABLE UNormalizer2 * U_EXPORT2
234 unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode);
235
242 U_STABLE void U_EXPORT2
243 unorm2_close(UNormalizer2 *norm2);
244
245 #if U_SHOW_CPLUSPLUS_API
246
247 U_NAMESPACE_BEGIN
248
258 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close);
259
260 U_NAMESPACE_END
261
262 #endif
263
280 U_STABLE int32_t U_EXPORT2
281 unorm2_normalize(const UNormalizer2 *norm2,
282 const UChar *src, int32_t length,
283 UChar *dest, int32_t capacity,
284 UErrorCode *pErrorCode);
303 U_STABLE int32_t U_EXPORT2
304 unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2,
305 UChar *first, int32_t firstLength, int32_t firstCapacity,
306 const UChar *second, int32_t secondLength,
307 UErrorCode *pErrorCode);
326 U_STABLE int32_t U_EXPORT2
327 unorm2_append(const UNormalizer2 *norm2,
328 UChar *first, int32_t firstLength, int32_t firstCapacity,
329 const UChar *second, int32_t secondLength,
330 UErrorCode *pErrorCode);
331
351 U_STABLE int32_t U_EXPORT2
352 unorm2_getDecomposition(const UNormalizer2 *norm2,
353 UChar32 c, UChar *decomposition, int32_t capacity,
354 UErrorCode *pErrorCode);
355
385 U_STABLE int32_t U_EXPORT2
386 unorm2_getRawDecomposition(const UNormalizer2 *norm2,
387 UChar32 c, UChar *decomposition, int32_t capacity,
388 UErrorCode *pErrorCode);
389
405 U_STABLE UChar32 U_EXPORT2
406 unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b);
407
417 U_STABLE uint8_t U_EXPORT2
418 unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c);
419
436 U_STABLE UBool U_EXPORT2
437 unorm2_isNormalized(const UNormalizer2 *norm2,
438 const UChar *s, int32_t length,
439 UErrorCode *pErrorCode);
440
458 U_STABLE UNormalizationCheckResult U_EXPORT2
459 unorm2_quickCheck(const UNormalizer2 *norm2,
460 const UChar *s, int32_t length,
461 UErrorCode *pErrorCode);
462
487 U_STABLE int32_t U_EXPORT2
488 unorm2_spanQuickCheckYes(const UNormalizer2 *norm2,
489 const UChar *s, int32_t length,
490 UErrorCode *pErrorCode);
491
501 U_STABLE UBool U_EXPORT2
502 unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c);
503
513 U_STABLE UBool U_EXPORT2
514 unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c);
515
524 U_STABLE UBool U_EXPORT2
525 unorm2_isInert(const UNormalizer2 *norm2, UChar32 c);
526
532 #define UNORM_INPUT_IS_FCD 0x20000
533
539 #define U_COMPARE_IGNORE_CASE 0x10000
540
541 #ifndef U_COMPARE_CODE_POINT_ORDER
542 /* see also unistr.h and ustring.h */
548 #define U_COMPARE_CODE_POINT_ORDER 0x8000
549 #endif
550
617 U_STABLE int32_t U_EXPORT2
618 unorm_compare(const UChar *s1, int32_t length1,
619 const UChar *s2, int32_t length2,
620 uint32_t options,
621 UErrorCode *pErrorCode);
622
623 #endif /* !UCONFIG_NO_NORMALIZATION */
624 #endif /* __UNORM2_H__ */
unorm2_getNFDInstance
const UNormalizer2 * unorm2_getNFDInstance(UErrorCode *pErrorCode)
Returns a UNormalizer2 instance for Unicode NFD normalization.
UNORM2_FCD
"Fast C or D" form.
Definition: unorm2.h:73
UNORM_NO
The input string is not in the normalization form.
Definition: unorm2.h:96
unorm_compare
int32_t unorm_compare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, uint32_t options, UErrorCode *pErrorCode)
Compares two strings for canonical equivalence.
unorm2_getInstance
const UNormalizer2 * unorm2_getInstance(const char *packageName, const char *name, UNormalization2Mode mode, UErrorCode *pErrorCode)
Returns a UNormalizer2 instance which uses the specified data file (packageName/name similar to ucnv_...
unorm2_getRawDecomposition
int32_t unorm2_getRawDecomposition(const UNormalizer2 *norm2, UChar32 c, UChar *decomposition, int32_t capacity, UErrorCode *pErrorCode)
Gets the raw decomposition mapping of c.
UNORM2_DECOMPOSE
Map, and reorder canonically.
Definition: unorm2.h:60
unorm2_isInert
UBool unorm2_isInert(const UNormalizer2 *norm2, UChar32 c)
Tests if the character is normalization-inert.
UNORM_YES
The input string is in the normalization form.
Definition: unorm2.h:101
unorm2_close
void unorm2_close(UNormalizer2 *norm2)
Closes a UNormalizer2 instance from unorm2_openFiltered().
unorm2_isNormalized
UBool unorm2_isNormalized(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode)
Tests if the string is normalized.
unorm2_getNFCInstance
const UNormalizer2 * unorm2_getNFCInstance(UErrorCode *pErrorCode)
Returns a UNormalizer2 instance for Unicode NFC normalization.
UNORM_MAYBE
The input string may or may not be in the normalization form.
Definition: unorm2.h:109
UNORM2_COMPOSE_CONTIGUOUS
Compose only contiguously.
Definition: unorm2.h:83
unorm2_getDecomposition
int32_t unorm2_getDecomposition(const UNormalizer2 *norm2, UChar32 c, UChar *decomposition, int32_t capacity, UErrorCode *pErrorCode)
Gets the decomposition mapping of c.
unorm2_openFiltered
UNormalizer2 * unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode)
Constructs a filtered normalizer wrapping any UNormalizer2 instance and a filter set.
uset.h
C API: Unicode Set.
unorm2_quickCheck
UNormalizationCheckResult unorm2_quickCheck(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode)
Tests if the string is normalized.
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
unorm2_normalize
int32_t unorm2_normalize(const UNormalizer2 *norm2, const UChar *src, int32_t length, UChar *dest, int32_t capacity, UErrorCode *pErrorCode)
Writes the normalized form of the source string to the destination string (replacing its contents) an...
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:535
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UNormalizer2
struct UNormalizer2 UNormalizer2
C typedef for struct UNormalizer2.
Definition: unorm2.h:117
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:332
unorm2_getNFKDInstance
const UNormalizer2 * unorm2_getNFKDInstance(UErrorCode *pErrorCode)
Returns a UNormalizer2 instance for Unicode NFKD normalization.
unorm2_composePair
UChar32 unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b)
Performs pairwise composition of a & b and returns the composite if there is one. ...
unorm2_getNFKCCasefoldInstance
const UNormalizer2 * unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode)
Returns a UNormalizer2 instance for Unicode NFKC_Casefold normalization.
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:312
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
USet
struct USet USet
Definition: ucnv.h:67
UNormalization2Mode
UNormalization2Mode
Constants for normalization modes.
Definition: unorm2.h:42
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
unorm2_getCombiningClass
uint8_t unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c)
Gets the combining class of c.
unorm2_normalizeSecondAndAppend
int32_t unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2, UChar *first, int32_t firstLength, int32_t firstCapacity, const UChar *second, int32_t secondLength, UErrorCode *pErrorCode)
Appends the normalized form of the second string to the first string (merging them at the boundary) a...
unorm2_hasBoundaryAfter
UBool unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c)
Tests if the character always has a normalization boundary after it, regardless of context...
unorm2_spanQuickCheckYes
int32_t unorm2_spanQuickCheckYes(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode)
Returns the end of the normalized substring of the input string.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
unorm2_hasBoundaryBefore
UBool unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c)
Tests if the character always has a normalization boundary before it, regardless of context...
unorm2_append
int32_t unorm2_append(const UNormalizer2 *norm2, UChar *first, int32_t firstLength, int32_t firstCapacity, const UChar *second, int32_t secondLength, UErrorCode *pErrorCode)
Appends the second string to the first string (merging them at the boundary) and returns the length o...
UNORM2_COMPOSE
Decomposition followed by composition.
Definition: unorm2.h:51
LocalUNormalizer2Pointer
"Smart pointer" class, closes a UNormalizer2 via unorm2_close().
unorm2_getNFKCInstance
const UNormalizer2 * unorm2_getNFKCInstance(UErrorCode *pErrorCode)
Returns a UNormalizer2 instance for Unicode NFKC normalization.
UNormalizationCheckResult
UNormalizationCheckResult
Result values for normalization quick check functions.
Definition: unorm2.h:91
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:109
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234