intl/icu/source/i18n/unicode/unirepl.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/i18n/unicode/unirepl.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,97 @@
     1.4 +/*
     1.5 +**********************************************************************
     1.6 +*   Copyright (c) 2002-2005, International Business Machines Corporation
     1.7 +*   and others.  All Rights Reserved.
     1.8 +**********************************************************************
     1.9 +*   Date        Name        Description
    1.10 +*   01/14/2002  aliu        Creation.
    1.11 +**********************************************************************
    1.12 +*/
    1.13 +#ifndef UNIREPL_H
    1.14 +#define UNIREPL_H
    1.15 +
    1.16 +#include "unicode/utypes.h"
    1.17 +
    1.18 +/**
    1.19 + * \file 
    1.20 + * \brief C++ API: UnicodeReplacer
    1.21 + */
    1.22 +
    1.23 +U_NAMESPACE_BEGIN
    1.24 +
    1.25 +class Replaceable;
    1.26 +class UnicodeString;
    1.27 +class UnicodeSet;
    1.28 +
    1.29 +/**
    1.30 + * <code>UnicodeReplacer</code> defines a protocol for objects that
    1.31 + * replace a range of characters in a Replaceable string with output
    1.32 + * text.  The replacement is done via the Replaceable API so as to
    1.33 + * preserve out-of-band data.
    1.34 + *
    1.35 + * <p>This is a mixin class.
    1.36 + * @author Alan Liu
    1.37 + * @stable ICU 2.4
    1.38 + */
    1.39 +class U_I18N_API UnicodeReplacer /* not : public UObject because this is an interface/mixin class */ {
    1.40 +
    1.41 + public:
    1.42 +
    1.43 +    /**
    1.44 +     * Destructor.
    1.45 +     * @stable ICU 2.4
    1.46 +     */
    1.47 +    virtual ~UnicodeReplacer();
    1.48 +
    1.49 +    /**
    1.50 +     * Replace characters in 'text' from 'start' to 'limit' with the
    1.51 +     * output text of this object.  Update the 'cursor' parameter to
    1.52 +     * give the cursor position and return the length of the
    1.53 +     * replacement text.
    1.54 +     *
    1.55 +     * @param text the text to be matched
    1.56 +     * @param start inclusive start index of text to be replaced
    1.57 +     * @param limit exclusive end index of text to be replaced;
    1.58 +     * must be greater than or equal to start
    1.59 +     * @param cursor output parameter for the cursor position.
    1.60 +     * Not all replacer objects will update this, but in a complete
    1.61 +     * tree of replacer objects, representing the entire output side
    1.62 +     * of a transliteration rule, at least one must update it.
    1.63 +     * @return the number of 16-bit code units in the text replacing
    1.64 +     * the characters at offsets start..(limit-1) in text
    1.65 +     * @stable ICU 2.4
    1.66 +     */
    1.67 +    virtual int32_t replace(Replaceable& text,
    1.68 +                            int32_t start,
    1.69 +                            int32_t limit,
    1.70 +                            int32_t& cursor) = 0;
    1.71 +
    1.72 +    /**
    1.73 +     * Returns a string representation of this replacer.  If the
    1.74 +     * result of calling this function is passed to the appropriate
    1.75 +     * parser, typically TransliteratorParser, it will produce another
    1.76 +     * replacer that is equal to this one.
    1.77 +     * @param result the string to receive the pattern.  Previous
    1.78 +     * contents will be deleted.
    1.79 +     * @param escapeUnprintable if TRUE then convert unprintable
    1.80 +     * character to their hex escape representations, \\uxxxx or
    1.81 +     * \\Uxxxxxxxx.  Unprintable characters are defined by
    1.82 +     * Utility.isUnprintable().
    1.83 +     * @return a reference to 'result'.
    1.84 +     * @stable ICU 2.4
    1.85 +     */
    1.86 +    virtual UnicodeString& toReplacerPattern(UnicodeString& result,
    1.87 +                                             UBool escapeUnprintable) const = 0;
    1.88 +
    1.89 +    /**
    1.90 +     * Union the set of all characters that may output by this object
    1.91 +     * into the given set.
    1.92 +     * @param toUnionTo the set into which to union the output characters
    1.93 +     * @stable ICU 2.4
    1.94 +     */
    1.95 +    virtual void addReplacementSetTo(UnicodeSet& toUnionTo) const = 0;
    1.96 +};
    1.97 +
    1.98 +U_NAMESPACE_END
    1.99 +
   1.100 +#endif

mercurial