UnicodeFilter
Note: UnicodeFilter currently stubs out two pure virtual methods 48 * of its base class, UnicodeMatcher. These methods are toPattern() 49 * and matchesIndexValue(). This is done so that filter classes that 50 * are not actually used as matchers -- specifically, those in the 51 * UnicodeFilterLogic component, and those in tests -- can continue to 52 * work without defining these methods. As long as a filter is not 53 * used in an RBT during real transliteration, these methods will not 54 * be called. However, this breaks the UnicodeMatcher base class 55 * protocol, and it is not a correct solution. 56 * 57 *
In the future we may revisit the UnicodeMatcher / UnicodeFilter 58 * hierarchy and either redesign it, or simply remove the stubs in 59 * UnicodeFilter and force subclasses to implement the full 60 * UnicodeMatcher protocol. 61 * 62 * @see UnicodeFilterLogic 63 * @stable ICU 2.0 64 */ 65 class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher { 66 67 public: 68 /** 69 * Destructor 70 * @stable ICU 2.0 71 */ 72 virtual ~UnicodeFilter(); 73 74 /** 75 * Clones this object polymorphically. 76 * The caller owns the result and should delete it when done. 77 * @return clone, or nullptr if an error occurred 78 * @stable ICU 2.4 79 */ 80 virtual UnicodeFilter* clone() const override = 0; 81 82 /** 83 * Returns true for characters that are in the selected 84 * subset. In other words, if a character is to be 85 * filtered, then contains() returns 86 * false. 87 * @stable ICU 2.0 88 */ 89 virtual UBool contains(UChar32 c) const = 0; 90 91 /** 92 * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer 93 * and return the pointer. 94 * @stable ICU 2.4 95 */ 96 virtual UnicodeMatcher* toMatcher() const override; 97 98 /** 99 * Implement UnicodeMatcher API. 100 * @stable ICU 2.4 101 */ 102 virtual UMatchDegree matches(const Replaceable& text, 103 int32_t& offset, 104 int32_t limit, 105 UBool incremental) override; 106 107 /** 108 * UnicodeFunctor API. Nothing to do. 109 * @stable ICU 2.4 110 */ 111 virtual void setData(const TransliterationRuleData*) override; 112 113 /** 114 * ICU "poor man's RTTI", returns a UClassID for this class. 115 * 116 * @stable ICU 2.2 117 */ 118 static UClassID U_EXPORT2 getStaticClassID(); 119 120 protected: 121 122 /* 123 * Since this class has pure virtual functions, 124 * a constructor can't be used. 125 * @stable ICU 2.0 126 */ 127 /* UnicodeFilter();*/ 128 }; 129 130 /*inline UnicodeFilter::UnicodeFilter() {}*/ 131 132 U_NAMESPACE_END 133 134 #endif /* U_SHOW_CPLUSPLUS_API */ 135 136 #endif