2 **********************************************************************
3 * Copyright (c) 2002-2004, International Business Machines Corporation
4 * and others. All Rights Reserved.
5 **********************************************************************
6 * Date Name Description
7 * 02/04/2002 aliu Creation.
8 **********************************************************************
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_TRANSLITERATION
15 #include "unicode/unifunct.h"
16 #include "unicode/unirepl.h"
23 * A replacer that calls a transliterator to generate its output text.
24 * The input text to the transliterator is the output of another
25 * UnicodeReplacer object. That is, this replacer wraps another
26 * replacer with a transliterator.
28 * Added U_I18N_API to make the definition of a global operator delete work.
29 * See Jitterbug 2581. markus 2002dec17
33 class U_I18N_API FunctionReplacer
: public UnicodeFunctor
, public UnicodeReplacer
{
38 * The transliterator. Must not be null. OWNED.
40 Transliterator
* translit
;
43 * The replacer object. This generates text that is then
44 * processed by 'translit'. Must not be null. OWNED.
46 UnicodeFunctor
* replacer
;
51 * Construct a replacer that takes the output of the given
52 * replacer, passes it through the given transliterator, and emits
53 * the result as output.
55 FunctionReplacer(Transliterator
* adoptedTranslit
,
56 UnicodeFunctor
* adoptedReplacer
);
61 FunctionReplacer(const FunctionReplacer
& other
);
66 virtual ~FunctionReplacer();
69 * Implement UnicodeFunctor
71 virtual UnicodeFunctor
* clone() const;
74 * UnicodeFunctor API. Cast 'this' to a UnicodeReplacer* pointer
75 * and return the pointer.
77 virtual UnicodeReplacer
* toReplacer() const;
82 virtual int32_t replace(Replaceable
& text
,
90 virtual UnicodeString
& toReplacerPattern(UnicodeString
& rule
,
91 UBool escapeUnprintable
) const;
94 * Implement UnicodeReplacer
96 virtual void addReplacementSetTo(UnicodeSet
& toUnionTo
) const;
101 virtual void setData(const TransliterationRuleData
*);
104 * ICU "poor man's RTTI", returns a UClassID for the actual class.
108 virtual UClassID
getDynamicClassID() const;
111 * ICU "poor man's RTTI", returns a UClassID for this class.
115 static UClassID U_EXPORT2
getStaticClassID();
120 #endif /* #if !UCONFIG_NO_TRANSLITERATION */