~ubuntu-branches/ubuntu/gutsy/icu/gutsy-updates

« back to all changes in this revision

Viewing changes to source/i18n/unicode/unifilt.h

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2005-11-19 11:29:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20051119112931-vcizkrp10tli4enw
Tags: 3.4-3
Explicitly build with g++ 3.4.  The current ICU fails its test suite
with 4.0 but not with 3.4.  Future versions should work properly with
4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
* Copyright (C) 1999, International Business Machines Corporation and others. All Rights Reserved.
3
 
**********************************************************************
4
 
*   Date        Name        Description
5
 
*   11/17/99    aliu        Creation.
6
 
**********************************************************************
7
 
*/
8
 
#ifndef UNIFILT_H
9
 
#define UNIFILT_H
10
 
 
11
 
#include "unicode/unifunct.h"
12
 
#include "unicode/unimatch.h"
13
 
 
14
 
U_NAMESPACE_BEGIN
15
 
 
16
 
/**
17
 
 * <code>UnicodeFilter</code> defines a protocol for selecting a
18
 
 * subset of the full range (U+0000 to U+10FFFF) of Unicode characters.
19
 
 * Currently, filters are used in conjunction with classes like {@link
20
 
 * Transliterator} to only process selected characters through a
21
 
 * transformation.
22
 
 *
23
 
 * <p>Note: UnicodeFilter currently stubs out two pure virtual methods
24
 
 * of its base class, UnicodeMatcher.  These methods are toPattern()
25
 
 * and matchesIndexValue().  This is done so that filter classes that
26
 
 * are not actually used as matchers -- specifically, those in the
27
 
 * UnicodeFilterLogic component, and those in tests -- can continue to
28
 
 * work without defining these methods.  As long as a filter is not
29
 
 * used in an RBT during real transliteration, these methods will not
30
 
 * be called.  However, this breaks the UnicodeMatcher base class
31
 
 * protocol, and it is not a correct solution.
32
 
 *
33
 
 * <p>In the future we may revisit the UnicodeMatcher / UnicodeFilter
34
 
 * hierarchy and either redesign it, or simply remove the stubs in
35
 
 * UnicodeFilter and force subclasses to implement the full
36
 
 * UnicodeMatcher protocol.
37
 
 *
38
 
 * @see UnicodeFilterLogic
39
 
 * @stable
40
 
 */
41
 
class U_I18N_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher {
42
 
 
43
 
public:
44
 
    /**
45
 
     * Destructor
46
 
     * @stable
47
 
     */
48
 
    virtual ~UnicodeFilter();
49
 
 
50
 
    /**
51
 
     * Returns <tt>true</tt> for characters that are in the selected
52
 
     * subset.  In other words, if a character is <b>to be
53
 
     * filtered</b>, then <tt>contains()</tt> returns
54
 
     * <b><tt>false</tt></b>.
55
 
     * @stable
56
 
     */
57
 
    virtual UBool contains(UChar32 c) const = 0;
58
 
 
59
 
    /**
60
 
     * UnicodeFunctor API.  Cast 'this' to a UnicodeMatcher* pointer
61
 
     * and return the pointer.
62
 
     */
63
 
    virtual UnicodeMatcher* toMatcher() const;
64
 
 
65
 
    /**
66
 
     * UnicodeMatcher API.  This class stubs this out.
67
 
     */
68
 
    UnicodeString& toPattern(UnicodeString& result,
69
 
                             UBool escapeUnprintable) const;
70
 
 
71
 
    /**
72
 
     * UnicodeMatcher API.  This class stubs this out.
73
 
     */
74
 
    UBool matchesIndexValue(uint8_t v) const;
75
 
 
76
 
    /**
77
 
     * Implement UnicodeMatcher API.
78
 
     */
79
 
    virtual UMatchDegree matches(const Replaceable& text,
80
 
                                 int32_t& offset,
81
 
                                 int32_t limit,
82
 
                                 UBool incremental);
83
 
 
84
 
    /**
85
 
     * UnicodeFunctor API.  Nothing to do.
86
 
     */
87
 
    virtual void setData(const TransliterationRuleData*) {}
88
 
 
89
 
protected:
90
 
 
91
 
    UnicodeFilter();
92
 
};
93
 
 
94
 
inline UnicodeFilter::UnicodeFilter() {}
95
 
inline UnicodeFilter::~UnicodeFilter() {}
96
 
 
97
 
U_NAMESPACE_END
98
 
 
99
 
#endif