intl/icu/source/common/unicode/unifilt.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial