ICU 77.1  77.1
normlzr.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4  ********************************************************************
5  * COPYRIGHT:
6  * Copyright (c) 1996-2015, International Business Machines Corporation and
7  * others. All Rights Reserved.
8  ********************************************************************
9  */
10 
11 #ifndef NORMLZR_H
12 #define NORMLZR_H
13 
14 #include "unicode/utypes.h"
15 
16 #if U_SHOW_CPLUSPLUS_API
17 
23 #if !UCONFIG_NO_NORMALIZATION
24 
25 #include "unicode/chariter.h"
26 #include "unicode/normalizer2.h"
27 #include "unicode/unistr.h"
28 #include "unicode/unorm.h"
29 #include "unicode/uobject.h"
30 
31 U_NAMESPACE_BEGIN
137 public:
138 #ifndef U_HIDE_DEPRECATED_API
144  enum {
145  DONE=0xffff
146  };
147 
148  // Constructors
149 
161 
173  Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode);
174 
186 #endif /* U_HIDE_DEPRECATED_API */
187 
188 #ifndef U_FORCE_HIDE_DEPRECATED_API
194  Normalizer(const Normalizer& copy);
195 
200  virtual ~Normalizer();
201 #endif // U_FORCE_HIDE_DEPRECATED_API
202 
203  //-------------------------------------------------------------------------
204  // Static utility methods
205  //-------------------------------------------------------------------------
206 
207 #ifndef U_HIDE_DEPRECATED_API
222  static void U_EXPORT2 normalize(const UnicodeString& source,
223  UNormalizationMode mode, int32_t options,
224  UnicodeString& result,
225  UErrorCode &status);
226 
244  static void U_EXPORT2 compose(const UnicodeString& source,
245  UBool compat, int32_t options,
246  UnicodeString& result,
247  UErrorCode &status);
248 
266  static void U_EXPORT2 decompose(const UnicodeString& source,
267  UBool compat, int32_t options,
268  UnicodeString& result,
269  UErrorCode &status);
270 
291  static inline UNormalizationCheckResult
292  quickCheck(const UnicodeString &source, UNormalizationMode mode, UErrorCode &status);
293 
308  quickCheck(const UnicodeString &source, UNormalizationMode mode, int32_t options, UErrorCode &status);
309 
330  static inline UBool
331  isNormalized(const UnicodeString &src, UNormalizationMode mode, UErrorCode &errorCode);
332 
348  static UBool
349  isNormalized(const UnicodeString &src, UNormalizationMode mode, int32_t options, UErrorCode &errorCode);
350 
380  static UnicodeString &
381  U_EXPORT2 concatenate(const UnicodeString &left, const UnicodeString &right,
382  UnicodeString &result,
383  UNormalizationMode mode, int32_t options,
384  UErrorCode &errorCode);
385 #endif /* U_HIDE_DEPRECATED_API */
386 
451  static inline int32_t
452  compare(const UnicodeString &s1, const UnicodeString &s2,
453  uint32_t options,
454  UErrorCode &errorCode);
455 
456 #ifndef U_HIDE_DEPRECATED_API
457  //-------------------------------------------------------------------------
458  // Iteration API
459  //-------------------------------------------------------------------------
460 
470 
480 
490 
506 
522 
532  void setIndexOnly(int32_t index);
533 
539  void reset();
540 
555  int32_t getIndex() const;
556 
565  int32_t startIndex() const;
566 
577  int32_t endIndex() const;
578 
587  bool operator==(const Normalizer& that) const;
588 
597  inline bool operator!=(const Normalizer& that) const;
598 
605  Normalizer* clone() const;
606 
613  int32_t hashCode() const;
614 
615  //-------------------------------------------------------------------------
616  // Property access methods
617  //-------------------------------------------------------------------------
618 
635 
647 
664  void setOption(int32_t option,
665  UBool value);
666 
677  UBool getOption(int32_t option) const;
678 
687  void setText(const UnicodeString& newText,
688  UErrorCode &status);
689 
698  void setText(const CharacterIterator& newText,
699  UErrorCode &status);
700 
710  void setText(ConstChar16Ptr newText,
711  int32_t length,
712  UErrorCode &status);
719  void getText(UnicodeString& result);
720 
726  static UClassID U_EXPORT2 getStaticClassID();
727 #endif /* U_HIDE_DEPRECATED_API */
728 
729 #ifndef U_FORCE_HIDE_DEPRECATED_API
735  virtual UClassID getDynamicClassID() const override;
736 #endif // U_FORCE_HIDE_DEPRECATED_API
737 
738 private: