]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/unicode/unifunct.h
ICU-6.2.8.tar.gz
[apple/icu.git] / icuSources / common / unicode / unifunct.h
1 /*
2 **********************************************************************
3 * Copyright (c) 2002-2004, International Business Machines Corporation
4 * and others. All Rights Reserved.
5 **********************************************************************
6 * Date Name Description
7 * 01/14/2002 aliu Creation.
8 **********************************************************************
9 */
10 #ifndef UNIFUNCT_H
11 #define UNIFUNCT_H
12
13 #include "unicode/utypes.h"
14 #include "unicode/uobject.h"
15
16 U_NAMESPACE_BEGIN
17
18 class UnicodeMatcher;
19 class UnicodeReplacer;
20 class TransliterationRuleData;
21
22 /**
23 * <code>UnicodeFunctor</code> is an abstract base class for objects
24 * that perform match and/or replace operations on Unicode strings.
25 * @author Alan Liu
26 * @stable ICU 2.4
27 */
28 class U_COMMON_API UnicodeFunctor : public UObject {
29
30 public:
31
32 /**
33 * Destructor
34 * @stable ICU 2.4
35 */
36 virtual ~UnicodeFunctor();
37
38 /**
39 * Return a copy of this object. All UnicodeFunctor objects
40 * have to support cloning in order to allow classes using
41 * UnicodeFunctor to implement cloning.
42 * @stable ICU 2.4
43 */
44 virtual UnicodeFunctor* clone() const = 0;
45
46 /**
47 * Cast 'this' to a UnicodeMatcher* pointer and return the
48 * pointer, or null if this is not a UnicodeMatcher*. Subclasses
49 * that mix in UnicodeMatcher as a base class must override this.
50 * This protocol is required because a pointer to a UnicodeFunctor
51 * cannot be cast to a pointer to a UnicodeMatcher, since
52 * UnicodeMatcher is a mixin that does not derive from
53 * UnicodeFunctor.
54 * @stable ICU 2.4
55 */
56 virtual UnicodeMatcher* toMatcher() const;
57
58 /**
59 * Cast 'this' to a UnicodeReplacer* pointer and return the
60 * pointer, or null if this is not a UnicodeReplacer*. Subclasses
61 * that mix in UnicodeReplacer as a base class must override this.
62 * This protocol is required because a pointer to a UnicodeFunctor
63 * cannot be cast to a pointer to a UnicodeReplacer, since
64 * UnicodeReplacer is a mixin that does not derive from
65 * UnicodeFunctor.
66 * @stable ICU 2.4
67 */
68 virtual UnicodeReplacer* toReplacer() const;
69
70 /**
71 * Return the class ID for this class. This is useful only for
72 * comparing to a return value from getDynamicClassID().
73 * @return The class ID for all objects of this class.
74 * @stable ICU 2.0
75 */
76 static UClassID U_EXPORT2 getStaticClassID(void);
77
78 /**
79 * Returns a unique class ID <b>polymorphically</b>. This method
80 * is to implement a simple version of RTTI, since not all C++
81 * compilers support genuine RTTI. Polymorphic operator==() and
82 * clone() methods call this method.
83 *
84 * <p>Concrete subclasses of UnicodeFunctor should use the macro
85 * UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to
86 * provide definitios getStaticClassID and getDynamicClassID.
87 *
88 * @return The class ID for this object. All objects of a given
89 * class have the same class ID. Objects of other classes have
90 * different class IDs.
91 * @stable ICU 2.4
92 */
93 virtual UClassID getDynamicClassID(void) const = 0;
94
95 /**
96 * Set the data object associated with this functor. The data
97 * object provides context for functor-to-standin mapping. This
98 * method is required when assigning a functor to a different data
99 * object. This function MAY GO AWAY later if the architecture is
100 * changed to pass data object pointers through the API.
101 * @internal ICU 2.1
102 */
103 virtual void setData(const TransliterationRuleData*) = 0;
104
105 protected:
106
107 /**
108 * Since this class has pure virtual functions,
109 * a constructor can't be used.
110 * @stable ICU 2.0
111 */
112 /*UnicodeFunctor();*/
113
114 };
115
116 /*inline UnicodeFunctor::UnicodeFunctor() {}*/
117
118 U_NAMESPACE_END
119
120 #endif