1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/common/unicode/unifunct.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,125 @@
1.4 +/*
1.5 +**********************************************************************
1.6 +* Copyright (c) 2002-2005, International Business Machines Corporation
1.7 +* and others. All Rights Reserved.
1.8 +**********************************************************************
1.9 +* Date Name Description
1.10 +* 01/14/2002 aliu Creation.
1.11 +**********************************************************************
1.12 +*/
1.13 +#ifndef UNIFUNCT_H
1.14 +#define UNIFUNCT_H
1.15 +
1.16 +#include "unicode/utypes.h"
1.17 +#include "unicode/uobject.h"
1.18 +
1.19 +/**
1.20 + * \file
1.21 + * \brief C++ API: Unicode Functor
1.22 + */
1.23 +
1.24 +U_NAMESPACE_BEGIN
1.25 +
1.26 +class UnicodeMatcher;
1.27 +class UnicodeReplacer;
1.28 +class TransliterationRuleData;
1.29 +
1.30 +/**
1.31 + * <code>UnicodeFunctor</code> is an abstract base class for objects
1.32 + * that perform match and/or replace operations on Unicode strings.
1.33 + * @author Alan Liu
1.34 + * @stable ICU 2.4
1.35 + */
1.36 +class U_COMMON_API UnicodeFunctor : public UObject {
1.37 +
1.38 +public:
1.39 +
1.40 + /**
1.41 + * Destructor
1.42 + * @stable ICU 2.4
1.43 + */
1.44 + virtual ~UnicodeFunctor();
1.45 +
1.46 + /**
1.47 + * Return a copy of this object. All UnicodeFunctor objects
1.48 + * have to support cloning in order to allow classes using
1.49 + * UnicodeFunctor to implement cloning.
1.50 + * @stable ICU 2.4
1.51 + */
1.52 + virtual UnicodeFunctor* clone() const = 0;
1.53 +
1.54 + /**
1.55 + * Cast 'this' to a UnicodeMatcher* pointer and return the
1.56 + * pointer, or null if this is not a UnicodeMatcher*. Subclasses
1.57 + * that mix in UnicodeMatcher as a base class must override this.
1.58 + * This protocol is required because a pointer to a UnicodeFunctor
1.59 + * cannot be cast to a pointer to a UnicodeMatcher, since
1.60 + * UnicodeMatcher is a mixin that does not derive from
1.61 + * UnicodeFunctor.
1.62 + * @stable ICU 2.4
1.63 + */
1.64 + virtual UnicodeMatcher* toMatcher() const;
1.65 +
1.66 + /**
1.67 + * Cast 'this' to a UnicodeReplacer* pointer and return the
1.68 + * pointer, or null if this is not a UnicodeReplacer*. Subclasses
1.69 + * that mix in UnicodeReplacer as a base class must override this.
1.70 + * This protocol is required because a pointer to a UnicodeFunctor
1.71 + * cannot be cast to a pointer to a UnicodeReplacer, since
1.72 + * UnicodeReplacer is a mixin that does not derive from
1.73 + * UnicodeFunctor.
1.74 + * @stable ICU 2.4
1.75 + */
1.76 + virtual UnicodeReplacer* toReplacer() const;
1.77 +
1.78 + /**
1.79 + * Return the class ID for this class. This is useful only for
1.80 + * comparing to a return value from getDynamicClassID().
1.81 + * @return The class ID for all objects of this class.
1.82 + * @stable ICU 2.0
1.83 + */
1.84 + static UClassID U_EXPORT2 getStaticClassID(void);
1.85 +
1.86 + /**
1.87 + * Returns a unique class ID <b>polymorphically</b>. This method
1.88 + * is to implement a simple version of RTTI, since not all C++
1.89 + * compilers support genuine RTTI. Polymorphic operator==() and
1.90 + * clone() methods call this method.
1.91 + *
1.92 + * <p>Concrete subclasses of UnicodeFunctor should use the macro
1.93 + * UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to
1.94 + * provide definitios getStaticClassID and getDynamicClassID.
1.95 + *
1.96 + * @return The class ID for this object. All objects of a given
1.97 + * class have the same class ID. Objects of other classes have
1.98 + * different class IDs.
1.99 + * @stable ICU 2.4
1.100 + */
1.101 + virtual UClassID getDynamicClassID(void) const = 0;
1.102 +
1.103 + /**
1.104 + * Set the data object associated with this functor. The data
1.105 + * object provides context for functor-to-standin mapping. This
1.106 + * method is required when assigning a functor to a different data
1.107 + * object. This function MAY GO AWAY later if the architecture is
1.108 + * changed to pass data object pointers through the API.
1.109 + * @internal ICU 2.1
1.110 + */
1.111 + virtual void setData(const TransliterationRuleData*) = 0;
1.112 +
1.113 +protected:
1.114 +
1.115 + /**
1.116 + * Since this class has pure virtual functions,
1.117 + * a constructor can't be used.
1.118 + * @stable ICU 2.0
1.119 + */
1.120 + /*UnicodeFunctor();*/
1.121 +
1.122 +};
1.123 +
1.124 +/*inline UnicodeFunctor::UnicodeFunctor() {}*/
1.125 +
1.126 +U_NAMESPACE_END
1.127 +
1.128 +#endif