intl/icu/source/i18n/funcrepl.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /*
michael@0 2 **********************************************************************
michael@0 3 * Copyright (c) 2002-2011, International Business Machines Corporation
michael@0 4 * and others. All Rights Reserved.
michael@0 5 **********************************************************************
michael@0 6 * Date Name Description
michael@0 7 * 02/04/2002 aliu Creation.
michael@0 8 **********************************************************************
michael@0 9 */
michael@0 10
michael@0 11 #ifndef FUNCREPL_H
michael@0 12 #define FUNCREPL_H
michael@0 13
michael@0 14 #include "unicode/utypes.h"
michael@0 15
michael@0 16 #if !UCONFIG_NO_TRANSLITERATION
michael@0 17
michael@0 18 #include "unicode/unifunct.h"
michael@0 19 #include "unicode/unirepl.h"
michael@0 20
michael@0 21 U_NAMESPACE_BEGIN
michael@0 22
michael@0 23 class Transliterator;
michael@0 24
michael@0 25 /**
michael@0 26 * A replacer that calls a transliterator to generate its output text.
michael@0 27 * The input text to the transliterator is the output of another
michael@0 28 * UnicodeReplacer object. That is, this replacer wraps another
michael@0 29 * replacer with a transliterator.
michael@0 30 *
michael@0 31 * @author Alan Liu
michael@0 32 */
michael@0 33 class FunctionReplacer : public UnicodeFunctor, public UnicodeReplacer {
michael@0 34
michael@0 35 private:
michael@0 36
michael@0 37 /**
michael@0 38 * The transliterator. Must not be null. OWNED.
michael@0 39 */
michael@0 40 Transliterator* translit;
michael@0 41
michael@0 42 /**
michael@0 43 * The replacer object. This generates text that is then
michael@0 44 * processed by 'translit'. Must not be null. OWNED.
michael@0 45 */
michael@0 46 UnicodeFunctor* replacer;
michael@0 47
michael@0 48 public:
michael@0 49
michael@0 50 /**
michael@0 51 * Construct a replacer that takes the output of the given
michael@0 52 * replacer, passes it through the given transliterator, and emits
michael@0 53 * the result as output.
michael@0 54 */
michael@0 55 FunctionReplacer(Transliterator* adoptedTranslit,
michael@0 56 UnicodeFunctor* adoptedReplacer);
michael@0 57
michael@0 58 /**
michael@0 59 * Copy constructor.
michael@0 60 */
michael@0 61 FunctionReplacer(const FunctionReplacer& other);
michael@0 62
michael@0 63 /**
michael@0 64 * Destructor
michael@0 65 */
michael@0 66 virtual ~FunctionReplacer();
michael@0 67
michael@0 68 /**
michael@0 69 * Implement UnicodeFunctor
michael@0 70 */
michael@0 71 virtual UnicodeFunctor* clone() const;
michael@0 72
michael@0 73 /**
michael@0 74 * UnicodeFunctor API. Cast 'this' to a UnicodeReplacer* pointer
michael@0 75 * and return the pointer.
michael@0 76 */
michael@0 77 virtual UnicodeReplacer* toReplacer() const;
michael@0 78
michael@0 79 /**
michael@0 80 * UnicodeReplacer API
michael@0 81 */
michael@0 82 virtual int32_t replace(Replaceable& text,
michael@0 83 int32_t start,
michael@0 84 int32_t limit,
michael@0 85 int32_t& cursor);
michael@0 86
michael@0 87 /**
michael@0 88 * UnicodeReplacer API
michael@0 89 */
michael@0 90 virtual UnicodeString& toReplacerPattern(UnicodeString& rule,
michael@0 91 UBool escapeUnprintable) const;
michael@0 92
michael@0 93 /**
michael@0 94 * Implement UnicodeReplacer
michael@0 95 */
michael@0 96 virtual void addReplacementSetTo(UnicodeSet& toUnionTo) const;
michael@0 97
michael@0 98 /**
michael@0 99 * UnicodeFunctor API
michael@0 100 */
michael@0 101 virtual void setData(const TransliterationRuleData*);
michael@0 102
michael@0 103 /**
michael@0 104 * ICU "poor man's RTTI", returns a UClassID for the actual class.
michael@0 105 */
michael@0 106 virtual UClassID getDynamicClassID() const;
michael@0 107
michael@0 108 /**
michael@0 109 * ICU "poor man's RTTI", returns a UClassID for this class.
michael@0 110 */
michael@0 111 static UClassID U_EXPORT2 getStaticClassID();
michael@0 112 };
michael@0 113
michael@0 114 U_NAMESPACE_END
michael@0 115
michael@0 116 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
michael@0 117 #endif
michael@0 118
michael@0 119 //eof

mercurial