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