ICU-359 Reinstate deleted deprecated API with U_USE_DEPRECATED_TRANSLITERATOR_API definition

X-SVN-Rev: 5900
This commit is contained in:
Ram Viswanadha 2001-09-22 03:36:34 +00:00
parent 9c7f478a35
commit 56e8f94332
2 changed files with 129 additions and 2 deletions

View file

@ -34,7 +34,7 @@ class U_I18N_API UVector;
* <p>Copyright &copy; 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
* <tt>filter.isIn()</tt> returns <tt>false</tt> will not be
* altered by this transliterator. If <tt>filter</tt> is
* <tt>null</tt> 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

View file

@ -925,6 +925,49 @@ protected:
private:
static void initializeRegistry(void);
#ifdef U_USE_DEPRECATED_TRANSLITERATOR_API
public:
/**
* Returns a <code>Transliterator</code> object given its ID.
* The ID must be either a system transliterator ID or a ID registered
* using <code>registerInstance()</code>.
*
* @param ID a valid ID, as enumerated by <code>getAvailableIDs()</code>
* @return A <code>Transliterator</code> 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 <code>getID()</code>
* returns "A-B", then this method will return the result of
* <code>getInstance("B-A")</code>, or <code>null</code> if that
* call fails.
*
* <p>This method does not take filtering into account. The
* returned transliterator will have no filter.
*
* <p>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 <code>null</code> 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