1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html |
3 | /* |
4 | ********************************************************************** |
5 | * Copyright (C) 2001-2007, International Business Machines |
6 | * Corporation and others. All Rights Reserved. |
7 | ********************************************************************** |
8 | * Date Name Description |
9 | * 06/06/01 aliu Creation. |
10 | ********************************************************************** |
11 | */ |
12 | #ifndef UNI2NAME_H |
13 | #define UNI2NAME_H |
14 | |
15 | #include "unicode/utypes.h" |
16 | |
17 | #if !UCONFIG_NO_TRANSLITERATION |
18 | |
19 | #include "unicode/translit.h" |
20 | |
21 | U_NAMESPACE_BEGIN |
22 | |
23 | /** |
24 | * A transliterator that performs character to name mapping. |
25 | * It generates the Perl syntax \N{name}. |
26 | * @author Alan Liu |
27 | */ |
28 | class UnicodeNameTransliterator : public Transliterator { |
29 | |
30 | public: |
31 | |
32 | /** |
33 | * Constructs a transliterator. |
34 | * @param adoptedFilter the filter to be adopted. |
35 | */ |
36 | UnicodeNameTransliterator(UnicodeFilter* adoptedFilter = 0); |
37 | |
38 | /** |
39 | * Destructor. |
40 | */ |
41 | virtual ~UnicodeNameTransliterator(); |
42 | |
43 | /** |
44 | * Copy constructor. |
45 | */ |
46 | UnicodeNameTransliterator(const UnicodeNameTransliterator&); |
47 | |
48 | /** |
49 | * Transliterator API. |
50 | */ |
51 | virtual UnicodeNameTransliterator* clone() const; |
52 | |
53 | /** |
54 | * ICU "poor man's RTTI", returns a UClassID for the actual class. |
55 | */ |
56 | virtual UClassID getDynamicClassID() const; |
57 | |
58 | /** |
59 | * ICU "poor man's RTTI", returns a UClassID for this class. |
60 | */ |
61 | U_I18N_API static UClassID U_EXPORT2 getStaticClassID(); |
62 | |
63 | protected: |
64 | |
65 | /** |
66 | * Implements {@link Transliterator#handleTransliterate}. |
67 | * @param text the buffer holding transliterated and |
68 | * untransliterated text |
69 | * @param offset the start and limit of the text, the position |
70 | * of the cursor, and the start and limit of transliteration. |
71 | * @param incremental if true, assume more text may be coming after |
72 | * pos.contextLimit. Otherwise, assume the text is complete. |
73 | */ |
74 | virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, |
75 | UBool isIncremental) const; |
76 | |
77 | private: |
78 | /** |
79 | * Assignment operator. |
80 | */ |
81 | UnicodeNameTransliterator& operator=(const UnicodeNameTransliterator&); |
82 | |
83 | }; |
84 | |
85 | U_NAMESPACE_END |
86 | |
87 | #endif /* #if !UCONFIG_NO_TRANSLITERATION */ |
88 | |
89 | #endif |
90 | |