diff --git a/icu4c/source/i18n/unicode/cpdtrans.h b/icu4c/source/i18n/unicode/cpdtrans.h index f231d7dbf29..24143b88438 100644 --- a/icu4c/source/i18n/unicode/cpdtrans.h +++ b/icu4c/source/i18n/unicode/cpdtrans.h @@ -34,7 +34,7 @@ class U_I18N_API UVector; *

Copyright © IBM Corporation 1999. All rights reserved. * * @author Alan Liu - * @version $RCSfile: cpdtrans.h,v $ $Revision: 1.17 $ $Date: 2001/08/31 03:22:53 $ + * @version $RCSfile: cpdtrans.h,v $ $Revision: 1.18 $ $Date: 2001/09/22 03:36:34 $ * @draft */ class U_I18N_API CompoundTransliterator : public Transliterator { @@ -215,5 +215,63 @@ private: void freeTransliterators(void); void computeMaximumContextLength(void); -}; + + +#ifdef U_USE_DEPRECATED_TRANSLITERATOR_API + +public: + + /** + * Constructs a new compound transliterator. + * @param filter the filter. Any character for which + * filter.isIn() returns false will not be + * altered by this transliterator. If filter is + * null then no filtering is applied. + * @deprecated Remove after Aug 2002. Use the constructor that takes + * UParseError as one of the paramerters. + */ + CompoundTransliterator(const UnicodeString& id, + UTransDirection dir, + UnicodeFilter* adoptedFilter, + UErrorCode& status); + + /** + * Constructs a new compound transliterator in the FORWARD + * direction with a NULL filter. + * @deprecated Remove after Aug 2002. Use the constructor that takes + * UParseError as one of the parmeters. + */ + CompoundTransliterator(const UnicodeString& id, + UErrorCode& status); + +#endif +}; + +/** + * Definitions for deprecated API + * @deprecated Remove after Aug 2002 + */ + +#ifdef U_USE_DEPRECATED_TRANSLITERATOR_API + +inline CompoundTransliterator::CompoundTransliterator( const UnicodeString& id, + UTransDirection dir, + UnicodeFilter* adoptedFilter, + UErrorCode& status): + Transliterator(id, adoptedFilter), + trans(0), compoundRBTIndex(-1) { + UParseError parseError; + init(id, dir, -1, 0, TRUE,parseError,status); +} + +inline CompoundTransliterator::CompoundTransliterator(const UnicodeString& id, + UErrorCode& status) : + Transliterator(id, 0), // set filter to 0 here! + trans(0), compoundRBTIndex(-1) { + UParseError parseError; + init(id, UTRANS_FORWARD, -1, 0, TRUE,parseError,status); +} + +#endif + #endif diff --git a/icu4c/source/i18n/unicode/translit.h b/icu4c/source/i18n/unicode/translit.h index da2634f7199..d26c89fd928 100644 --- a/icu4c/source/i18n/unicode/translit.h +++ b/icu4c/source/i18n/unicode/translit.h @@ -925,6 +925,49 @@ protected: private: static void initializeRegistry(void); + +#ifdef U_USE_DEPRECATED_TRANSLITERATOR_API +public: + /** + * Returns a Transliterator object given its ID. + * The ID must be either a system transliterator ID or a ID registered + * using registerInstance(). + * + * @param ID a valid ID, as enumerated by getAvailableIDs() + * @return A Transliterator object with the given ID + * @exception IllegalArgumentException if the given ID is invalid. + * @see #registerInstance + * @see #getAvailableIDs + * @see #getID + * @deprecated Remove after Aug 2002 use factory mehod that takes UParseError + * and UErrorCode + */ + inline Transliterator* createInstance(const UnicodeString& ID, + UTransDirection dir=UTRANS_FORWARD, + UParseError* parseError=0); + /** + * Returns this transliterator's inverse. See the class + * documentation for details. This implementation simply inverts + * the two entities in the ID and attempts to retrieve the + * resulting transliterator. That is, if getID() + * returns "A-B", then this method will return the result of + * getInstance("B-A"), or null if that + * call fails. + * + *

This method does not take filtering into account. The + * returned transliterator will have no filter. + * + *

Subclasses with knowledge of their inverse may wish to + * override this method. + * + * @return a transliterator that is an inverse, not necessarily + * exact, of this transliterator, or null if no such + * transliterator is registered. + * @deprecated Remove after Aug 2002 use factory mehod that takes UErrorCode + */ + inline Transliterator* createInverse() const; + +#endif }; inline int32_t Transliterator::getMaximumContextLength(void) const { @@ -935,4 +978,30 @@ inline void Transliterator::setID(const UnicodeString& id) { ID = id; } +/** + * Definitions for deprecated API + * @deprecated Remove after Aug 2002 + */ +#ifdef U_USE_DEPRECATED_TRANSLITERATOR_API + +inline Transliterator* Transliterator::createInstance(const UnicodeString& ID, + UTransDirection dir, + UParseError* parseError){ + UErrorCode status = U_ZERO_ERROR; + UParseError error; + if(parseError == NULL){ + parseError = &error; + } + return Transliterator::createInstance(ID,dir,*parseError,status); + } + +inline Transliterator* Transliterator::createInverse() const{ + + UErrorCode status = U_ZERO_ERROR; + return createInverse(status); +} + #endif + +#endif +