]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/quant.h
2 **********************************************************************
3 * Copyright (C) 2001-2011, International Business Machines Corporation
4 * and others. All Rights Reserved.
5 **********************************************************************
6 * Date Name Description
7 * 07/26/01 aliu Creation.
8 **********************************************************************
13 #include "unicode/utypes.h"
15 #if !UCONFIG_NO_TRANSLITERATION
17 #include "unicode/unifunct.h"
18 #include "unicode/unimatch.h"
22 class Quantifier
: public UnicodeFunctor
, public UnicodeMatcher
{
26 enum { MAX
= 0x7FFFFFFF };
28 Quantifier(UnicodeFunctor
*adoptedMatcher
,
29 uint32_t minCount
, uint32_t maxCount
);
31 Quantifier(const Quantifier
& o
);
33 virtual ~Quantifier();
36 * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
37 * and return the pointer.
38 * @return the UnicodeMatcher pointer.
40 virtual UnicodeMatcher
* toMatcher() const;
43 * Implement UnicodeFunctor
44 * @return a copy of the object.
46 virtual UnicodeFunctor
* clone() const;
49 * Implement UnicodeMatcher
50 * @param text the text to be matched
51 * @param offset on input, the index into text at which to begin
52 * matching. On output, the limit of the matched text. The
53 * number of matched characters is the output value of offset
54 * minus the input value. Offset should always point to the
55 * HIGH SURROGATE (leading code unit) of a pair of surrogates,
56 * both on entry and upon return.
57 * @param limit the limit index of text to be matched. Greater
58 * than offset for a forward direction match, less than offset for
59 * a backward direction match. The last character to be
60 * considered for matching will be text.charAt(limit-1) in the
61 * forward direction or text.charAt(limit+1) in the backward
63 * @param incremental if TRUE, then assume further characters may
64 * be inserted at limit and check for partial matching. Otherwise
65 * assume the text as given is complete.
66 * @return a match degree value indicating a full match, a partial
67 * match, or a mismatch. If incremental is FALSE then
68 * U_PARTIAL_MATCH should never be returned.
70 virtual UMatchDegree
matches(const Replaceable
& text
,
76 * Implement UnicodeMatcher
77 * @param result Output param to receive the pattern.
78 * @param escapeUnprintable if True then escape the unprintable characters.
79 * @return A reference to 'result'.
81 virtual UnicodeString
& toPattern(UnicodeString
& result
,
82 UBool escapeUnprintable
= FALSE
) const;
85 * Implement UnicodeMatcher
86 * @param v the given index value.
87 * @return true if this rule matches the given index value.
89 virtual UBool
matchesIndexValue(uint8_t v
) const;
92 * Implement UnicodeMatcher
94 virtual void addMatchSetTo(UnicodeSet
& toUnionTo
) const;
99 virtual void setData(const TransliterationRuleData
*);
102 * ICU "poor man's RTTI", returns a UClassID for the actual class.
104 virtual UClassID
getDynamicClassID() const;
107 * ICU "poor man's RTTI", returns a UClassID for this class.
109 static UClassID U_EXPORT2
getStaticClassID();
113 UnicodeFunctor
* matcher
; // owned
122 #endif /* #if !UCONFIG_NO_TRANSLITERATION */