2
**********************************************************************
3
* Copyright (c) 2001-2004, International Business Machines
4
* Corporation and others. All Rights Reserved.
5
**********************************************************************
6
* Date Name Description
7
* 11/20/2001 aliu Creation.
8
**********************************************************************
13
#include "unicode/utypes.h"
15
#if !UCONFIG_NO_TRANSLITERATION
17
#include "unicode/translit.h"
22
* A transliterator that converts Unicode characters to an escape
23
* form. Examples of escape forms are "U+4E01" and "".
24
* Escape forms have a prefix and suffix, either of which may be
25
* empty, a radix, typically 16 or 10, a minimum digit count,
26
* typically 1, 4, or 8, and a boolean that specifies whether
27
* supplemental characters are handled as 32-bit code points or as two
28
* 16-bit code units. Most escape forms handle 32-bit code points,
29
* but some, such as the Java form, intentionally break them into two
30
* surrogate pairs, for backward compatibility.
32
* <p>Some escape forms actually have two different patterns, one for
33
* BMP characters (0..FFFF) and one for supplements (>FFFF). To
34
* handle this, a second EscapeTransliterator may be defined that
35
* specifies the pattern to be produced for supplementals. An example
36
* of a form that requires this is the C form, which uses "\\uFFFF"
37
* for BMP characters and "\\U0010FFFF" for supplementals.
39
* <p>This class is package private. It registers several standard
40
* variants with the system which are then accessed via their IDs.
44
class U_I18N_API EscapeTransliterator : public Transliterator {
49
* The prefix of the escape form; may be empty, but usually isn't.
54
* The prefix of the escape form; often empty.
59
* The radix to display the number in. Typically 16 or 10. Must
60
* be in the range 2 to 36.
65
* The minimum number of digits. Typically 1, 4, or 8. Values
66
* less than 1 are equivalent to 1.
71
* If true, supplementals are handled as 32-bit code points. If
72
* false, they are handled as two 16-bit code units.
74
UBool grokSupplementals;
77
* The form to be used for supplementals. If this is null then
78
* the same form is used for BMP characters and supplementals. If
79
* this is not null and if grokSupplementals is true then the
80
* prefix, suffix, radix, and minDigits of this object are used
81
* for supplementals. This pointer is owned.
83
EscapeTransliterator* supplementalHandler;
88
* Registers standard variants with the system. Called by
89
* Transliterator during initialization.
91
static void registerIDs();
94
* Constructs an escape transliterator with the given ID and
95
* parameters. See the class member documentation for details.
97
EscapeTransliterator(const UnicodeString& ID,
98
const UnicodeString& prefix, const UnicodeString& suffix,
99
int32_t radix, int32_t minDigits,
100
UBool grokSupplementals,
101
EscapeTransliterator* adoptedSupplementalHandler);
106
EscapeTransliterator(const EscapeTransliterator&);
111
virtual ~EscapeTransliterator();
114
* Transliterator API.
116
virtual Transliterator* clone() const;
119
* ICU "poor man's RTTI", returns a UClassID for the actual class.
123
virtual UClassID getDynamicClassID() const;
126
* ICU "poor man's RTTI", returns a UClassID for this class.
130
static UClassID U_EXPORT2 getStaticClassID();
135
* Implements {@link Transliterator#handleTransliterate}.
137
virtual void handleTransliterate(Replaceable& text, UTransPosition& offset,
138
UBool isIncremental) const;
144
#endif /* #if !UCONFIG_NO_TRANSLITERATION */