1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 ********************************************************************
6 * Copyright (c) 1996-2015, International Business Machines Corporation and
7 * others. All Rights Reserved.
8 ********************************************************************
14 #include "unicode/utypes.h"
18 * \brief C++ API: Unicode Normalization
21 #if !UCONFIG_NO_NORMALIZATION
23 #include "unicode/chariter.h"
24 #include "unicode/normalizer2.h"
25 #include "unicode/unistr.h"
26 #include "unicode/unorm.h"
27 #include "unicode/uobject.h"
29 #if U_SHOW_CPLUSPLUS_API
32 * Old Unicode normalization API.
34 * This API has been replaced by the Normalizer2 class and is only available
35 * for backward compatibility. This class simply delegates to the Normalizer2 class.
36 * There is one exception: The new API does not provide a replacement for Normalizer::compare().
38 * The Normalizer class supports the standard normalization forms described in
39 * <a href="http://www.unicode.org/unicode/reports/tr15/" target="unicode">
40 * Unicode Standard Annex #15: Unicode Normalization Forms</a>.
42 * The Normalizer class consists of two parts:
43 * - static functions that normalize strings or test if strings are normalized
44 * - a Normalizer object is an iterator that takes any kind of text and
45 * provides iteration over its normalized form
47 * The Normalizer class is not suitable for subclassing.
49 * For basic information about normalization forms and details about the C API
50 * please see the documentation in unorm.h.
52 * The iterator API with the Normalizer constructors and the non-static functions
53 * use a CharacterIterator as input. It is possible to pass a string which
54 * is then internally wrapped in a CharacterIterator.
55 * The input text is not normalized all at once, but incrementally where needed
56 * (providing efficient random access).
57 * This allows to pass in a large text but spend only a small amount of time
58 * normalizing a small part of that text.
59 * However, if the entire text is normalized, then the iterator will be
60 * slower than normalizing the entire text at once and iterating over the result.
61 * A possible use of the Normalizer iterator is also to report an index into the
62 * original text that is close to where the normalized characters come from.
64 * <em>Important:</em> The iterator API was cleaned up significantly for ICU 2.0.
65 * The earlier implementation reported the getIndex() inconsistently,
66 * and previous() could not be used after setIndex(), next(), first(), and current().
68 * Normalizer allows to start normalizing from anywhere in the input text by
69 * calling setIndexOnly(), first(), or last().
70 * Without calling any of these, the iterator will start at the beginning of the text.
72 * At any time, next() returns the next normalized code point (UChar32),
73 * with post-increment semantics (like CharacterIterator::next32PostInc()).
74 * previous() returns the previous normalized code point (UChar32),
75 * with pre-decrement semantics (like CharacterIterator::previous32()).
77 * current() returns the current code point
78 * (respectively the one at the newly set index) without moving
79 * the getIndex(). Note that if the text at the current position
80 * needs to be normalized, then these functions will do that.
81 * (This is why current() is not const.)
82 * It is more efficient to call setIndexOnly() instead, which does not
85 * getIndex() always refers to the position in the input text where the normalized
86 * code points are returned from. It does not always change with each returned
88 * The code point that is returned from any of the functions
89 * corresponds to text at or after getIndex(), according to the
90 * function's iteration semantics (post-increment or pre-decrement).
92 * next() returns a code point from at or after the getIndex()
93 * from before the next() call. After the next() call, the getIndex()
94 * might have moved to where the next code point will be returned from
95 * (from a next() or current() call).
96 * This is semantically equivalent to array access with array[index++]
97 * (post-increment semantics).
99 * previous() returns a code point from at or after the getIndex()
100 * from after the previous() call.
101 * This is semantically equivalent to array access with array[--index]
102 * (pre-decrement semantics).
104 * Internally, the Normalizer iterator normalizes a small piece of text
105 * starting at the getIndex() and ending at a following "safe" index.
106 * The normalized results is stored in an internal string buffer, and
107 * the code points are iterated from there.
108 * With multiple iteration calls, this is repeated until the next piece
109 * of text needs to be normalized, and the getIndex() needs to be moved.
111 * The following "safe" index, the internal buffer, and the secondary
112 * iteration index into that buffer are not exposed on the API.
113 * This also means that it is currently not practical to return to
114 * a particular, arbitrary position in the text because one would need to
115 * know, and be able to set, in addition to the getIndex(), at least also the
116 * current index into the internal buffer.
117 * It is currently only possible to observe when getIndex() changes
118 * (with careful consideration of the iteration semantics),
119 * at which time the internal index will be 0.
120 * For example, if getIndex() is different after next() than before it,
121 * then the internal index is 0 and one can return to this getIndex()
122 * later with setIndexOnly().
124 * Note: While the setIndex() and getIndex() refer to indices in the
125 * underlying Unicode input text, the next() and previous() methods
126 * iterate through characters in the normalized output.
127 * This means that there is not necessarily a one-to-one correspondence
128 * between characters returned by next() and previous() and the indices
129 * passed to and returned from setIndex() and getIndex().
130 * It is for this reason that Normalizer does not implement the CharacterIterator interface.
132 * @author Laura Werner, Mark Davis, Markus Scherer
135 class U_COMMON_API Normalizer
: public UObject
{
137 #ifndef U_HIDE_DEPRECATED_API
139 * If DONE is returned from an iteration function that returns a code point,
140 * then there are no more normalization results available.
141 * @deprecated ICU 56 Use Normalizer2 instead.
150 * Creates a new <code>Normalizer</code> object for iterating over the
151 * normalized form of a given string.
153 * @param str The string to be normalized. The normalization
154 * will start at the beginning of the string.
156 * @param mode The normalization mode.
157 * @deprecated ICU 56 Use Normalizer2 instead.
159 Normalizer(const UnicodeString
& str
, UNormalizationMode mode
);
162 * Creates a new <code>Normalizer</code> object for iterating over the
163 * normalized form of a given string.
165 * @param str The string to be normalized. The normalization
166 * will start at the beginning of the string.
168 * @param length Length of the string, or -1 if NUL-terminated.
169 * @param mode The normalization mode.
170 * @deprecated ICU 56 Use Normalizer2 instead.
172 Normalizer(ConstChar16Ptr str
, int32_t length
, UNormalizationMode mode
);
175 * Creates a new <code>Normalizer</code> object for iterating over the
176 * normalized form of the given text.
178 * @param iter The input text to be normalized. The normalization
179 * will start at the beginning of the string.
181 * @param mode The normalization mode.
182 * @deprecated ICU 56 Use Normalizer2 instead.
184 Normalizer(const CharacterIterator
& iter
, UNormalizationMode mode
);
185 #endif /* U_HIDE_DEPRECATED_API */
189 * @param copy The object to be copied.
190 * @deprecated ICU 56 Use Normalizer2 instead.
192 Normalizer(const Normalizer
& copy
);
196 * @deprecated ICU 56 Use Normalizer2 instead.
198 virtual ~Normalizer();
201 //-------------------------------------------------------------------------
202 // Static utility methods
203 //-------------------------------------------------------------------------
205 #ifndef U_HIDE_DEPRECATED_API
207 * Normalizes a <code>UnicodeString</code> according to the specified normalization mode.
208 * This is a wrapper for unorm_normalize(), using UnicodeString's.
210 * The <code>options</code> parameter specifies which optional
211 * <code>Normalizer</code> features are to be enabled for this operation.
213 * @param source the input string to be normalized.
214 * @param mode the normalization mode
215 * @param options the optional features to be enabled (0 for no options)
216 * @param result The normalized string (on output).
217 * @param status The error code.
218 * @deprecated ICU 56 Use Normalizer2 instead.
220 static void U_EXPORT2
normalize(const UnicodeString
& source
,
221 UNormalizationMode mode
, int32_t options
,
222 UnicodeString
& result
,
226 * Compose a <code>UnicodeString</code>.
227 * This is equivalent to normalize() with mode UNORM_NFC or UNORM_NFKC.
228 * This is a wrapper for unorm_normalize(), using UnicodeString's.
230 * The <code>options</code> parameter specifies which optional
231 * <code>Normalizer</code> features are to be enabled for this operation.
233 * @param source the string to be composed.
234 * @param compat Perform compatibility decomposition before composition.
235 * If this argument is <code>FALSE</code>, only canonical
236 * decomposition will be performed.
237 * @param options the optional features to be enabled (0 for no options)
238 * @param result The composed string (on output).
239 * @param status The error code.
240 * @deprecated ICU 56 Use Normalizer2 instead.
242 static void U_EXPORT2
compose(const UnicodeString
& source
,
243 UBool compat
, int32_t options
,
244 UnicodeString
& result
,
248 * Static method to decompose a <code>UnicodeString</code>.
249 * This is equivalent to normalize() with mode UNORM_NFD or UNORM_NFKD.
250 * This is a wrapper for unorm_normalize(), using UnicodeString's.
252 * The <code>options</code> parameter specifies which optional
253 * <code>Normalizer</code> features are to be enabled for this operation.
255 * @param source the string to be decomposed.
256 * @param compat Perform compatibility decomposition.
257 * If this argument is <code>FALSE</code>, only canonical
258 * decomposition will be performed.
259 * @param options the optional features to be enabled (0 for no options)
260 * @param result The decomposed string (on output).
261 * @param status The error code.
262 * @deprecated ICU 56 Use Normalizer2 instead.
264 static void U_EXPORT2
decompose(const UnicodeString
& source
,
265 UBool compat
, int32_t options
,
266 UnicodeString
& result
,
270 * Performing quick check on a string, to quickly determine if the string is
271 * in a particular normalization format.
272 * This is a wrapper for unorm_quickCheck(), using a UnicodeString.
274 * Three types of result can be returned UNORM_YES, UNORM_NO or
275 * UNORM_MAYBE. Result UNORM_YES indicates that the argument
276 * string is in the desired normalized format, UNORM_NO determines that
277 * argument string is not in the desired normalized format. A
278 * UNORM_MAYBE result indicates that a more thorough check is required,
279 * the user may have to put the string in its normalized form and compare the
281 * @param source string for determining if it is in a normalized format
282 * @param mode normalization format
283 * @param status A reference to a UErrorCode to receive any errors
284 * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
287 * @deprecated ICU 56 Use Normalizer2 instead.
289 static inline UNormalizationCheckResult
290 quickCheck(const UnicodeString
&source
, UNormalizationMode mode
, UErrorCode
&status
);
293 * Performing quick check on a string; same as the other version of quickCheck
294 * but takes an extra options parameter like most normalization functions.
296 * @param source string for determining if it is in a normalized format
297 * @param mode normalization format
298 * @param options the optional features to be enabled (0 for no options)
299 * @param status A reference to a UErrorCode to receive any errors
300 * @return UNORM_YES, UNORM_NO or UNORM_MAYBE
303 * @deprecated ICU 56 Use Normalizer2 instead.
305 static UNormalizationCheckResult
306 quickCheck(const UnicodeString
&source
, UNormalizationMode mode
, int32_t options
, UErrorCode
&status
);
309 * Test if a string is in a given normalization form.
310 * This is semantically equivalent to source.equals(normalize(source, mode)) .
312 * Unlike unorm_quickCheck(), this function returns a definitive result,
314 * For NFD, NFKD, and FCD, both functions work exactly the same.
315 * For NFC and NFKC where quickCheck may return "maybe", this function will
316 * perform further tests to arrive at a TRUE/FALSE result.
318 * @param src String that is to be tested if it is in a normalization format.
319 * @param mode Which normalization form to test for.
320 * @param errorCode ICU error code in/out parameter.
321 * Must fulfill U_SUCCESS before the function call.
322 * @return Boolean value indicating whether the source string is in the
323 * "mode" normalization form.
326 * @deprecated ICU 56 Use Normalizer2 instead.
329 isNormalized(const UnicodeString
&src
, UNormalizationMode mode
, UErrorCode
&errorCode
);
332 * Test if a string is in a given normalization form; same as the other version of isNormalized
333 * but takes an extra options parameter like most normalization functions.
335 * @param src String that is to be tested if it is in a normalization format.
336 * @param mode Which normalization form to test for.
337 * @param options the optional features to be enabled (0 for no options)
338 * @param errorCode ICU error code in/out parameter.
339 * Must fulfill U_SUCCESS before the function call.
340 * @return Boolean value indicating whether the source string is in the
341 * "mode" normalization form.
344 * @deprecated ICU 56 Use Normalizer2 instead.
347 isNormalized(const UnicodeString
&src
, UNormalizationMode mode
, int32_t options
, UErrorCode
&errorCode
);
350 * Concatenate normalized strings, making sure that the result is normalized as well.
352 * If both the left and the right strings are in
353 * the normalization form according to "mode/options",
354 * then the result will be
357 * dest=normalize(left+right, mode, options)
360 * For details see unorm_concatenate in unorm.h.
362 * @param left Left source string.
363 * @param right Right source string.
364 * @param result The output string.
365 * @param mode The normalization mode.
366 * @param options A bit set of normalization options.
367 * @param errorCode ICU error code in/out parameter.
368 * Must fulfill U_SUCCESS before the function call.
371 * @see unorm_concatenate
374 * @see unorm_previous
376 * @deprecated ICU 56 Use Normalizer2 instead.
378 static UnicodeString
&
379 U_EXPORT2
concatenate(const UnicodeString
&left
, const UnicodeString
&right
,
380 UnicodeString
&result
,
381 UNormalizationMode mode
, int32_t options
,
382 UErrorCode
&errorCode
);
383 #endif /* U_HIDE_DEPRECATED_API */
386 * Compare two strings for canonical equivalence.
387 * Further options include case-insensitive comparison and
388 * code point order (as opposed to code unit order).
390 * Canonical equivalence between two strings is defined as their normalized
391 * forms (NFD or NFC) being identical.
392 * This function compares strings incrementally instead of normalizing
393 * (and optionally case-folding) both strings entirely,
394 * improving performance significantly.
396 * Bulk normalization is only necessary if the strings do not fulfill the FCD
397 * conditions. Only in this case, and only if the strings are relatively long,
398 * is memory allocated temporarily.
399 * For FCD strings and short non-FCD strings there is no memory allocation.
401 * Semantically, this is equivalent to
402 * strcmp[CodePointOrder](NFD(foldCase(s1)), NFD(foldCase(s2)))
403 * where code point order and foldCase are all optional.
405 * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match
406 * the case folding must be performed first, then the normalization.
408 * @param s1 First source string.
409 * @param s2 Second source string.
411 * @param options A bit set of options:
412 * - U_FOLD_CASE_DEFAULT or 0 is used for default options:
413 * Case-sensitive comparison in code unit order, and the input strings
414 * are quick-checked for FCD.
416 * - UNORM_INPUT_IS_FCD
417 * Set if the caller knows that both s1 and s2 fulfill the FCD conditions.
418 * If not set, the function will quickCheck for FCD
419 * and normalize if necessary.
421 * - U_COMPARE_CODE_POINT_ORDER
422 * Set to choose code point order instead of code unit order
423 * (see u_strCompare for details).
425 * - U_COMPARE_IGNORE_CASE
426 * Set to compare strings case-insensitively using case folding,
427 * instead of case-sensitively.
428 * If set, then the following case folding options are used.
430 * - Options as used with case-insensitive comparisons, currently:
432 * - U_FOLD_CASE_EXCLUDE_SPECIAL_I
433 * (see u_strCaseCompare for details)
435 * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT
437 * @param errorCode ICU error code in/out parameter.
438 * Must fulfill U_SUCCESS before the function call.
439 * @return <0 or 0 or >0 as usual for string comparisons
445 * @see u_strCaseCompare
449 static inline int32_t
450 compare(const UnicodeString
&s1
, const UnicodeString
&s2
,
452 UErrorCode
&errorCode
);
454 #ifndef U_HIDE_DEPRECATED_API
455 //-------------------------------------------------------------------------
457 //-------------------------------------------------------------------------
460 * Return the current character in the normalized text.
461 * current() may need to normalize some text at getIndex().
462 * The getIndex() is not changed.
464 * @return the current normalized code point
465 * @deprecated ICU 56 Use Normalizer2 instead.
467 UChar32
current(void);
470 * Return the first character in the normalized text.
471 * This is equivalent to setIndexOnly(startIndex()) followed by next().
472 * (Post-increment semantics.)
474 * @return the first normalized code point
475 * @deprecated ICU 56 Use Normalizer2 instead.
480 * Return the last character in the normalized text.
481 * This is equivalent to setIndexOnly(endIndex()) followed by previous().
482 * (Pre-decrement semantics.)
484 * @return the last normalized code point
485 * @deprecated ICU 56 Use Normalizer2 instead.
490 * Return the next character in the normalized text.
491 * (Post-increment semantics.)
492 * If the end of the text has already been reached, DONE is returned.
493 * The DONE value could be confused with a U+FFFF non-character code point
494 * in the text. If this is possible, you can test getIndex()<endIndex()
495 * before calling next(), or (getIndex()<endIndex() || last()!=DONE)
496 * after calling next(). (Calling last() will change the iterator state!)
498 * The C API unorm_next() is more efficient and does not have this ambiguity.
500 * @return the next normalized code point
501 * @deprecated ICU 56 Use Normalizer2 instead.
506 * Return the previous character in the normalized text and decrement.
507 * (Pre-decrement semantics.)
508 * If the beginning of the text has already been reached, DONE is returned.
509 * The DONE value could be confused with a U+FFFF non-character code point
510 * in the text. If this is possible, you can test
511 * (getIndex()>startIndex() || first()!=DONE). (Calling first() will change
512 * the iterator state!)
514 * The C API unorm_previous() is more efficient and does not have this ambiguity.
516 * @return the previous normalized code point
517 * @deprecated ICU 56 Use Normalizer2 instead.
519 UChar32
previous(void);
522 * Set the iteration position in the input text that is being normalized,
523 * without any immediate normalization.
524 * After setIndexOnly(), getIndex() will return the same index that is
527 * @param index the desired index in the input text.
528 * @deprecated ICU 56 Use Normalizer2 instead.
530 void setIndexOnly(int32_t index
);
533 * Reset the index to the beginning of the text.
534 * This is equivalent to setIndexOnly(startIndex)).
535 * @deprecated ICU 56 Use Normalizer2 instead.
540 * Retrieve the current iteration position in the input text that is
543 * A following call to next() will return a normalized code point from
544 * the input text at or after this index.
546 * After a call to previous(), getIndex() will point at or before the
547 * position in the input text where the normalized code point
548 * was returned from with previous().
550 * @return the current index in the input text
551 * @deprecated ICU 56 Use Normalizer2 instead.
553 int32_t getIndex(void) const;
556 * Retrieve the index of the start of the input text. This is the begin index
557 * of the <code>CharacterIterator</code> or the start (i.e. index 0) of the string
558 * over which this <code>Normalizer</code> is iterating.
560 * @return the smallest index in the input text where the Normalizer operates
561 * @deprecated ICU 56 Use Normalizer2 instead.
563 int32_t startIndex(void) const;
566 * Retrieve the index of the end of the input text. This is the end index
567 * of the <code>CharacterIterator</code> or the length of the string
568 * over which this <code>Normalizer</code> is iterating.
569 * This end index is exclusive, i.e., the Normalizer operates only on characters
572 * @return the first index in the input text where the Normalizer does not operate
573 * @deprecated ICU 56 Use Normalizer2 instead.
575 int32_t endIndex(void) const;
578 * Returns TRUE when both iterators refer to the same character in the same
581 * @param that a Normalizer object to compare this one to
582 * @return comparison result
583 * @deprecated ICU 56 Use Normalizer2 instead.
585 UBool
operator==(const Normalizer
& that
) const;
588 * Returns FALSE when both iterators refer to the same character in the same
591 * @param that a Normalizer object to compare this one to
592 * @return comparison result
593 * @deprecated ICU 56 Use Normalizer2 instead.
595 inline UBool
operator!=(const Normalizer
& that
) const;
598 * Returns a pointer to a new Normalizer that is a clone of this one.
599 * The caller is responsible for deleting the new clone.
600 * @return a pointer to a new Normalizer
601 * @deprecated ICU 56 Use Normalizer2 instead.
603 Normalizer
* clone(void) const;
606 * Generates a hash code for this iterator.
608 * @return the hash code
609 * @deprecated ICU 56 Use Normalizer2 instead.
611 int32_t hashCode(void) const;
613 //-------------------------------------------------------------------------
614 // Property access methods
615 //-------------------------------------------------------------------------
618 * Set the normalization mode for this object.
620 * <b>Note:</b>If the normalization mode is changed while iterating
621 * over a string, calls to {@link #next() } and {@link #previous() } may
622 * return previously buffers characters in the old normalization mode
623 * until the iteration is able to re-sync at the next base character.
624 * It is safest to call {@link #setIndexOnly }, {@link #reset() },
625 * {@link #setText }, {@link #first() },
626 * {@link #last() }, etc. after calling <code>setMode</code>.
628 * @param newMode the new mode for this <code>Normalizer</code>.
630 * @deprecated ICU 56 Use Normalizer2 instead.
632 void setMode(UNormalizationMode newMode
);
635 * Return the normalization mode for this object.
637 * This is an unusual name because there used to be a getMode() that
638 * returned a different type.
640 * @return the mode for this <code>Normalizer</code>
642 * @deprecated ICU 56 Use Normalizer2 instead.
644 UNormalizationMode
getUMode(void) const;
647 * Set options that affect this <code>Normalizer</code>'s operation.
648 * Options do not change the basic composition or decomposition operation
649 * that is being performed, but they control whether
650 * certain optional portions of the operation are done.
651 * Currently the only available option is obsolete.
653 * It is possible to specify multiple options that are all turned on or off.
655 * @param option the option(s) whose value is/are to be set.
656 * @param value the new setting for the option. Use <code>TRUE</code> to
657 * turn the option(s) on and <code>FALSE</code> to turn it/them off.
660 * @deprecated ICU 56 Use Normalizer2 instead.
662 void setOption(int32_t option
,
666 * Determine whether an option is turned on or off.
667 * If multiple options are specified, then the result is TRUE if any
670 * @param option the option(s) that are to be checked
671 * @return TRUE if any of the option(s) are set
673 * @deprecated ICU 56 Use Normalizer2 instead.
675 UBool
getOption(int32_t option
) const;
678 * Set the input text over which this <code>Normalizer</code> will iterate.
679 * The iteration position is set to the beginning.
681 * @param newText a string that replaces the current input text
682 * @param status a UErrorCode
683 * @deprecated ICU 56 Use Normalizer2 instead.
685 void setText(const UnicodeString
& newText
,
689 * Set the input text over which this <code>Normalizer</code> will iterate.
690 * The iteration position is set to the beginning.
692 * @param newText a CharacterIterator object that replaces the current input text
693 * @param status a UErrorCode
694 * @deprecated ICU 56 Use Normalizer2 instead.
696 void setText(const CharacterIterator
& newText
,
700 * Set the input text over which this <code>Normalizer</code> will iterate.
701 * The iteration position is set to the beginning.
703 * @param newText a string that replaces the current input text
704 * @param length the length of the string, or -1 if NUL-terminated
705 * @param status a UErrorCode
706 * @deprecated ICU 56 Use Normalizer2 instead.
708 void setText(ConstChar16Ptr newText
,
712 * Copies the input text into the UnicodeString argument.
714 * @param result Receives a copy of the text under iteration.
715 * @deprecated ICU 56 Use Normalizer2 instead.
717 void getText(UnicodeString
& result
);
720 * ICU "poor man's RTTI", returns a UClassID for this class.
721 * @returns a UClassID for this class.
722 * @deprecated ICU 56 Use Normalizer2 instead.
724 static UClassID U_EXPORT2
getStaticClassID();
725 #endif /* U_HIDE_DEPRECATED_API */
728 * ICU "poor man's RTTI", returns a UClassID for the actual class.
729 * @return a UClassID for the actual class.
730 * @deprecated ICU 56 Use Normalizer2 instead.
732 virtual UClassID
getDynamicClassID() const;
735 //-------------------------------------------------------------------------
737 //-------------------------------------------------------------------------
739 Normalizer(); // default constructor not implemented
740 Normalizer
&operator=(const Normalizer
&that
); // assignment operator not implemented
742 // Private utility methods for iteration
743 // For documentation, see the source code
744 UBool
nextNormalize();
745 UBool
previousNormalize();
748 void clearBuffer(void);
750 //-------------------------------------------------------------------------
752 //-------------------------------------------------------------------------
754 FilteredNormalizer2
*fFilteredNorm2
; // owned if not NULL
755 const Normalizer2
*fNorm2
; // not owned; may be equal to fFilteredNorm2
756 UNormalizationMode fUMode
; // deprecated
759 // The input text and our position in it
760 CharacterIterator
*text
;
762 // The normalization buffer is the result of normalization
763 // of the source in [currentIndex..nextIndex[ .
764 int32_t currentIndex
, nextIndex
;
766 // A buffer for holding intermediate results
767 UnicodeString buffer
;
771 //-------------------------------------------------------------------------
772 // Inline implementations
773 //-------------------------------------------------------------------------
775 #ifndef U_HIDE_DEPRECATED_API
777 Normalizer::operator!= (const Normalizer
& other
) const
778 { return ! operator==(other
); }
780 inline UNormalizationCheckResult
781 Normalizer::quickCheck(const UnicodeString
& source
,
782 UNormalizationMode mode
,
783 UErrorCode
&status
) {
784 return quickCheck(source
, mode
, 0, status
);
788 Normalizer::isNormalized(const UnicodeString
& source
,
789 UNormalizationMode mode
,
790 UErrorCode
&status
) {
791 return isNormalized(source
, mode
, 0, status
);
793 #endif /* U_HIDE_DEPRECATED_API */
796 Normalizer::compare(const UnicodeString
&s1
, const UnicodeString
&s2
,
798 UErrorCode
&errorCode
) {
799 // all argument checking is done in unorm_compare
800 return unorm_compare(toUCharPtr(s1
.getBuffer()), s1
.length(),
801 toUCharPtr(s2
.getBuffer()), s2
.length(),
807 #endif // U_SHOW_CPLUSPLUS_API
809 #endif /* #if !UCONFIG_NO_NORMALIZATION */