1 /*********************************************************************** 2 * © 2016 and later: Unicode, Inc. and others. 3 * License & terms of use: http://www.unicode.org/copyright.html 4 *********************************************************************** 5 *********************************************************************** 6 * COPYRIGHT: 7 * Copyright (c) 1999-2002, International Business Machines Corporation and 8 * others. All Rights Reserved. 9 ***********************************************************************/ 10 11 #include "unicode/translit.h" 12 #include "unicode/normlzr.h" 13 14 using icu::Normalizer; 15 using icu::Replaceable; 16 using icu::Transliterator; 17 18 class UnaccentTransliterator : public Transliterator { 19 20 public: 21 22 /** 23 * Constructor 24 */ 25 UnaccentTransliterator(); 26 27 /** 28 * Destructor 29 */ 30 virtual ~UnaccentTransliterator(); 31 32 UClassID getDynamicClassID() const override; 33 U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); 34 35 protected: 36 37 /** 38 * Implement Transliterator API 39 */ 40 void handleTransliterate(Replaceable& text, 41 UTransPosition& index, 42 UBool incremental) const override; 43 44 private: 45 46 /** 47 * Unaccent a single character using normalizer. 48 */ 49 char16_t unaccent(char16_t c) const; 50 51 Normalizer normalizer; 52 }; 53