ICU 58.2 58.2

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

- File List
- Globals

unorm2.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 *
6 * Copyright (C) 2009-2015, International Business Machines
7 * Corporation and others. All Rights Reserved.
8 *
9 *******************************************************************************
10 * file name: unorm2.h
11 * encoding: US-ASCII
12 * tab size: 8 (not used)
13 * indentation:4
14 *
15 * created on: 2009dec15
16 * created by: Markus W. Scherer
17 */
18
19 #ifndef __UNORM2_H__
20 #define __UNORM2_H__
21
33 #include "unicode/utypes.h"
34 #include "unicode/localpointer.h"
35 #include "unicode/uset.h"
36
44 typedef enum {
53 UNORM2_COMPOSE,
62 UNORM2_DECOMPOSE,
75 UNORM2_FCD,
85 UNORM2_COMPOSE_CONTIGUOUS
86 } UNormalization2Mode;
87
93 typedef enum UNormalizationCheckResult {
98 UNORM_NO,
103 UNORM_YES,
111 UNORM_MAYBE
112 } UNormalizationCheckResult;
113
118 struct UNormalizer2;
119 typedef struct UNormalizer2 UNormalizer2;
121 #if !UCONFIG_NO_NORMALIZATION
122
134 U_STABLE const UNormalizer2 * U_EXPORT2
135 unorm2_getNFCInstance(UErrorCode *pErrorCode);
136
148 U_STABLE const UNormalizer2 * U_EXPORT2
149 unorm2_getNFDInstance(UErrorCode *pErrorCode);
150
162 U_STABLE const UNormalizer2 * U_EXPORT2
163 unorm2_getNFKCInstance(UErrorCode *pErrorCode);
164
176 U_STABLE const UNormalizer2 * U_EXPORT2
177 unorm2_getNFKDInstance(UErrorCode *pErrorCode);
178
190 U_STABLE const UNormalizer2 * U_EXPORT2
191 unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode);
192
214 U_STABLE const UNormalizer2 * U_EXPORT2
215 unorm2_getInstance(const char *packageName,
216 const char *name,
217 UNormalization2Mode mode,
218 UErrorCode *pErrorCode);
219
235 U_STABLE UNormalizer2 * U_EXPORT2
236 unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode);
237
244 U_STABLE void U_EXPORT2
245 unorm2_close(UNormalizer2 *norm2);
246
247 #if U_SHOW_CPLUSPLUS_API
248
249 U_NAMESPACE_BEGIN
250
260 U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close);
261
262 U_NAMESPACE_END
263
264 #endif
265
282 U_STABLE int32_t U_EXPORT2
283 unorm2_normalize(const UNormalizer2 *norm2,
284 const UChar *src, int32_t length,
285 UChar *dest, int32_t capacity,
286 UErrorCode *pErrorCode);
305 U_STABLE int32_t U_EXPORT2
306 unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2,
307 UChar *first, int32_t firstLength, int32_t firstCapacity,
308 const UChar *second, int32_t secondLength,
309 UErrorCode *pErrorCode);
328 U_STABLE int32_t U_EXPORT2
329 unorm2_append(const UNormalizer2 *norm2,
330 UChar *first, int32_t firstLength, int32_t firstCapacity,
331 const UChar *second, int32_t secondLength,
332 UErrorCode *pErrorCode);
333
353 U_STABLE int32_t U_EXPORT2
354 unorm2_getDecomposition(const UNormalizer2 *norm2,
355 UChar32 c, UChar *decomposition, int32_t capacity,
356 UErrorCode *pErrorCode);
357
387 U_STABLE int32_t U_EXPORT2
388 unorm2_getRawDecomposition(const UNormalizer2 *norm2,
389 UChar32 c, UChar *decomposition, int32_t capacity,
390 UErrorCode *pErrorCode);
391
407 U_STABLE UChar32 U_EXPORT2
408 unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b);
409
419 U_STABLE uint8_t U_EXPORT2
420 unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c);
421
438 U_STABLE UBool U_EXPORT2
439 unorm2_isNormalized(const UNormalizer2 *norm2,
440 const UChar *s, int32_t length,
441 UErrorCode *pErrorCode);
442
460 U_STABLE UNormalizationCheckResult U_EXPORT2
461 unorm2_quickCheck(const UNormalizer2 *norm2,
462 const UChar *s, int32_t length,
463 UErrorCode *pErrorCode);
464
489 U_STABLE int32_t U_EXPORT2
490 unorm2_spanQuickCheckYes(const UNormalizer2 *norm2,
491 const UChar *s, int32_t length,
492 UErrorCode *pErrorCode);
493
503 U_STABLE UBool U_EXPORT2
504 unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c);
505
515 U_STABLE UBool U_EXPORT2
516 unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c);
517
526 U_STABLE UBool U_EXPORT2
527 unorm2_isInert(const UNormalizer2 *norm2, UChar32 c);
528
534 #define UNORM_INPUT_IS_FCD 0x20000
535
541 #define U_COMPARE_IGNORE_CASE 0x10000
542
543 #ifndef U_COMPARE_CODE_POINT_ORDER
544 /* see also unistr.h and ustring.h */
550 #define U_COMPARE_CODE_POINT_ORDER 0x8000
551 #endif
552
619 U_STABLE int32_t U_EXPORT2
620 unorm_compare(const UChar *s1, int32_t length1,
621 const UChar *s2, int32_t length2,
622 uint32_t options,
623 UErrorCode *pErrorCode);
624
625 #endif /* !UCONFIG_NO_NORMALIZATION */
626 #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:75
UNORM_NO
The input string is not in the normalization form.
Definition: unorm2.h:98
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:62
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:103
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:111
UNORM2_COMPOSE_CONTIGUOUS
Compose only contiguously.
Definition: unorm2.h:85
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:131
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:530
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:119
UChar32
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:357
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:337
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
USet
struct USet USet
Definition: ucnv.h:69
UNormalization2Mode
UNormalization2Mode
Constants for normalization modes.
Definition: unorm2.h:44
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
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:53
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:93
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:134
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259