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