sl@0: /* sl@0: ********************************************************************** sl@0: * Copyright (c) 2002-2005, International Business Machines Corporation sl@0: * and others. All Rights Reserved. sl@0: ********************************************************************** sl@0: * Date Name Description sl@0: * 01/14/2002 aliu Creation. sl@0: ********************************************************************** sl@0: */ sl@0: #ifndef UNIFUNCT_H sl@0: #define UNIFUNCT_H sl@0: sl@0: #include "unicode/utypes.h" sl@0: #include "unicode/uobject.h" sl@0: sl@0: /** sl@0: * \file sl@0: * \brief C++ API: Unicode Functor sl@0: */ sl@0: sl@0: U_NAMESPACE_BEGIN sl@0: sl@0: class UnicodeMatcher; sl@0: class UnicodeReplacer; sl@0: class TransliterationRuleData; sl@0: sl@0: /** sl@0: * UnicodeFunctor is an abstract base class for objects sl@0: * that perform match and/or replace operations on Unicode strings. sl@0: * @author Alan Liu sl@0: * @stable ICU 2.4 sl@0: */ sl@0: class U_COMMON_API UnicodeFunctor : public UObject { sl@0: sl@0: public: sl@0: sl@0: /** sl@0: * Destructor sl@0: * @stable ICU 2.4 sl@0: */ sl@0: virtual ~UnicodeFunctor(); sl@0: sl@0: /** sl@0: * Return a copy of this object. All UnicodeFunctor objects sl@0: * have to support cloning in order to allow classes using sl@0: * UnicodeFunctor to implement cloning. sl@0: * @stable ICU 2.4 sl@0: */ sl@0: virtual UnicodeFunctor* clone() const = 0; sl@0: sl@0: /** sl@0: * Cast 'this' to a UnicodeMatcher* pointer and return the sl@0: * pointer, or null if this is not a UnicodeMatcher*. Subclasses sl@0: * that mix in UnicodeMatcher as a base class must override this. sl@0: * This protocol is required because a pointer to a UnicodeFunctor sl@0: * cannot be cast to a pointer to a UnicodeMatcher, since sl@0: * UnicodeMatcher is a mixin that does not derive from sl@0: * UnicodeFunctor. sl@0: * @stable ICU 2.4 sl@0: */ sl@0: virtual UnicodeMatcher* toMatcher() const; sl@0: sl@0: /** sl@0: * Cast 'this' to a UnicodeReplacer* pointer and return the sl@0: * pointer, or null if this is not a UnicodeReplacer*. Subclasses sl@0: * that mix in UnicodeReplacer as a base class must override this. sl@0: * This protocol is required because a pointer to a UnicodeFunctor sl@0: * cannot be cast to a pointer to a UnicodeReplacer, since sl@0: * UnicodeReplacer is a mixin that does not derive from sl@0: * UnicodeFunctor. sl@0: * @stable ICU 2.4 sl@0: */ sl@0: virtual UnicodeReplacer* toReplacer() const; sl@0: sl@0: /** sl@0: * Return the class ID for this class. This is useful only for sl@0: * comparing to a return value from getDynamicClassID(). sl@0: * @return The class ID for all objects of this class. sl@0: * @stable ICU 2.0 sl@0: */ sl@0: static UClassID U_EXPORT2 getStaticClassID(void); sl@0: sl@0: /** sl@0: * Returns a unique class ID polymorphically. This method sl@0: * is to implement a simple version of RTTI, since not all C++ sl@0: * compilers support genuine RTTI. Polymorphic operator==() and sl@0: * clone() methods call this method. sl@0: * sl@0: *

Concrete subclasses of UnicodeFunctor should use the macro sl@0: * UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to sl@0: * provide definitios getStaticClassID and getDynamicClassID. sl@0: * sl@0: * @return The class ID for this object. All objects of a given sl@0: * class have the same class ID. Objects of other classes have sl@0: * different class IDs. sl@0: * @stable ICU 2.4 sl@0: */ sl@0: virtual UClassID getDynamicClassID(void) const = 0; sl@0: sl@0: /** sl@0: * Set the data object associated with this functor. The data sl@0: * object provides context for functor-to-standin mapping. This sl@0: * method is required when assigning a functor to a different data sl@0: * object. This function MAY GO AWAY later if the architecture is sl@0: * changed to pass data object pointers through the API. sl@0: * @internal ICU 2.1 sl@0: */ sl@0: virtual void setData(const TransliterationRuleData*) = 0; sl@0: sl@0: protected: sl@0: sl@0: /** sl@0: * Since this class has pure virtual functions, sl@0: * a constructor can't be used. sl@0: * @stable ICU 2.0 sl@0: */ sl@0: /*UnicodeFunctor();*/ sl@0: sl@0: }; sl@0: sl@0: /*inline UnicodeFunctor::UnicodeFunctor() {}*/ sl@0: sl@0: U_NAMESPACE_END sl@0: sl@0: #endif