Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:12

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 **********************************************************************
0005 *   Copyright (c) 2002-2005, International Business Machines Corporation
0006 *   and others.  All Rights Reserved.
0007 **********************************************************************
0008 *   Date        Name        Description
0009 *   01/14/2002  aliu        Creation.
0010 **********************************************************************
0011 */
0012 #ifndef UNIFUNCT_H
0013 #define UNIFUNCT_H
0014 
0015 #include "unicode/utypes.h"
0016 
0017 #if U_SHOW_CPLUSPLUS_API
0018 
0019 #include "unicode/uobject.h"
0020 
0021 /**
0022  * \file 
0023  * \brief C++ API: Unicode Functor
0024  */
0025  
0026 U_NAMESPACE_BEGIN
0027 
0028 class UnicodeMatcher;
0029 class UnicodeReplacer;
0030 class TransliterationRuleData;
0031 
0032 /**
0033  * <code>UnicodeFunctor</code> is an abstract base class for objects
0034  * that perform match and/or replace operations on Unicode strings.
0035  * @author Alan Liu
0036  * @stable ICU 2.4
0037  */
0038 class U_COMMON_API UnicodeFunctor : public UObject {
0039 
0040 public:
0041 
0042     /**
0043      * Destructor
0044      * @stable ICU 2.4
0045      */
0046     virtual ~UnicodeFunctor();
0047 
0048     /**
0049      * Return a copy of this object.  All UnicodeFunctor objects
0050      * have to support cloning in order to allow classes using
0051      * UnicodeFunctor to implement cloning.
0052      * @stable ICU 2.4
0053      */
0054     virtual UnicodeFunctor* clone() const = 0;
0055 
0056     /**
0057      * Cast 'this' to a UnicodeMatcher* pointer and return the
0058      * pointer, or null if this is not a UnicodeMatcher*.  Subclasses
0059      * that mix in UnicodeMatcher as a base class must override this.
0060      * This protocol is required because a pointer to a UnicodeFunctor
0061      * cannot be cast to a pointer to a UnicodeMatcher, since
0062      * UnicodeMatcher is a mixin that does not derive from
0063      * UnicodeFunctor.
0064      * @stable ICU 2.4
0065      */
0066     virtual UnicodeMatcher* toMatcher() const;
0067 
0068     /**
0069      * Cast 'this' to a UnicodeReplacer* pointer and return the
0070      * pointer, or null if this is not a UnicodeReplacer*.  Subclasses
0071      * that mix in UnicodeReplacer as a base class must override this.
0072      * This protocol is required because a pointer to a UnicodeFunctor
0073      * cannot be cast to a pointer to a UnicodeReplacer, since
0074      * UnicodeReplacer is a mixin that does not derive from
0075      * UnicodeFunctor.
0076      * @stable ICU 2.4
0077      */
0078     virtual UnicodeReplacer* toReplacer() const;
0079 
0080     /**
0081      * Return the class ID for this class.  This is useful only for
0082      * comparing to a return value from getDynamicClassID().
0083      * @return          The class ID for all objects of this class.
0084      * @stable ICU 2.0
0085      */
0086     static UClassID U_EXPORT2 getStaticClassID(void);
0087 
0088     /**
0089      * Returns a unique class ID <b>polymorphically</b>.  This method
0090      * is to implement a simple version of RTTI, since not all C++
0091      * compilers support genuine RTTI.  Polymorphic operator==() and
0092      * clone() methods call this method.
0093      *
0094      * <p>Concrete subclasses of UnicodeFunctor should use the macro
0095      *    UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to
0096      *    provide definitions getStaticClassID and getDynamicClassID.
0097      *
0098      * @return The class ID for this object. All objects of a given
0099      * class have the same class ID.  Objects of other classes have
0100      * different class IDs.
0101      * @stable ICU 2.4
0102      */
0103     virtual UClassID getDynamicClassID(void) const override = 0;
0104 
0105     /**
0106      * Set the data object associated with this functor.  The data
0107      * object provides context for functor-to-standin mapping.  This
0108      * method is required when assigning a functor to a different data
0109      * object.  This function MAY GO AWAY later if the architecture is
0110      * changed to pass data object pointers through the API.
0111      * @internal ICU 2.1
0112      */
0113     virtual void setData(const TransliterationRuleData*) = 0;
0114 
0115 protected:
0116 
0117     /**
0118      * Since this class has pure virtual functions,
0119      * a constructor can't be used.
0120      * @stable ICU 2.0
0121      */
0122     /*UnicodeFunctor();*/
0123 
0124 };
0125 
0126 /*inline UnicodeFunctor::UnicodeFunctor() {}*/
0127 
0128 U_NAMESPACE_END
0129 
0130 #endif /* U_SHOW_CPLUSPLUS_API */
0131 
0132 #endif