]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/quant.h
2 * Copyright (C) 2001-2004, International Business Machines Corporation
3 * and others. All Rights Reserved.
4 **********************************************************************
5 * Date Name Description
6 * 07/26/01 aliu Creation.
7 **********************************************************************
12 #include "unicode/utypes.h"
14 #if !UCONFIG_NO_TRANSLITERATION
16 #include "unicode/unifunct.h"
17 #include "unicode/unimatch.h"
21 class Quantifier
: public UnicodeFunctor
, public UnicodeMatcher
{
25 enum { MAX
= 0x7FFFFFFF };
27 Quantifier(UnicodeFunctor
*adoptedMatcher
,
28 uint32_t minCount
, uint32_t maxCount
);
30 Quantifier(const Quantifier
& o
);
32 virtual ~Quantifier();
35 * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
36 * and return the pointer.
37 * @return the UnicodeMatcher pointer.
39 virtual UnicodeMatcher
* toMatcher() const;
42 * Implement UnicodeFunctor
43 * @return a copy of the object.
45 virtual UnicodeFunctor
* clone() const;
48 * Implement UnicodeMatcher
49 * @param text the text to be matched
50 * @param offset on input, the index into text at which to begin
51 * matching. On output, the limit of the matched text. The
52 * number of matched characters is the output value of offset
53 * minus the input value. Offset should always point to the
54 * HIGH SURROGATE (leading code unit) of a pair of surrogates,
55 * both on entry and upon return.
56 * @param limit the limit index of text to be matched. Greater
57 * than offset for a forward direction match, less than offset for
58 * a backward direction match. The last character to be
59 * considered for matching will be text.charAt(limit-1) in the
60 * forward direction or text.charAt(limit+1) in the backward
62 * @param incremental if TRUE, then assume further characters may
63 * be inserted at limit and check for partial matching. Otherwise
64 * assume the text as given is complete.
65 * @return a match degree value indicating a full match, a partial
66 * match, or a mismatch. If incremental is FALSE then
67 * U_PARTIAL_MATCH should never be returned.
69 virtual UMatchDegree
matches(const Replaceable
& text
,
75 * Implement UnicodeMatcher
76 * @param result Output param to receive the pattern.
77 * @param escapeUnprintable if True then escape the unprintable characters.
78 * @return A reference to 'result'.
80 virtual UnicodeString
& toPattern(UnicodeString
& result
,
81 UBool escapeUnprintable
= FALSE
) const;
84 * Implement UnicodeMatcher
85 * @param v the given index value.
86 * @return true if this rule matches the given index value.
88 virtual UBool
matchesIndexValue(uint8_t v
) const;
91 * Implement UnicodeMatcher
93 virtual void addMatchSetTo(UnicodeSet
& toUnionTo
) const;
98 virtual void setData(const TransliterationRuleData
*);
101 * ICU "poor man's RTTI", returns a UClassID for the actual class.
105 virtual UClassID
getDynamicClassID() const;
108 * ICU "poor man's RTTI", returns a UClassID for this class.
112 static UClassID U_EXPORT2
getStaticClassID();
116 static void appendNumber(UnicodeString
& result
, int32_t n
);
118 UnicodeFunctor
* matcher
; // owned
127 #endif /* #if !UCONFIG_NO_TRANSLITERATION */