2
**********************************************************************
3
* Copyright (C) 1999-2002, International Business Machines
4
* Corporation and others. All Rights Reserved.
5
**********************************************************************
6
* Date Name Description
7
* 11/17/99 aliu Creation.
8
**********************************************************************
13
#include "unicode/translit.h"
17
class U_I18N_API UVector;
18
class TransliteratorRegistry;
21
* A transliterator that is composed of two or more other
22
* transliterator objects linked together. For example, if one
23
* transliterator transliterates from script A to script B, and
24
* another transliterates from script B to script C, the two may be
25
* combined to form a new transliterator from A to C.
27
* <p>Composed transliterators may not behave as expected. For
28
* example, inverses may not combine to form the identity
29
* transliterator. See the class documentation for {@link
30
* Transliterator} for details.
32
* <p>Copyright © IBM Corporation 1999. All rights reserved.
35
* @deprecated To be removed after 2002-sep-30.
37
class U_I18N_API CompoundTransliterator : public Transliterator {
39
Transliterator** trans;
44
* For compound RBTs (those with an ::id block before and/or after
45
* the main rule block) we record the index of the RBT here.
46
* Otherwise, this should have a value of -1. We need this
47
* information to implement toRules().
49
int32_t compoundRBTIndex;
54
* Constructs a new compound transliterator given an array of
55
* transliterators. The array of transliterators may be of any
56
* length, including zero or one, however, useful compound
57
* transliterators have at least two components.
58
* @param transliterators array of <code>Transliterator</code>
60
* @param transliteratorCount The number of
61
* <code>Transliterator</code> objects in transliterators.
62
* @param filter the filter. Any character for which
63
* <tt>filter.contains()</tt> returns <tt>false</tt> will not be
64
* altered by this transliterator. If <tt>filter</tt> is
65
* <tt>null</tt> then no filtering is applied.
66
* @deprecated To be removed after 2002-sep-30; use the Transliterator::createInstance factory method.
68
CompoundTransliterator(Transliterator* const transliterators[],
69
int32_t transliteratorCount,
70
UnicodeFilter* adoptedFilter = 0);
73
* Constructs a new compound transliterator.
74
* @param id compound ID
75
* @param dir either UTRANS_FORWARD or UTRANS_REVERSE
76
* @param adoptedFilter a global filter for this compound transliterator
78
* @deprecated To be removed after 2002-sep-30; use the Transliterator::createInstance factory method.
80
CompoundTransliterator(const UnicodeString& id,
82
UnicodeFilter* adoptedFilter,
83
UParseError& parseError,
87
* Constructs a new compound transliterator in the FORWARD
88
* direction with a NULL filter.
89
* @deprecated To be removed after 2002-sep-30; use the Transliterator::createInstance factory method.
91
CompoundTransliterator(const UnicodeString& id,
92
UParseError& parseError,
96
* @deprecated To be removed after 2002-sep-30.
98
virtual ~CompoundTransliterator();
102
* @deprecated To be removed after 2002-sep-30; use the Transliterator::createInstance factory method.
104
CompoundTransliterator(const CompoundTransliterator&);
107
* Assignment operator.
108
* @deprecated To be removed after 2002-sep-30.
110
CompoundTransliterator& operator=(const CompoundTransliterator&);
113
* Transliterator API.
114
* @deprecated To be removed after 2002-sep-30.
116
Transliterator* clone(void) const;
119
* Returns the number of transliterators in this chain.
120
* @return number of transliterators in this chain.
121
* @deprecated To be removed after 2002-sep-30.
123
virtual int32_t getCount(void) const;
126
* Returns the transliterator at the given index in this chain.
127
* @param index index into chain, from 0 to <code>getCount() - 1</code>
128
* @return transliterator at the given index
129
* @deprecated To be removed after 2002-sep-30.
131
virtual const Transliterator& getTransliterator(int32_t index) const;
134
* Sets the transliterators.
135
* @deprecated To be removed after 2002-sep-30.
137
void setTransliterators(Transliterator* const transliterators[],
141
* Adopts the transliterators.
142
* @deprecated To be removed after 2002-sep-30.
144
void adoptTransliterators(Transliterator* adoptedTransliterators[],
148
* Override Transliterator:
149
* Create a rule string that can be passed to createFromRules()
150
* to recreate this transliterator.
151
* @param result the string to receive the rules. Previous
152
* contents will be deleted.
153
* @param escapeUnprintable if TRUE then convert unprintable
154
* character to their hex escape representations, \uxxxx or
155
* \Uxxxxxxxx. Unprintable characters are those other than
156
* U+000A, U+0020..U+007E.
157
* @deprecated To be removed after 2002-sep-30.
159
virtual UnicodeString& toRules(UnicodeString& result,
160
UBool escapeUnprintable) const;
163
* Implements {@link Transliterator#handleTransliterate}.
164
* @deprecated To be removed after 2002-sep-30.
166
virtual void handleTransliterate(Replaceable& text, UTransPosition& index,
167
UBool incremental) const;
171
friend class Transliterator;
172
friend class TransliteratorAlias; // to access private ct
175
* Private constructor for compound RBTs. Construct a compound
176
* transliterator using the given idBlock, with the adoptedTrans
177
* inserted at the idSplitPoint.
179
CompoundTransliterator(const UnicodeString& ID,
180
const UnicodeString& idBlock,
181
int32_t idSplitPoint,
182
Transliterator *adoptedTrans,
186
* Private constructor for Transliterator.
188
CompoundTransliterator(UVector& list,
189
UParseError& parseError,
192
void init(const UnicodeString& id,
193
UTransDirection direction,
194
int32_t idSplitPoint,
195
Transliterator *adoptedRbt,
199
void init(UVector& list,
200
UTransDirection direction,
205
* Return the IDs of the given list of transliterators, concatenated
206
* with ';' delimiting them. Equivalent to the perlish expression
207
* join(';', map($_.getID(), transliterators).
209
UnicodeString joinIDs(Transliterator* const transliterators[],
212
void freeTransliterators(void);
214
void computeMaximumContextLength(void);
217
#ifdef U_USE_DEPRECATED_TRANSLITERATOR_API
222
* Constructs a new compound transliterator.
223
* Use Transliterator::createInstance factory method.
224
* @param filter the filter. Any character for which
225
* <tt>filter.isIn()</tt> returns <tt>false</tt> will not be
226
* altered by this transliterator. If <tt>filter</tt> is
227
* <tt>null</tt> then no filtering is applied.
228
* @deprecated Remove after Aug 2002. Use the constructor that takes
229
* UParseError as one of the paramerters.
231
CompoundTransliterator(const UnicodeString& id,
233
UnicodeFilter* adoptedFilter,
237
* Constructs a new compound transliterator in the FORWARD
238
* direction with a NULL filter.
239
* Use Transliterator::createInstance factory method.
240
* @deprecated Remove after Aug 2002. Use the constructor that takes
241
* UParseError as one of the parmeters.
243
CompoundTransliterator(const UnicodeString& id,
250
* Definitions for deprecated API
251
* @deprecated Remove after Aug 2002
254
#ifdef U_USE_DEPRECATED_TRANSLITERATOR_API
256
inline CompoundTransliterator::CompoundTransliterator( const UnicodeString& id,
258
UnicodeFilter* adoptedFilter,
260
Transliterator(id, adoptedFilter),
261
trans(0), compoundRBTIndex(-1) {
262
UParseError parseError;
263
init(id, dir, -1, 0, TRUE,parseError,status);
266
inline CompoundTransliterator::CompoundTransliterator(const UnicodeString& id,
267
UErrorCode& status) :
268
Transliterator(id, 0), // set filter to 0 here!
269
trans(0), compoundRBTIndex(-1) {
270
UParseError parseError;
271
init(id, UTRANS_FORWARD, -1, 0, TRUE,parseError,status);