2 * Copyright (C) 1999-2004, International Business Machines Corporation and others.
4 **********************************************************************
5 * Date Name Description
6 * 11/17/99 aliu Creation.
7 **********************************************************************
12 #include "unicode/unifunct.h"
13 #include "unicode/unimatch.h"
18 * U_ETHER is used to represent character values for positions outside
19 * a range. For example, transliterator uses this to represent
20 * characters outside the range contextStart..contextLimit-1. This
21 * allows explicit matching by rules and UnicodeSets of text outside a
25 #define U_ETHER ((UChar)0xFFFF)
28 * <code>UnicodeFilter</code> defines a protocol for selecting a
29 * subset of the full range (U+0000 to U+10FFFF) of Unicode characters.
30 * Currently, filters are used in conjunction with classes like {@link
31 * Transliterator} to only process selected characters through a
34 * <p>Note: UnicodeFilter currently stubs out two pure virtual methods
35 * of its base class, UnicodeMatcher. These methods are toPattern()
36 * and matchesIndexValue(). This is done so that filter classes that
37 * are not actually used as matchers -- specifically, those in the
38 * UnicodeFilterLogic component, and those in tests -- can continue to
39 * work without defining these methods. As long as a filter is not
40 * used in an RBT during real transliteration, these methods will not
41 * be called. However, this breaks the UnicodeMatcher base class
42 * protocol, and it is not a correct solution.
44 * <p>In the future we may revisit the UnicodeMatcher / UnicodeFilter
45 * hierarchy and either redesign it, or simply remove the stubs in
46 * UnicodeFilter and force subclasses to implement the full
47 * UnicodeMatcher protocol.
49 * @see UnicodeFilterLogic
52 class U_COMMON_API UnicodeFilter
: public UnicodeFunctor
, public UnicodeMatcher
{
59 virtual ~UnicodeFilter();
62 * Returns <tt>true</tt> for characters that are in the selected
63 * subset. In other words, if a character is <b>to be
64 * filtered</b>, then <tt>contains()</tt> returns
65 * <b><tt>false</tt></b>.
68 virtual UBool
contains(UChar32 c
) const = 0;
71 * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
72 * and return the pointer.
75 virtual UnicodeMatcher
* toMatcher() const;
78 * Implement UnicodeMatcher API.
81 virtual UMatchDegree
matches(const Replaceable
& text
,
87 * UnicodeFunctor API. Nothing to do.
90 virtual void setData(const TransliterationRuleData
*);
93 * ICU "poor man's RTTI", returns a UClassID for the actual class.
97 virtual UClassID
getDynamicClassID() const = 0;
100 * ICU "poor man's RTTI", returns a UClassID for this class.
104 static UClassID U_EXPORT2
getStaticClassID();
109 * Since this class has pure virtual functions,
110 * a constructor can't be used.
113 /* UnicodeFilter();*/
116 /*inline UnicodeFilter::UnicodeFilter() {}*/