xref: /aosp_15_r20/external/icu/libicu/cts_headers/rbt_rule.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 * Copyright (C) {1999-2001}, International Business Machines Corporation and others. All Rights Reserved.
5*0e209d39SAndroid Build Coastguard Worker **********************************************************************
6*0e209d39SAndroid Build Coastguard Worker *   Date        Name        Description
7*0e209d39SAndroid Build Coastguard Worker *   11/17/99    aliu        Creation.
8*0e209d39SAndroid Build Coastguard Worker **********************************************************************
9*0e209d39SAndroid Build Coastguard Worker */
10*0e209d39SAndroid Build Coastguard Worker #ifndef RBT_RULE_H
11*0e209d39SAndroid Build Coastguard Worker #define RBT_RULE_H
12*0e209d39SAndroid Build Coastguard Worker 
13*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
14*0e209d39SAndroid Build Coastguard Worker 
15*0e209d39SAndroid Build Coastguard Worker #if !UCONFIG_NO_TRANSLITERATION
16*0e209d39SAndroid Build Coastguard Worker 
17*0e209d39SAndroid Build Coastguard Worker #include "unicode/uobject.h"
18*0e209d39SAndroid Build Coastguard Worker #include "unicode/unistr.h"
19*0e209d39SAndroid Build Coastguard Worker #include "unicode/utrans.h"
20*0e209d39SAndroid Build Coastguard Worker #include "unicode/unimatch.h"
21*0e209d39SAndroid Build Coastguard Worker 
22*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_BEGIN
23*0e209d39SAndroid Build Coastguard Worker 
24*0e209d39SAndroid Build Coastguard Worker class Replaceable;
25*0e209d39SAndroid Build Coastguard Worker class TransliterationRuleData;
26*0e209d39SAndroid Build Coastguard Worker class StringMatcher;
27*0e209d39SAndroid Build Coastguard Worker class UnicodeFunctor;
28*0e209d39SAndroid Build Coastguard Worker 
29*0e209d39SAndroid Build Coastguard Worker /**
30*0e209d39SAndroid Build Coastguard Worker  * A transliteration rule used by
31*0e209d39SAndroid Build Coastguard Worker  * <code>RuleBasedTransliterator</code>.
32*0e209d39SAndroid Build Coastguard Worker  * <code>TransliterationRule</code> is an immutable object.
33*0e209d39SAndroid Build Coastguard Worker  *
34*0e209d39SAndroid Build Coastguard Worker  * <p>A rule consists of an input pattern and an output string.  When
35*0e209d39SAndroid Build Coastguard Worker  * the input pattern is matched, the output string is emitted.  The
36*0e209d39SAndroid Build Coastguard Worker  * input pattern consists of zero or more characters which are matched
37*0e209d39SAndroid Build Coastguard Worker  * exactly (the key) and optional context.  Context must match if it
38*0e209d39SAndroid Build Coastguard Worker  * is specified.  Context may be specified before the key, after the
39*0e209d39SAndroid Build Coastguard Worker  * key, or both.  The key, preceding context, and following context
40*0e209d39SAndroid Build Coastguard Worker  * may contain variables.  Variables represent a set of Unicode
41*0e209d39SAndroid Build Coastguard Worker  * characters, such as the letters <i>a</i> through <i>z</i>.
42*0e209d39SAndroid Build Coastguard Worker  * Variables are detected by looking up each character in a supplied
43*0e209d39SAndroid Build Coastguard Worker  * variable list to see if it has been so defined.
44*0e209d39SAndroid Build Coastguard Worker  *
45*0e209d39SAndroid Build Coastguard Worker  * <p>A rule may contain segments in its input string and segment
46*0e209d39SAndroid Build Coastguard Worker  * references in its output string.  A segment is a substring of the
47*0e209d39SAndroid Build Coastguard Worker  * input pattern, indicated by an offset and limit.  The segment may
48*0e209d39SAndroid Build Coastguard Worker  * be in the preceding or following context.  It may not span a
49*0e209d39SAndroid Build Coastguard Worker  * context boundary.  A segment reference is a special character in
50*0e209d39SAndroid Build Coastguard Worker  * the output string that causes a segment of the input string (not
51*0e209d39SAndroid Build Coastguard Worker  * the input pattern) to be copied to the output string.  The range of
52*0e209d39SAndroid Build Coastguard Worker  * special characters that represent segment references is defined by
53*0e209d39SAndroid Build Coastguard Worker  * RuleBasedTransliterator.Data.
54*0e209d39SAndroid Build Coastguard Worker  *
55*0e209d39SAndroid Build Coastguard Worker  * @author Alan Liu
56*0e209d39SAndroid Build Coastguard Worker  */
57*0e209d39SAndroid Build Coastguard Worker class TransliterationRule : public UMemory {
58*0e209d39SAndroid Build Coastguard Worker 
59*0e209d39SAndroid Build Coastguard Worker private:
60*0e209d39SAndroid Build Coastguard Worker 
61*0e209d39SAndroid Build Coastguard Worker     // TODO Eliminate the pattern and keyLength data members.  They
62*0e209d39SAndroid Build Coastguard Worker     // are used only by masks() and getIndexValue() which are called
63*0e209d39SAndroid Build Coastguard Worker     // only during build time, not during run-time.  Perhaps these
64*0e209d39SAndroid Build Coastguard Worker     // methods and pattern/keyLength can be isolated into a separate
65*0e209d39SAndroid Build Coastguard Worker     // object.
66*0e209d39SAndroid Build Coastguard Worker 
67*0e209d39SAndroid Build Coastguard Worker     /**
68*0e209d39SAndroid Build Coastguard Worker      * The match that must occur before the key, or null if there is no
69*0e209d39SAndroid Build Coastguard Worker      * preceding context.
70*0e209d39SAndroid Build Coastguard Worker      */
71*0e209d39SAndroid Build Coastguard Worker     StringMatcher *anteContext;
72*0e209d39SAndroid Build Coastguard Worker 
73*0e209d39SAndroid Build Coastguard Worker     /**
74*0e209d39SAndroid Build Coastguard Worker      * The matcher object for the key.  If null, then the key is empty.
75*0e209d39SAndroid Build Coastguard Worker      */
76*0e209d39SAndroid Build Coastguard Worker     StringMatcher *key;
77*0e209d39SAndroid Build Coastguard Worker 
78*0e209d39SAndroid Build Coastguard Worker     /**
79*0e209d39SAndroid Build Coastguard Worker      * The match that must occur after the key, or null if there is no
80*0e209d39SAndroid Build Coastguard Worker      * following context.
81*0e209d39SAndroid Build Coastguard Worker      */
82*0e209d39SAndroid Build Coastguard Worker     StringMatcher *postContext;
83*0e209d39SAndroid Build Coastguard Worker 
84*0e209d39SAndroid Build Coastguard Worker     /**
85*0e209d39SAndroid Build Coastguard Worker      * The object that performs the replacement if the key,
86*0e209d39SAndroid Build Coastguard Worker      * anteContext, and postContext are matched.  Never null.
87*0e209d39SAndroid Build Coastguard Worker      */
88*0e209d39SAndroid Build Coastguard Worker     UnicodeFunctor* output;
89*0e209d39SAndroid Build Coastguard Worker 
90*0e209d39SAndroid Build Coastguard Worker     /**
91*0e209d39SAndroid Build Coastguard Worker      * The string that must be matched, consisting of the anteContext, key,
92*0e209d39SAndroid Build Coastguard Worker      * and postContext, concatenated together, in that order.  Some components
93*0e209d39SAndroid Build Coastguard Worker      * may be empty (zero length).
94*0e209d39SAndroid Build Coastguard Worker      * @see anteContextLength
95*0e209d39SAndroid Build Coastguard Worker      * @see keyLength
96*0e209d39SAndroid Build Coastguard Worker      */
97*0e209d39SAndroid Build Coastguard Worker     UnicodeString pattern;
98*0e209d39SAndroid Build Coastguard Worker 
99*0e209d39SAndroid Build Coastguard Worker     /**
100*0e209d39SAndroid Build Coastguard Worker      * An array of matcher objects corresponding to the input pattern
101*0e209d39SAndroid Build Coastguard Worker      * segments.  If there are no segments this is null.  N.B. This is
102*0e209d39SAndroid Build Coastguard Worker      * a UnicodeMatcher for generality, but in practice it is always a
103*0e209d39SAndroid Build Coastguard Worker      * StringMatcher.  In the future we may generalize this, but for
104*0e209d39SAndroid Build Coastguard Worker      * now we sometimes cast down to StringMatcher.
105*0e209d39SAndroid Build Coastguard Worker      *
106*0e209d39SAndroid Build Coastguard Worker      * The array is owned, but the pointers within it are not.
107*0e209d39SAndroid Build Coastguard Worker      */
108*0e209d39SAndroid Build Coastguard Worker     UnicodeFunctor** segments;
109*0e209d39SAndroid Build Coastguard Worker 
110*0e209d39SAndroid Build Coastguard Worker     /**
111*0e209d39SAndroid Build Coastguard Worker      * The number of elements in segments[] or zero if segments is nullptr.
112*0e209d39SAndroid Build Coastguard Worker      */
113*0e209d39SAndroid Build Coastguard Worker     int32_t segmentsCount;
114*0e209d39SAndroid Build Coastguard Worker 
115*0e209d39SAndroid Build Coastguard Worker     /**
116*0e209d39SAndroid Build Coastguard Worker      * The length of the string that must match before the key.  If
117*0e209d39SAndroid Build Coastguard Worker      * zero, then there is no matching requirement before the key.
118*0e209d39SAndroid Build Coastguard Worker      * Substring [0,anteContextLength) of pattern is the anteContext.
119*0e209d39SAndroid Build Coastguard Worker      */
120*0e209d39SAndroid Build Coastguard Worker     int32_t anteContextLength;
121*0e209d39SAndroid Build Coastguard Worker 
122*0e209d39SAndroid Build Coastguard Worker     /**
123*0e209d39SAndroid Build Coastguard Worker      * The length of the key.  Substring [anteContextLength,
124*0e209d39SAndroid Build Coastguard Worker      * anteContextLength + keyLength) is the key.
125*0e209d39SAndroid Build Coastguard Worker 
126*0e209d39SAndroid Build Coastguard Worker      */
127*0e209d39SAndroid Build Coastguard Worker     int32_t keyLength;
128*0e209d39SAndroid Build Coastguard Worker 
129*0e209d39SAndroid Build Coastguard Worker     /**
130*0e209d39SAndroid Build Coastguard Worker      * Miscellaneous attributes.
131*0e209d39SAndroid Build Coastguard Worker      */
132*0e209d39SAndroid Build Coastguard Worker     int8_t flags;
133*0e209d39SAndroid Build Coastguard Worker 
134*0e209d39SAndroid Build Coastguard Worker     /**
135*0e209d39SAndroid Build Coastguard Worker      * Flag attributes.
136*0e209d39SAndroid Build Coastguard Worker      */
137*0e209d39SAndroid Build Coastguard Worker     enum {
138*0e209d39SAndroid Build Coastguard Worker         ANCHOR_START = 1,
139*0e209d39SAndroid Build Coastguard Worker         ANCHOR_END   = 2
140*0e209d39SAndroid Build Coastguard Worker     };
141*0e209d39SAndroid Build Coastguard Worker 
142*0e209d39SAndroid Build Coastguard Worker     /**
143*0e209d39SAndroid Build Coastguard Worker      * An alias pointer to the data for this rule.  The data provides
144*0e209d39SAndroid Build Coastguard Worker      * lookup services for matchers and segments.
145*0e209d39SAndroid Build Coastguard Worker      */
146*0e209d39SAndroid Build Coastguard Worker     const TransliterationRuleData* data;
147*0e209d39SAndroid Build Coastguard Worker 
148*0e209d39SAndroid Build Coastguard Worker public:
149*0e209d39SAndroid Build Coastguard Worker 
150*0e209d39SAndroid Build Coastguard Worker     /**
151*0e209d39SAndroid Build Coastguard Worker      * Construct a new rule with the given input, output text, and other
152*0e209d39SAndroid Build Coastguard Worker      * attributes.  A cursor position may be specified for the output text.
153*0e209d39SAndroid Build Coastguard Worker      * @param input          input string, including key and optional ante and
154*0e209d39SAndroid Build Coastguard Worker      *                       post context.
155*0e209d39SAndroid Build Coastguard Worker      * @param anteContextPos offset into input to end of ante context, or -1 if
156*0e209d39SAndroid Build Coastguard Worker      *                       none.  Must be <= input.length() if not -1.
157*0e209d39SAndroid Build Coastguard Worker      * @param postContextPos offset into input to start of post context, or -1
158*0e209d39SAndroid Build Coastguard Worker      *                       if none.  Must be <= input.length() if not -1, and must be >=
159*0e209d39SAndroid Build Coastguard Worker      *                       anteContextPos.
160*0e209d39SAndroid Build Coastguard Worker      * @param outputStr      output string.
161*0e209d39SAndroid Build Coastguard Worker      * @param cursorPosition offset into output at which cursor is located, or -1 if
162*0e209d39SAndroid Build Coastguard Worker      *                       none.  If less than zero, then the cursor is placed after the
163*0e209d39SAndroid Build Coastguard Worker      *                       <code>output</code>; that is, -1 is equivalent to
164*0e209d39SAndroid Build Coastguard Worker      *                       <code>output.length()</code>.  If greater than
165*0e209d39SAndroid Build Coastguard Worker      *                       <code>output.length()</code> then an exception is thrown.
166*0e209d39SAndroid Build Coastguard Worker      * @param cursorOffset   an offset to be added to cursorPos to position the
167*0e209d39SAndroid Build Coastguard Worker      *                       cursor either in the ante context, if < 0, or in the post context, if >
168*0e209d39SAndroid Build Coastguard Worker      *                       0.  For example, the rule "abc{def} > | @@@ xyz;" changes "def" to
169*0e209d39SAndroid Build Coastguard Worker      *                       "xyz" and moves the cursor to before "a".  It would have a cursorOffset
170*0e209d39SAndroid Build Coastguard Worker      *                       of -3.
171*0e209d39SAndroid Build Coastguard Worker      * @param segs           array of UnicodeMatcher corresponding to input pattern
172*0e209d39SAndroid Build Coastguard Worker      *                       segments, or null if there are none.  The array itself is adopted,
173*0e209d39SAndroid Build Coastguard Worker      *                       but the pointers within it are not.
174*0e209d39SAndroid Build Coastguard Worker      * @param segsCount      number of elements in segs[].
175*0e209d39SAndroid Build Coastguard Worker      * @param anchorStart    true if the the rule is anchored on the left to
176*0e209d39SAndroid Build Coastguard Worker      *                       the context start.
177*0e209d39SAndroid Build Coastguard Worker      * @param anchorEnd      true if the rule is anchored on the right to the
178*0e209d39SAndroid Build Coastguard Worker      *                       context limit.
179*0e209d39SAndroid Build Coastguard Worker      * @param data           the rule data.
180*0e209d39SAndroid Build Coastguard Worker      * @param status         Output parameter filled in with success or failure status.
181*0e209d39SAndroid Build Coastguard Worker      */
182*0e209d39SAndroid Build Coastguard Worker     TransliterationRule(const UnicodeString& input,
183*0e209d39SAndroid Build Coastguard Worker                         int32_t anteContextPos, int32_t postContextPos,
184*0e209d39SAndroid Build Coastguard Worker                         const UnicodeString& outputStr,
185*0e209d39SAndroid Build Coastguard Worker                         int32_t cursorPosition, int32_t cursorOffset,
186*0e209d39SAndroid Build Coastguard Worker                         UnicodeFunctor** segs,
187*0e209d39SAndroid Build Coastguard Worker                         int32_t segsCount,
188*0e209d39SAndroid Build Coastguard Worker                         UBool anchorStart, UBool anchorEnd,
189*0e209d39SAndroid Build Coastguard Worker                         const TransliterationRuleData* data,
190*0e209d39SAndroid Build Coastguard Worker                         UErrorCode& status);
191*0e209d39SAndroid Build Coastguard Worker 
192*0e209d39SAndroid Build Coastguard Worker     /**
193*0e209d39SAndroid Build Coastguard Worker      * Copy constructor.
194*0e209d39SAndroid Build Coastguard Worker      * @param other    the object to be copied.
195*0e209d39SAndroid Build Coastguard Worker      */
196*0e209d39SAndroid Build Coastguard Worker     TransliterationRule(TransliterationRule& other);
197*0e209d39SAndroid Build Coastguard Worker 
198*0e209d39SAndroid Build Coastguard Worker     /**
199*0e209d39SAndroid Build Coastguard Worker      * Destructor.
200*0e209d39SAndroid Build Coastguard Worker      */
201*0e209d39SAndroid Build Coastguard Worker     virtual ~TransliterationRule();
202*0e209d39SAndroid Build Coastguard Worker 
203*0e209d39SAndroid Build Coastguard Worker     /**
204*0e209d39SAndroid Build Coastguard Worker      * Change the data object that this rule belongs to.  Used
205*0e209d39SAndroid Build Coastguard Worker      * internally by the TransliterationRuleData copy constructor.
206*0e209d39SAndroid Build Coastguard Worker      * @param data    the new data value to be set.
207*0e209d39SAndroid Build Coastguard Worker      */
208*0e209d39SAndroid Build Coastguard Worker     void setData(const TransliterationRuleData* data);
209*0e209d39SAndroid Build Coastguard Worker 
210*0e209d39SAndroid Build Coastguard Worker     /**
211*0e209d39SAndroid Build Coastguard Worker      * Return the preceding context length.  This method is needed to
212*0e209d39SAndroid Build Coastguard Worker      * support the <code>Transliterator</code> method
213*0e209d39SAndroid Build Coastguard Worker      * <code>getMaximumContextLength()</code>.  Internally, this is
214*0e209d39SAndroid Build Coastguard Worker      * implemented as the anteContextLength, optionally plus one if
215*0e209d39SAndroid Build Coastguard Worker      * there is a start anchor.  The one character anchor gap is
216*0e209d39SAndroid Build Coastguard Worker      * needed to make repeated incremental transliteration with
217*0e209d39SAndroid Build Coastguard Worker      * anchors work.
218*0e209d39SAndroid Build Coastguard Worker      * @return    the preceding context length.
219*0e209d39SAndroid Build Coastguard Worker      */
220*0e209d39SAndroid Build Coastguard Worker     virtual int32_t getContextLength() const;
221*0e209d39SAndroid Build Coastguard Worker 
222*0e209d39SAndroid Build Coastguard Worker     /**
223*0e209d39SAndroid Build Coastguard Worker      * Internal method.  Returns 8-bit index value for this rule.
224*0e209d39SAndroid Build Coastguard Worker      * This is the low byte of the first character of the key,
225*0e209d39SAndroid Build Coastguard Worker      * unless the first character of the key is a set.  If it's a
226*0e209d39SAndroid Build Coastguard Worker      * set, or otherwise can match multiple keys, the index value is -1.
227*0e209d39SAndroid Build Coastguard Worker      * @return    8-bit index value for this rule.
228*0e209d39SAndroid Build Coastguard Worker      */
229*0e209d39SAndroid Build Coastguard Worker     int16_t getIndexValue() const;
230*0e209d39SAndroid Build Coastguard Worker 
231*0e209d39SAndroid Build Coastguard Worker     /**
232*0e209d39SAndroid Build Coastguard Worker      * Internal method.  Returns true if this rule matches the given
233*0e209d39SAndroid Build Coastguard Worker      * index value.  The index value is an 8-bit integer, 0..255,
234*0e209d39SAndroid Build Coastguard Worker      * representing the low byte of the first character of the key.
235*0e209d39SAndroid Build Coastguard Worker      * It matches this rule if it matches the first character of the
236*0e209d39SAndroid Build Coastguard Worker      * key, or if the first character of the key is a set, and the set
237*0e209d39SAndroid Build Coastguard Worker      * contains any character with a low byte equal to the index
238*0e209d39SAndroid Build Coastguard Worker      * value.  If the rule contains only ante context, as in foo)>bar,
239*0e209d39SAndroid Build Coastguard Worker      * then it will match any key.
240*0e209d39SAndroid Build Coastguard Worker      * @param v    the given index value.
241*0e209d39SAndroid Build Coastguard Worker      * @return     true if this rule matches the given index value.
242*0e209d39SAndroid Build Coastguard Worker      */
243*0e209d39SAndroid Build Coastguard Worker     UBool matchesIndexValue(uint8_t v) const;
244*0e209d39SAndroid Build Coastguard Worker 
245*0e209d39SAndroid Build Coastguard Worker     /**
246*0e209d39SAndroid Build Coastguard Worker      * Return true if this rule masks another rule.  If r1 masks r2 then
247*0e209d39SAndroid Build Coastguard Worker      * r1 matches any input string that r2 matches.  If r1 masks r2 and r2 masks
248*0e209d39SAndroid Build Coastguard Worker      * r1 then r1 == r2.  Examples: "a>x" masks "ab>y".  "a>x" masks "a[b]>y".
249*0e209d39SAndroid Build Coastguard Worker      * "[c]a>x" masks "[dc]a>y".
250*0e209d39SAndroid Build Coastguard Worker      * @param r2  the given rule to be compared with.
251*0e209d39SAndroid Build Coastguard Worker      * @return    true if this rule masks 'r2'
252*0e209d39SAndroid Build Coastguard Worker      */
253*0e209d39SAndroid Build Coastguard Worker     virtual UBool masks(const TransliterationRule& r2) const;
254*0e209d39SAndroid Build Coastguard Worker 
255*0e209d39SAndroid Build Coastguard Worker     /**
256*0e209d39SAndroid Build Coastguard Worker      * Attempt a match and replacement at the given position.  Return
257*0e209d39SAndroid Build Coastguard Worker      * the degree of match between this rule and the given text.  The
258*0e209d39SAndroid Build Coastguard Worker      * degree of match may be mismatch, a partial match, or a full
259*0e209d39SAndroid Build Coastguard Worker      * match.  A mismatch means at least one character of the text
260*0e209d39SAndroid Build Coastguard Worker      * does not match the context or key.  A partial match means some
261*0e209d39SAndroid Build Coastguard Worker      * context and key characters match, but the text is not long
262*0e209d39SAndroid Build Coastguard Worker      * enough to match all of them.  A full match means all context
263*0e209d39SAndroid Build Coastguard Worker      * and key characters match.
264*0e209d39SAndroid Build Coastguard Worker      *
265*0e209d39SAndroid Build Coastguard Worker      * If a full match is obtained, perform a replacement, update pos,
266*0e209d39SAndroid Build Coastguard Worker      * and return U_MATCH.  Otherwise both text and pos are unchanged.
267*0e209d39SAndroid Build Coastguard Worker      *
268*0e209d39SAndroid Build Coastguard Worker      * @param text the text
269*0e209d39SAndroid Build Coastguard Worker      * @param pos the position indices
270*0e209d39SAndroid Build Coastguard Worker      * @param incremental if true, test for partial matches that may
271*0e209d39SAndroid Build Coastguard Worker      * be completed by additional text inserted at pos.limit.
272*0e209d39SAndroid Build Coastguard Worker      * @return one of <code>U_MISMATCH</code>,
273*0e209d39SAndroid Build Coastguard Worker      * <code>U_PARTIAL_MATCH</code>, or <code>U_MATCH</code>.  If
274*0e209d39SAndroid Build Coastguard Worker      * incremental is false then U_PARTIAL_MATCH will not be returned.
275*0e209d39SAndroid Build Coastguard Worker      */
276*0e209d39SAndroid Build Coastguard Worker     UMatchDegree matchAndReplace(Replaceable& text,
277*0e209d39SAndroid Build Coastguard Worker                                  UTransPosition& pos,
278*0e209d39SAndroid Build Coastguard Worker                                  UBool incremental) const;
279*0e209d39SAndroid Build Coastguard Worker 
280*0e209d39SAndroid Build Coastguard Worker     /**
281*0e209d39SAndroid Build Coastguard Worker      * Create a rule string that represents this rule object.  Append
282*0e209d39SAndroid Build Coastguard Worker      * it to the given string.
283*0e209d39SAndroid Build Coastguard Worker      */
284*0e209d39SAndroid Build Coastguard Worker     virtual UnicodeString& toRule(UnicodeString& pat,
285*0e209d39SAndroid Build Coastguard Worker                                   UBool escapeUnprintable) const;
286*0e209d39SAndroid Build Coastguard Worker 
287*0e209d39SAndroid Build Coastguard Worker     /**
288*0e209d39SAndroid Build Coastguard Worker      * Union the set of all characters that may be modified by this rule
289*0e209d39SAndroid Build Coastguard Worker      * into the given set.
290*0e209d39SAndroid Build Coastguard Worker      */
291*0e209d39SAndroid Build Coastguard Worker     void addSourceSetTo(UnicodeSet& toUnionTo) const;
292*0e209d39SAndroid Build Coastguard Worker 
293*0e209d39SAndroid Build Coastguard Worker     /**
294*0e209d39SAndroid Build Coastguard Worker      * Union the set of all characters that may be emitted by this rule
295*0e209d39SAndroid Build Coastguard Worker      * into the given set.
296*0e209d39SAndroid Build Coastguard Worker      */
297*0e209d39SAndroid Build Coastguard Worker     void addTargetSetTo(UnicodeSet& toUnionTo) const;
298*0e209d39SAndroid Build Coastguard Worker 
299*0e209d39SAndroid Build Coastguard Worker  private:
300*0e209d39SAndroid Build Coastguard Worker 
301*0e209d39SAndroid Build Coastguard Worker     friend class StringMatcher;
302*0e209d39SAndroid Build Coastguard Worker 
303*0e209d39SAndroid Build Coastguard Worker     TransliterationRule &operator=(const TransliterationRule &other); // forbid copying of this class
304*0e209d39SAndroid Build Coastguard Worker };
305*0e209d39SAndroid Build Coastguard Worker 
306*0e209d39SAndroid Build Coastguard Worker U_NAMESPACE_END
307*0e209d39SAndroid Build Coastguard Worker 
308*0e209d39SAndroid Build Coastguard Worker #endif /* #if !UCONFIG_NO_TRANSLITERATION */
309*0e209d39SAndroid Build Coastguard Worker 
310*0e209d39SAndroid Build Coastguard Worker #endif
311