annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/unicode/unifilt.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 // © 2016 and later: Unicode, Inc. and others.
jpayne@69 2 // License & terms of use: http://www.unicode.org/copyright.html
jpayne@69 3 /*
jpayne@69 4 **********************************************************************
jpayne@69 5 * Copyright (C) 1999-2010, International Business Machines Corporation and others.
jpayne@69 6 * All Rights Reserved.
jpayne@69 7 **********************************************************************
jpayne@69 8 * Date Name Description
jpayne@69 9 * 11/17/99 aliu Creation.
jpayne@69 10 **********************************************************************
jpayne@69 11 */
jpayne@69 12 #ifndef UNIFILT_H
jpayne@69 13 #define UNIFILT_H
jpayne@69 14
jpayne@69 15 #include "unicode/utypes.h"
jpayne@69 16
jpayne@69 17 #if U_SHOW_CPLUSPLUS_API
jpayne@69 18
jpayne@69 19 #include "unicode/unifunct.h"
jpayne@69 20 #include "unicode/unimatch.h"
jpayne@69 21
jpayne@69 22 /**
jpayne@69 23 * \file
jpayne@69 24 * \brief C++ API: Unicode Filter
jpayne@69 25 */
jpayne@69 26
jpayne@69 27 U_NAMESPACE_BEGIN
jpayne@69 28
jpayne@69 29 /**
jpayne@69 30 * U_ETHER is used to represent character values for positions outside
jpayne@69 31 * a range. For example, transliterator uses this to represent
jpayne@69 32 * characters outside the range contextStart..contextLimit-1. This
jpayne@69 33 * allows explicit matching by rules and UnicodeSets of text outside a
jpayne@69 34 * defined range.
jpayne@69 35 * @stable ICU 3.0
jpayne@69 36 */
jpayne@69 37 #define U_ETHER ((char16_t)0xFFFF)
jpayne@69 38
jpayne@69 39 /**
jpayne@69 40 *
jpayne@69 41 * <code>UnicodeFilter</code> defines a protocol for selecting a
jpayne@69 42 * subset of the full range (U+0000 to U+10FFFF) of Unicode characters.
jpayne@69 43 * Currently, filters are used in conjunction with classes like {@link
jpayne@69 44 * Transliterator} to only process selected characters through a
jpayne@69 45 * transformation.
jpayne@69 46 *
jpayne@69 47 * <p>Note: UnicodeFilter currently stubs out two pure virtual methods
jpayne@69 48 * of its base class, UnicodeMatcher. These methods are toPattern()
jpayne@69 49 * and matchesIndexValue(). This is done so that filter classes that
jpayne@69 50 * are not actually used as matchers -- specifically, those in the
jpayne@69 51 * UnicodeFilterLogic component, and those in tests -- can continue to
jpayne@69 52 * work without defining these methods. As long as a filter is not
jpayne@69 53 * used in an RBT during real transliteration, these methods will not
jpayne@69 54 * be called. However, this breaks the UnicodeMatcher base class
jpayne@69 55 * protocol, and it is not a correct solution.
jpayne@69 56 *
jpayne@69 57 * <p>In the future we may revisit the UnicodeMatcher / UnicodeFilter
jpayne@69 58 * hierarchy and either redesign it, or simply remove the stubs in
jpayne@69 59 * UnicodeFilter and force subclasses to implement the full
jpayne@69 60 * UnicodeMatcher protocol.
jpayne@69 61 *
jpayne@69 62 * @see UnicodeFilterLogic
jpayne@69 63 * @stable ICU 2.0
jpayne@69 64 */
jpayne@69 65 class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher {
jpayne@69 66
jpayne@69 67 public:
jpayne@69 68 /**
jpayne@69 69 * Destructor
jpayne@69 70 * @stable ICU 2.0
jpayne@69 71 */
jpayne@69 72 virtual ~UnicodeFilter();
jpayne@69 73
jpayne@69 74 /**
jpayne@69 75 * Clones this object polymorphically.
jpayne@69 76 * The caller owns the result and should delete it when done.
jpayne@69 77 * @return clone, or nullptr if an error occurred
jpayne@69 78 * @stable ICU 2.4
jpayne@69 79 */
jpayne@69 80 virtual UnicodeFilter* clone() const = 0;
jpayne@69 81
jpayne@69 82 /**
jpayne@69 83 * Returns <tt>true</tt> for characters that are in the selected
jpayne@69 84 * subset. In other words, if a character is <b>to be
jpayne@69 85 * filtered</b>, then <tt>contains()</tt> returns
jpayne@69 86 * <b><tt>false</tt></b>.
jpayne@69 87 * @stable ICU 2.0
jpayne@69 88 */
jpayne@69 89 virtual UBool contains(UChar32 c) const = 0;
jpayne@69 90
jpayne@69 91 /**
jpayne@69 92 * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer
jpayne@69 93 * and return the pointer.
jpayne@69 94 * @stable ICU 2.4
jpayne@69 95 */
jpayne@69 96 virtual UnicodeMatcher* toMatcher() const;
jpayne@69 97
jpayne@69 98 /**
jpayne@69 99 * Implement UnicodeMatcher API.
jpayne@69 100 * @stable ICU 2.4
jpayne@69 101 */
jpayne@69 102 virtual UMatchDegree matches(const Replaceable& text,
jpayne@69 103 int32_t& offset,
jpayne@69 104 int32_t limit,
jpayne@69 105 UBool incremental);
jpayne@69 106
jpayne@69 107 /**
jpayne@69 108 * UnicodeFunctor API. Nothing to do.
jpayne@69 109 * @stable ICU 2.4
jpayne@69 110 */
jpayne@69 111 virtual void setData(const TransliterationRuleData*);
jpayne@69 112
jpayne@69 113 /**
jpayne@69 114 * ICU "poor man's RTTI", returns a UClassID for this class.
jpayne@69 115 *
jpayne@69 116 * @stable ICU 2.2
jpayne@69 117 */
jpayne@69 118 static UClassID U_EXPORT2 getStaticClassID();
jpayne@69 119
jpayne@69 120 protected:
jpayne@69 121
jpayne@69 122 /*
jpayne@69 123 * Since this class has pure virtual functions,
jpayne@69 124 * a constructor can't be used.
jpayne@69 125 * @stable ICU 2.0
jpayne@69 126 */
jpayne@69 127 /* UnicodeFilter();*/
jpayne@69 128 };
jpayne@69 129
jpayne@69 130 /*inline UnicodeFilter::UnicodeFilter() {}*/
jpayne@69 131
jpayne@69 132 U_NAMESPACE_END
jpayne@69 133
jpayne@69 134 #endif /* U_SHOW_CPLUSPLUS_API */
jpayne@69 135
jpayne@69 136 #endif