xref: /aosp_15_r20/external/icu/libicu/cts_headers/name2uni.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-2007, 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 *   06/07/01    aliu        Creation.
10*0e209d39SAndroid Build Coastguard Worker **********************************************************************
11*0e209d39SAndroid Build Coastguard Worker */
12*0e209d39SAndroid Build Coastguard Worker #ifndef NAME2UNI_H
13*0e209d39SAndroid Build Coastguard Worker #define NAME2UNI_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/uniset.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 name to character mapping.
26*0e209d39SAndroid Build Coastguard Worker  * It recognizes the Perl syntax \N{name}.
27*0e209d39SAndroid Build Coastguard Worker  * @author Alan Liu
28*0e209d39SAndroid Build Coastguard Worker  */
29*0e209d39SAndroid Build Coastguard Worker class NameUnicodeTransliterator : public Transliterator {
30*0e209d39SAndroid Build Coastguard Worker public:
31*0e209d39SAndroid Build Coastguard Worker 
32*0e209d39SAndroid Build Coastguard Worker     /**
33*0e209d39SAndroid Build Coastguard Worker      * Constructs a transliterator.
34*0e209d39SAndroid Build Coastguard Worker      * @param adoptedFilter    the filter for this transliterator.
35*0e209d39SAndroid Build Coastguard Worker      */
36*0e209d39SAndroid Build Coastguard Worker     NameUnicodeTransliterator(UnicodeFilter* adoptedFilter = nullptr);
37*0e209d39SAndroid Build Coastguard Worker 
38*0e209d39SAndroid Build Coastguard Worker     /**
39*0e209d39SAndroid Build Coastguard Worker      * Destructor.
40*0e209d39SAndroid Build Coastguard Worker      */
41*0e209d39SAndroid Build Coastguard Worker     virtual ~NameUnicodeTransliterator();
42*0e209d39SAndroid Build Coastguard Worker 
43*0e209d39SAndroid Build Coastguard Worker     /**
44*0e209d39SAndroid Build Coastguard Worker      * Copy constructor.
45*0e209d39SAndroid Build Coastguard Worker      */
46*0e209d39SAndroid Build Coastguard Worker     NameUnicodeTransliterator(const NameUnicodeTransliterator&);
47*0e209d39SAndroid Build Coastguard Worker 
48*0e209d39SAndroid Build Coastguard Worker     /**
49*0e209d39SAndroid Build Coastguard Worker      * Transliterator API.
50*0e209d39SAndroid Build Coastguard Worker      * @return    A copy of the object.
51*0e209d39SAndroid Build Coastguard Worker      */
52*0e209d39SAndroid Build Coastguard Worker     virtual NameUnicodeTransliterator* clone() 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 the actual class.
56*0e209d39SAndroid Build Coastguard Worker      */
57*0e209d39SAndroid Build Coastguard Worker     virtual UClassID getDynamicClassID() const override;
58*0e209d39SAndroid Build Coastguard Worker 
59*0e209d39SAndroid Build Coastguard Worker     /**
60*0e209d39SAndroid Build Coastguard Worker      * ICU "poor man's RTTI", returns a UClassID for this class.
61*0e209d39SAndroid Build Coastguard Worker      */
62*0e209d39SAndroid Build Coastguard Worker     U_I18N_API static UClassID U_EXPORT2 getStaticClassID();
63*0e209d39SAndroid Build Coastguard Worker 
64*0e209d39SAndroid Build Coastguard Worker  protected:
65*0e209d39SAndroid Build Coastguard Worker 
66*0e209d39SAndroid Build Coastguard Worker     /**
67*0e209d39SAndroid Build Coastguard Worker      * Implements {@link Transliterator#handleTransliterate}.
68*0e209d39SAndroid Build Coastguard Worker      * @param text          the buffer holding transliterated and
69*0e209d39SAndroid Build Coastguard Worker      *                      untransliterated text
70*0e209d39SAndroid Build Coastguard Worker      * @param offset        the start and limit of the text, the position
71*0e209d39SAndroid Build Coastguard Worker      *                      of the cursor, and the start and limit of transliteration.
72*0e209d39SAndroid Build Coastguard Worker      * @param incremental   if true, assume more text may be coming after
73*0e209d39SAndroid Build Coastguard Worker      *                      pos.contextLimit. Otherwise, assume the text is complete.
74*0e209d39SAndroid Build Coastguard Worker      */
75*0e209d39SAndroid Build Coastguard Worker     virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
76*0e209d39SAndroid Build Coastguard Worker                                      UBool isIncremental) const override;
77*0e209d39SAndroid Build Coastguard Worker 
78*0e209d39SAndroid Build Coastguard Worker     /**
79*0e209d39SAndroid Build Coastguard Worker      * Set of characters which occur in Unicode character names.
80*0e209d39SAndroid Build Coastguard Worker      */
81*0e209d39SAndroid Build Coastguard Worker     UnicodeSet legal;
82*0e209d39SAndroid Build Coastguard Worker private:
83*0e209d39SAndroid Build Coastguard Worker     /**
84*0e209d39SAndroid Build Coastguard Worker      * Assignment operator.
85*0e209d39SAndroid Build Coastguard Worker      */
86*0e209d39SAndroid Build Coastguard Worker     NameUnicodeTransliterator& operator=(const NameUnicodeTransliterator&);
87*0e209d39SAndroid Build Coastguard Worker };
88*0e209d39SAndroid Build Coastguard Worker 
89*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END
90*0e209d39SAndroid Build Coastguard Worker 
91*0e209d39SAndroid Build Coastguard Worker #endif /* #if !UCONFIG_NO_TRANSLITERATION */
92*0e209d39SAndroid Build Coastguard Worker 
93*0e209d39SAndroid Build Coastguard Worker #endif
94