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