1 /* 2 ********************************************************************** 3 * Copyright (C) 2001-2010, International Business Machines 4 * Corporation and others. All Rights Reserved. 5 ********************************************************************** 6 * Date Name Description 7 * 07/03/01 aliu Creation. 8 ********************************************************************** 9 */ 10 #ifndef NORTRANS_H 11 #define NORTRANS_H 12 13 #include "unicode/utypes.h" 14 15 #if !UCONFIG_NO_TRANSLITERATION 16 17 #include "unicode/translit.h" 18 #include "unicode/normalizer2.h" 19 20 U_NAMESPACE_BEGIN 21 22 /** 23 * A transliterator that performs normalization. 24 * @author Alan Liu 25 */ 26 class NormalizationTransliterator : public Transliterator { 27 const Normalizer2 &fNorm2; 28 29 public: 30 31 /** 32 * Destructor. 33 */ 34 virtual ~NormalizationTransliterator(); 35 36 /** 37 * Copy constructor. 38 */ 39 NormalizationTransliterator(const NormalizationTransliterator&); 40 41 /** 42 * Transliterator API. 43 * @return A copy of the object. 44 */ 45 virtual Transliterator* clone(void) const; 46 47 /** 48 * ICU "poor man's RTTI", returns a UClassID for the actual class. 49 */ 50 virtual UClassID getDynamicClassID() const; 51 52 /** 53 * ICU "poor man's RTTI", returns a UClassID for this class. 54 */ 55 U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); 56 57 protected: 58 59 /** 60 * Implements {@link Transliterator#handleTransliterate}. 61 * @param text the buffer holding transliterated and 62 * untransliterated text 63 * @param offset the start and limit of the text, the position 64 * of the cursor, and the start and limit of transliteration. 65 * @param incremental if true, assume more text may be coming after 66 * pos.contextLimit. Otherwise, assume the text is complete. 67 */ 68 virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, 69 UBool isIncremental) const; 70 public: 71 72 /** 73 * System registration hook. Public to Transliterator only. 74 */ 75 static void registerIDs(); 76 77 private: 78 79 // Transliterator::Factory methods 80 static Transliterator* _create(const UnicodeString& ID, 81 Token context); 82 83 /** 84 * Constructs a transliterator. This method is private. 85 * Public users must use the factory method createInstance(). 86 */ 87 NormalizationTransliterator(const UnicodeString& id, const Normalizer2 &norm2); 88 89 private: 90 /** 91 * Assignment operator. 92 */ 93 NormalizationTransliterator& operator=(const NormalizationTransliterator&); 94 }; 95 96 U_NAMESPACE_END 97 98 #endif /* #if !UCONFIG_NO_TRANSLITERATION */ 99 100 #endif 101