Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/unicode/unifilt.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 **********************************************************************
0005 * Copyright (C) 1999-2010, International Business Machines Corporation and others.
0006 * All Rights Reserved.
0007 **********************************************************************
0008 *   Date        Name        Description
0009 *   11/17/99    aliu        Creation.
0010 **********************************************************************
0011 */
0012 #ifndef UNIFILT_H
0013 #define UNIFILT_H
0014 
0015 #include "unicode/utypes.h"
0016 
0017 #if U_SHOW_CPLUSPLUS_API
0018 
0019 #include "unicode/unifunct.h"
0020 #include "unicode/unimatch.h"
0021 
0022 /**
0023  * \file 
0024  * \brief C++ API: Unicode Filter
0025  */
0026 
0027 U_NAMESPACE_BEGIN
0028 
0029 /**
0030  * U_ETHER is used to represent character values for positions outside
0031  * a range.  For example, transliterator uses this to represent
0032  * characters outside the range contextStart..contextLimit-1.  This
0033  * allows explicit matching by rules and UnicodeSets of text outside a
0034  * defined range.
0035  * @stable ICU 3.0
0036  */
0037 #define U_ETHER ((char16_t)0xFFFF)
0038 
0039 /**
0040  *
0041  * <code>UnicodeFilter</code> defines a protocol for selecting a
0042  * subset of the full range (U+0000 to U+10FFFF) of Unicode characters.
0043  * Currently, filters are used in conjunction with classes like
0044  * {@link Transliterator} to only process selected characters through a
0045  * transformation.
0046  *
0047  * <p>Note: UnicodeFilter currently stubs out two pure virtual methods
0048  * of its base class, UnicodeMatcher.  These methods are toPattern()
0049  * and matchesIndexValue().  This is done so that filter classes that
0050  * are not actually used as matchers -- specifically, those in the
0051  * UnicodeFilterLogic component, and those in tests -- can continue to
0052  * work without defining these methods.  As long as a filter is not
0053  * used in an RBT during real transliteration, these methods will not
0054  * be called.  However, this breaks the UnicodeMatcher base class
0055  * protocol, and it is not a correct solution.
0056  *
0057  * <p>In the future we may revisit the UnicodeMatcher / UnicodeFilter
0058  * hierarchy and either redesign it, or simply remove the stubs in
0059  * UnicodeFilter and force subclasses to implement the full
0060  * UnicodeMatcher protocol.
0061  *
0062  * @see UnicodeFilterLogic
0063  * @stable ICU 2.0
0064  */
0065 class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher {
0066 
0067 public:
0068     /**
0069      * Destructor
0070      * @stable ICU 2.0
0071      */
0072     virtual ~UnicodeFilter();
0073 
0074     /**
0075      * Clones this object polymorphically.
0076      * The caller owns the result and should delete it when done.
0077      * @return clone, or nullptr if an error occurred
0078      * @stable ICU 2.4
0079      */
0080     virtual UnicodeFilter* clone() const override = 0;
0081 
0082     /**
0083      * Returns <tt>true</tt> for characters that are in the selected
0084      * subset.  In other words, if a character is <b>to be
0085      * filtered</b>, then <tt>contains()</tt> returns
0086      * <b><tt>false</tt></b>.
0087      * @stable ICU 2.0
0088      */
0089     virtual UBool contains(UChar32 c) const = 0;
0090 
0091     /**
0092      * UnicodeFunctor API.  Cast 'this' to a UnicodeMatcher* pointer
0093      * and return the pointer.
0094      * @stable ICU 2.4
0095      */
0096     virtual UnicodeMatcher* toMatcher() const override;
0097 
0098     /**
0099      * Implement UnicodeMatcher API.
0100      * @stable ICU 2.4
0101      */
0102     virtual UMatchDegree matches(const Replaceable& text,
0103                                  int32_t& offset,
0104                                  int32_t limit,
0105                                  UBool incremental) override;
0106 
0107     /**
0108      * UnicodeFunctor API.  Nothing to do.
0109      * @stable ICU 2.4
0110      */
0111     virtual void setData(const TransliterationRuleData*) override;
0112 
0113     /**
0114      * ICU "poor man's RTTI", returns a UClassID for this class.
0115      *
0116      * @stable ICU 2.2
0117      */
0118     static UClassID U_EXPORT2 getStaticClassID();
0119 
0120 protected:
0121 
0122     /*
0123      * Since this class has pure virtual functions,
0124      * a constructor can't be used.
0125      * @stable ICU 2.0
0126      */
0127 /*    UnicodeFilter();*/
0128 };
0129 
0130 /*inline UnicodeFilter::UnicodeFilter() {}*/
0131 
0132 U_NAMESPACE_END
0133 
0134 #endif /* U_SHOW_CPLUSPLUS_API */
0135 
0136 #endif