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