]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/funcrepl.h
2 **********************************************************************
3 * Copyright (c) 2002-2007, International Business Machines Corporation
4 * and others. All Rights Reserved.
5 **********************************************************************
6 * Date Name Description
7 * 02/04/2002 aliu Creation.
8 **********************************************************************
14 #include "unicode/utypes.h"
16 #if !UCONFIG_NO_TRANSLITERATION
18 #include "unicode/unifunct.h"
19 #include "unicode/unirepl.h"
26 * A replacer that calls a transliterator to generate its output text.
27 * The input text to the transliterator is the output of another
28 * UnicodeReplacer object. That is, this replacer wraps another
29 * replacer with a transliterator.
33 class 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 */