intl/icu/source/i18n/unicode/unirepl.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.

michael@0 1 /*
michael@0 2 **********************************************************************
michael@0 3 * Copyright (c) 2002-2005, International Business Machines Corporation
michael@0 4 * and others. All Rights Reserved.
michael@0 5 **********************************************************************
michael@0 6 * Date Name Description
michael@0 7 * 01/14/2002 aliu Creation.
michael@0 8 **********************************************************************
michael@0 9 */
michael@0 10 #ifndef UNIREPL_H
michael@0 11 #define UNIREPL_H
michael@0 12
michael@0 13 #include "unicode/utypes.h"
michael@0 14
michael@0 15 /**
michael@0 16 * \file
michael@0 17 * \brief C++ API: UnicodeReplacer
michael@0 18 */
michael@0 19
michael@0 20 U_NAMESPACE_BEGIN
michael@0 21
michael@0 22 class Replaceable;
michael@0 23 class UnicodeString;
michael@0 24 class UnicodeSet;
michael@0 25
michael@0 26 /**
michael@0 27 * <code>UnicodeReplacer</code> defines a protocol for objects that
michael@0 28 * replace a range of characters in a Replaceable string with output
michael@0 29 * text. The replacement is done via the Replaceable API so as to
michael@0 30 * preserve out-of-band data.
michael@0 31 *
michael@0 32 * <p>This is a mixin class.
michael@0 33 * @author Alan Liu
michael@0 34 * @stable ICU 2.4
michael@0 35 */
michael@0 36 class U_I18N_API UnicodeReplacer /* not : public UObject because this is an interface/mixin class */ {
michael@0 37
michael@0 38 public:
michael@0 39
michael@0 40 /**
michael@0 41 * Destructor.
michael@0 42 * @stable ICU 2.4
michael@0 43 */
michael@0 44 virtual ~UnicodeReplacer();
michael@0 45
michael@0 46 /**
michael@0 47 * Replace characters in 'text' from 'start' to 'limit' with the
michael@0 48 * output text of this object. Update the 'cursor' parameter to
michael@0 49 * give the cursor position and return the length of the
michael@0 50 * replacement text.
michael@0 51 *
michael@0 52 * @param text the text to be matched
michael@0 53 * @param start inclusive start index of text to be replaced
michael@0 54 * @param limit exclusive end index of text to be replaced;
michael@0 55 * must be greater than or equal to start
michael@0 56 * @param cursor output parameter for the cursor position.
michael@0 57 * Not all replacer objects will update this, but in a complete
michael@0 58 * tree of replacer objects, representing the entire output side
michael@0 59 * of a transliteration rule, at least one must update it.
michael@0 60 * @return the number of 16-bit code units in the text replacing
michael@0 61 * the characters at offsets start..(limit-1) in text
michael@0 62 * @stable ICU 2.4
michael@0 63 */
michael@0 64 virtual int32_t replace(Replaceable& text,
michael@0 65 int32_t start,
michael@0 66 int32_t limit,
michael@0 67 int32_t& cursor) = 0;
michael@0 68
michael@0 69 /**
michael@0 70 * Returns a string representation of this replacer. If the
michael@0 71 * result of calling this function is passed to the appropriate
michael@0 72 * parser, typically TransliteratorParser, it will produce another
michael@0 73 * replacer that is equal to this one.
michael@0 74 * @param result the string to receive the pattern. Previous
michael@0 75 * contents will be deleted.
michael@0 76 * @param escapeUnprintable if TRUE then convert unprintable
michael@0 77 * character to their hex escape representations, \\uxxxx or
michael@0 78 * \\Uxxxxxxxx. Unprintable characters are defined by
michael@0 79 * Utility.isUnprintable().
michael@0 80 * @return a reference to 'result'.
michael@0 81 * @stable ICU 2.4
michael@0 82 */
michael@0 83 virtual UnicodeString& toReplacerPattern(UnicodeString& result,
michael@0 84 UBool escapeUnprintable) const = 0;
michael@0 85
michael@0 86 /**
michael@0 87 * Union the set of all characters that may output by this object
michael@0 88 * into the given set.
michael@0 89 * @param toUnionTo the set into which to union the output characters
michael@0 90 * @stable ICU 2.4
michael@0 91 */
michael@0 92 virtual void addReplacementSetTo(UnicodeSet& toUnionTo) const = 0;
michael@0 93 };
michael@0 94
michael@0 95 U_NAMESPACE_END
michael@0 96
michael@0 97 #endif

mercurial