intl/icu/source/i18n/quant.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) 2001-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 * 07/26/01 aliu Creation.
michael@0 8 **********************************************************************
michael@0 9 */
michael@0 10 #ifndef QUANT_H
michael@0 11 #define QUANT_H
michael@0 12
michael@0 13 #include "unicode/utypes.h"
michael@0 14
michael@0 15 #if !UCONFIG_NO_TRANSLITERATION
michael@0 16
michael@0 17 #include "unicode/unifunct.h"
michael@0 18 #include "unicode/unimatch.h"
michael@0 19
michael@0 20 U_NAMESPACE_BEGIN
michael@0 21
michael@0 22 class Quantifier : public UnicodeFunctor, public UnicodeMatcher {
michael@0 23
michael@0 24 public:
michael@0 25
michael@0 26 enum { MAX = 0x7FFFFFFF };
michael@0 27
michael@0 28 Quantifier(UnicodeFunctor *adoptedMatcher,
michael@0 29 uint32_t minCount, uint32_t maxCount);
michael@0 30
michael@0 31 Quantifier(const Quantifier& o);
michael@0 32
michael@0 33 virtual ~Quantifier();
michael@0 34
michael@0 35 /**
michael@0 36 * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
michael@0 37 * and return the pointer.
michael@0 38 * @return the UnicodeMatcher pointer.
michael@0 39 */
michael@0 40 virtual UnicodeMatcher* toMatcher() const;
michael@0 41
michael@0 42 /**
michael@0 43 * Implement UnicodeFunctor
michael@0 44 * @return a copy of the object.
michael@0 45 */
michael@0 46 virtual UnicodeFunctor* clone() const;
michael@0 47
michael@0 48 /**
michael@0 49 * Implement UnicodeMatcher
michael@0 50 * @param text the text to be matched
michael@0 51 * @param offset on input, the index into text at which to begin
michael@0 52 * matching. On output, the limit of the matched text. The
michael@0 53 * number of matched characters is the output value of offset
michael@0 54 * minus the input value. Offset should always point to the
michael@0 55 * HIGH SURROGATE (leading code unit) of a pair of surrogates,
michael@0 56 * both on entry and upon return.
michael@0 57 * @param limit the limit index of text to be matched. Greater
michael@0 58 * than offset for a forward direction match, less than offset for
michael@0 59 * a backward direction match. The last character to be
michael@0 60 * considered for matching will be text.charAt(limit-1) in the
michael@0 61 * forward direction or text.charAt(limit+1) in the backward
michael@0 62 * direction.
michael@0 63 * @param incremental if TRUE, then assume further characters may
michael@0 64 * be inserted at limit and check for partial matching. Otherwise
michael@0 65 * assume the text as given is complete.
michael@0 66 * @return a match degree value indicating a full match, a partial
michael@0 67 * match, or a mismatch. If incremental is FALSE then
michael@0 68 * U_PARTIAL_MATCH should never be returned.
michael@0 69 */
michael@0 70 virtual UMatchDegree matches(const Replaceable& text,
michael@0 71 int32_t& offset,
michael@0 72 int32_t limit,
michael@0 73 UBool incremental);
michael@0 74
michael@0 75 /**
michael@0 76 * Implement UnicodeMatcher
michael@0 77 * @param result Output param to receive the pattern.
michael@0 78 * @param escapeUnprintable if True then escape the unprintable characters.
michael@0 79 * @return A reference to 'result'.
michael@0 80 */
michael@0 81 virtual UnicodeString& toPattern(UnicodeString& result,
michael@0 82 UBool escapeUnprintable = FALSE) const;
michael@0 83
michael@0 84 /**
michael@0 85 * Implement UnicodeMatcher
michael@0 86 * @param v the given index value.
michael@0 87 * @return true if this rule matches the given index value.
michael@0 88 */
michael@0 89 virtual UBool matchesIndexValue(uint8_t v) const;
michael@0 90
michael@0 91 /**
michael@0 92 * Implement UnicodeMatcher
michael@0 93 */
michael@0 94 virtual void addMatchSetTo(UnicodeSet& toUnionTo) const;
michael@0 95
michael@0 96 /**
michael@0 97 * UnicodeFunctor API
michael@0 98 */
michael@0 99 virtual void setData(const TransliterationRuleData*);
michael@0 100
michael@0 101 /**
michael@0 102 * ICU "poor man's RTTI", returns a UClassID for the actual class.
michael@0 103 */
michael@0 104 virtual UClassID getDynamicClassID() const;
michael@0 105
michael@0 106 /**
michael@0 107 * ICU "poor man's RTTI", returns a UClassID for this class.
michael@0 108 */
michael@0 109 static UClassID U_EXPORT2 getStaticClassID();
michael@0 110
michael@0 111 private:
michael@0 112
michael@0 113 UnicodeFunctor* matcher; // owned
michael@0 114
michael@0 115 uint32_t minCount;
michael@0 116
michael@0 117 uint32_t maxCount;
michael@0 118 };
michael@0 119
michael@0 120 U_NAMESPACE_END
michael@0 121
michael@0 122 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
michael@0 123
michael@0 124 #endif

mercurial