2 ********************************************************************** 
   3 *   Copyright (c) 2002-2005, International Business Machines Corporation 
   4 *   and others.  All Rights Reserved. 
   5 ********************************************************************** 
   6 *   Date        Name        Description 
   7 *   01/14/2002  aliu        Creation. 
   8 ********************************************************************** 
  13 #include "unicode/utypes.h" 
  14 #include "unicode/uobject.h" 
  18  * \brief C++ API: Unicode Functor 
  24 class UnicodeReplacer
; 
  25 class TransliterationRuleData
; 
  28  * <code>UnicodeFunctor</code> is an abstract base class for objects 
  29  * that perform match and/or replace operations on Unicode strings. 
  33 class U_COMMON_API UnicodeFunctor 
: public UObject 
{ 
  41     virtual ~UnicodeFunctor(); 
  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. 
  49     virtual UnicodeFunctor
* clone() const = 0; 
  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 
  61     virtual UnicodeMatcher
* toMatcher() const; 
  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 
  73     virtual UnicodeReplacer
* toReplacer() const; 
  76      * Return the class ID for this class.  This is useful only for 
  77      * comparing to a return value from getDynamicClassID(). 
  78      * @return          The class ID for all objects of this class. 
  81     static UClassID U_EXPORT2 
getStaticClassID(void); 
  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. 
  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. 
  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. 
  98     virtual UClassID 
getDynamicClassID(void) const = 0; 
 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. 
 108     virtual void setData(const TransliterationRuleData
*) = 0; 
 113      * Since this class has pure virtual functions, 
 114      * a constructor can't be used. 
 117     /*UnicodeFunctor();*/ 
 121 /*inline UnicodeFunctor::UnicodeFunctor() {}*/