intl/icu/source/i18n/funcrepl.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 /*
     2 **********************************************************************
     3 *   Copyright (c) 2002-2011, International Business Machines Corporation
     4 *   and others.  All Rights Reserved.
     5 **********************************************************************
     6 *   Date        Name        Description
     7 *   02/04/2002  aliu        Creation.
     8 **********************************************************************
     9 */
    11 #ifndef FUNCREPL_H
    12 #define FUNCREPL_H
    14 #include "unicode/utypes.h"
    16 #if !UCONFIG_NO_TRANSLITERATION
    18 #include "unicode/unifunct.h"
    19 #include "unicode/unirepl.h"
    21 U_NAMESPACE_BEGIN
    23 class Transliterator;
    25 /**
    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.
    30  *
    31  * @author Alan Liu
    32  */
    33 class FunctionReplacer : public UnicodeFunctor, public UnicodeReplacer {
    35  private:
    37     /**
    38      * The transliterator.  Must not be null.  OWNED.
    39      */
    40     Transliterator* translit;
    42     /**
    43      * The replacer object.  This generates text that is then
    44      * processed by 'translit'.  Must not be null.  OWNED.
    45      */
    46     UnicodeFunctor* replacer;
    48  public:
    50     /**
    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.
    54      */
    55     FunctionReplacer(Transliterator* adoptedTranslit,
    56                      UnicodeFunctor* adoptedReplacer);
    58     /**
    59      * Copy constructor.
    60      */
    61     FunctionReplacer(const FunctionReplacer& other);
    63     /**
    64      * Destructor
    65      */
    66     virtual ~FunctionReplacer();
    68     /**
    69      * Implement UnicodeFunctor
    70      */
    71     virtual UnicodeFunctor* clone() const;
    73     /**
    74      * UnicodeFunctor API.  Cast 'this' to a UnicodeReplacer* pointer
    75      * and return the pointer.
    76      */
    77     virtual UnicodeReplacer* toReplacer() const;
    79     /**
    80      * UnicodeReplacer API
    81      */
    82     virtual int32_t replace(Replaceable& text,
    83                             int32_t start,
    84                             int32_t limit,
    85                             int32_t& cursor);
    87     /**
    88      * UnicodeReplacer API
    89      */
    90     virtual UnicodeString& toReplacerPattern(UnicodeString& rule,
    91                                              UBool escapeUnprintable) const;
    93     /**
    94      * Implement UnicodeReplacer
    95      */
    96     virtual void addReplacementSetTo(UnicodeSet& toUnionTo) const;
    98     /**
    99      * UnicodeFunctor API
   100      */
   101     virtual void setData(const TransliterationRuleData*);
   103     /**
   104      * ICU "poor man's RTTI", returns a UClassID for the actual class.
   105      */
   106     virtual UClassID getDynamicClassID() const;
   108     /**
   109      * ICU "poor man's RTTI", returns a UClassID for this class.
   110      */
   111     static UClassID U_EXPORT2 getStaticClassID();
   112 };
   114 U_NAMESPACE_END
   116 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
   117 #endif
   119 //eof

mercurial