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