2002-02-07 01:07:55 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
2005-06-22 22:39:36 +00:00
|
|
|
* Copyright (c) 2002-2005, International Business Machines Corporation
|
2002-02-07 01:07:55 +00:00
|
|
|
* and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
|
|
|
* Date Name Description
|
|
|
|
* 01/14/2002 aliu Creation.
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
|
|
|
#ifndef UNIFUNCT_H
|
|
|
|
#define UNIFUNCT_H
|
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
2002-06-27 01:19:20 +00:00
|
|
|
#include "unicode/uobject.h"
|
2002-02-07 01:07:55 +00:00
|
|
|
|
2005-06-22 22:39:36 +00:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* \brief C++ API: Unicode Functor
|
|
|
|
*/
|
|
|
|
|
2002-02-07 01:07:55 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class UnicodeMatcher;
|
|
|
|
class UnicodeReplacer;
|
2002-03-20 00:42:02 +00:00
|
|
|
class TransliterationRuleData;
|
2002-02-07 01:07:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* <code>UnicodeFunctor</code> is an abstract base class for objects
|
|
|
|
* that perform match and/or replace operations on Unicode strings.
|
|
|
|
* @author Alan Liu
|
2004-03-26 19:42:04 +00:00
|
|
|
* @stable ICU 2.4
|
2002-02-07 01:07:55 +00:00
|
|
|
*/
|
2002-06-27 01:19:20 +00:00
|
|
|
class U_COMMON_API UnicodeFunctor : public UObject {
|
2002-02-07 01:07:55 +00:00
|
|
|
|
2003-08-27 01:01:42 +00:00
|
|
|
public:
|
2002-02-07 01:07:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor
|
2004-03-26 19:42:04 +00:00
|
|
|
* @stable ICU 2.4
|
2002-02-07 01:07:55 +00:00
|
|
|
*/
|
|
|
|
virtual ~UnicodeFunctor();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a copy of this object. All UnicodeFunctor objects
|
|
|
|
* have to support cloning in order to allow classes using
|
|
|
|
* UnicodeFunctor to implement cloning.
|
2004-03-26 19:42:04 +00:00
|
|
|
* @stable ICU 2.4
|
2002-02-07 01:07:55 +00:00
|
|
|
*/
|
|
|
|
virtual UnicodeFunctor* clone() const = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cast 'this' to a UnicodeMatcher* pointer and return the
|
|
|
|
* pointer, or null if this is not a UnicodeMatcher*. Subclasses
|
|
|
|
* that mix in UnicodeMatcher as a base class must override this.
|
|
|
|
* This protocol is required because a pointer to a UnicodeFunctor
|
|
|
|
* cannot be cast to a pointer to a UnicodeMatcher, since
|
|
|
|
* UnicodeMatcher is a mixin that does not derive from
|
|
|
|
* UnicodeFunctor.
|
2004-03-26 19:42:04 +00:00
|
|
|
* @stable ICU 2.4
|
2002-02-07 01:07:55 +00:00
|
|
|
*/
|
|
|
|
virtual UnicodeMatcher* toMatcher() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cast 'this' to a UnicodeReplacer* pointer and return the
|
|
|
|
* pointer, or null if this is not a UnicodeReplacer*. Subclasses
|
|
|
|
* that mix in UnicodeReplacer as a base class must override this.
|
|
|
|
* This protocol is required because a pointer to a UnicodeFunctor
|
|
|
|
* cannot be cast to a pointer to a UnicodeReplacer, since
|
|
|
|
* UnicodeReplacer is a mixin that does not derive from
|
|
|
|
* UnicodeFunctor.
|
2004-03-26 19:42:04 +00:00
|
|
|
* @stable ICU 2.4
|
2002-02-07 01:07:55 +00:00
|
|
|
*/
|
|
|
|
virtual UnicodeReplacer* toReplacer() const;
|
|
|
|
|
2004-05-28 20:13:11 +00:00
|
|
|
/**
|
2002-02-07 01:07:55 +00:00
|
|
|
* Return the class ID for this class. This is useful only for
|
2004-08-24 17:21:14 +00:00
|
|
|
* comparing to a return value from getDynamicClassID().
|
2002-02-07 01:07:55 +00:00
|
|
|
* @return The class ID for all objects of this class.
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2002-02-07 01:07:55 +00:00
|
|
|
*/
|
2004-08-24 17:21:14 +00:00
|
|
|
static UClassID U_EXPORT2 getStaticClassID(void);
|
2002-02-07 01:07:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a unique class ID <b>polymorphically</b>. This method
|
|
|
|
* is to implement a simple version of RTTI, since not all C++
|
|
|
|
* compilers support genuine RTTI. Polymorphic operator==() and
|
|
|
|
* clone() methods call this method.
|
2004-08-24 17:21:14 +00:00
|
|
|
*
|
2004-05-28 20:13:11 +00:00
|
|
|
* <p>Concrete subclasses of UnicodeFunctor should use the macro
|
|
|
|
* UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to
|
|
|
|
* provide definitios getStaticClassID and getDynamicClassID.
|
2002-02-07 01:07:55 +00:00
|
|
|
*
|
|
|
|
* @return The class ID for this object. All objects of a given
|
|
|
|
* class have the same class ID. Objects of other classes have
|
|
|
|
* different class IDs.
|
2004-03-26 19:42:04 +00:00
|
|
|
* @stable ICU 2.4
|
2002-02-07 01:07:55 +00:00
|
|
|
*/
|
2004-06-04 01:16:05 +00:00
|
|
|
virtual UClassID getDynamicClassID(void) const = 0;
|
2002-02-07 01:07:55 +00:00
|
|
|
|
2002-03-20 00:42:02 +00:00
|
|
|
/**
|
|
|
|
* Set the data object associated with this functor. The data
|
|
|
|
* object provides context for functor-to-standin mapping. This
|
|
|
|
* method is required when assigning a functor to a different data
|
|
|
|
* object. This function MAY GO AWAY later if the architecture is
|
|
|
|
* changed to pass data object pointers through the API.
|
2003-06-04 00:04:35 +00:00
|
|
|
* @internal ICU 2.1
|
2002-03-20 00:42:02 +00:00
|
|
|
*/
|
|
|
|
virtual void setData(const TransliterationRuleData*) = 0;
|
|
|
|
|
2003-08-27 01:01:42 +00:00
|
|
|
protected:
|
2002-02-07 01:07:55 +00:00
|
|
|
|
2003-06-05 19:50:06 +00:00
|
|
|
/**
|
2003-08-27 01:01:42 +00:00
|
|
|
* Since this class has pure virtual functions,
|
|
|
|
* a constructor can't be used.
|
2003-06-05 19:50:06 +00:00
|
|
|
* @stable ICU 2.0
|
|
|
|
*/
|
2003-08-27 01:01:42 +00:00
|
|
|
/*UnicodeFunctor();*/
|
2002-02-07 01:07:55 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2003-08-27 01:01:42 +00:00
|
|
|
/*inline UnicodeFunctor::UnicodeFunctor() {}*/
|
2002-02-07 01:07:55 +00:00
|
|
|
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|