]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/funcrepl.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (c) 2002-2011, International Business Machines Corporation
6 * and others. All Rights Reserved.
7 **********************************************************************
8 * Date Name Description
9 * 02/04/2002 aliu Creation.
10 **********************************************************************
16 #include "unicode/utypes.h"
18 #if !UCONFIG_NO_TRANSLITERATION
20 #include "unicode/unifunct.h"
21 #include "unicode/unirepl.h"
28 * A replacer that calls a transliterator to generate its output text.
29 * The input text to the transliterator is the output of another
30 * UnicodeReplacer object. That is, this replacer wraps another
31 * replacer with a transliterator.
35 class FunctionReplacer
: public UnicodeFunctor
, public UnicodeReplacer
{
40 * The transliterator. Must not be null. OWNED.
42 Transliterator
* translit
;
45 * The replacer object. This generates text that is then
46 * processed by 'translit'. Must not be null. OWNED.
48 UnicodeFunctor
* replacer
;
53 * Construct a replacer that takes the output of the given
54 * replacer, passes it through the given transliterator, and emits
55 * the result as output.
57 FunctionReplacer(Transliterator
* adoptedTranslit
,
58 UnicodeFunctor
* adoptedReplacer
);
63 FunctionReplacer(const FunctionReplacer
& other
);
68 virtual ~FunctionReplacer();
71 * Implement UnicodeFunctor
73 virtual UnicodeFunctor
* clone() const;
76 * UnicodeFunctor API. Cast 'this' to a UnicodeReplacer* pointer
77 * and return the pointer.
79 virtual UnicodeReplacer
* toReplacer() const;
84 virtual int32_t replace(Replaceable
& text
,
92 virtual UnicodeString
& toReplacerPattern(UnicodeString
& rule
,
93 UBool escapeUnprintable
) const;
96 * Implement UnicodeReplacer
98 virtual void addReplacementSetTo(UnicodeSet
& toUnionTo
) const;
103 virtual void setData(const TransliterationRuleData
*);
106 * 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.
113 static UClassID U_EXPORT2
getStaticClassID();
118 #endif /* #if !UCONFIG_NO_TRANSLITERATION */