+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
-* Copyright (C) 1999-2008, International Business Machines
+* Copyright (C) 1999-2014, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Date Name Description
#include "unicode/utrans.h" // UTransPosition, UTransDirection
#include "unicode/strenum.h"
+#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
class UnicodeFilter;
void* pointer;
};
+#ifndef U_HIDE_INTERNAL_API
/**
* Return a token containing an integer.
* @return a token containing an integer.
* @internal
*/
inline static Token pointerToken(void*);
+#endif /* U_HIDE_INTERNAL_API */
/**
* A function that creates and returns a Transliterator. When
* Transliterates the portion of the text buffer that can be
* transliterated unambiguosly after a new character has been
* inserted, typically as a result of a keyboard event. This is a
- * convenience method; see {@link
- * #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode&) const}
- * for details.
+ * convenience method.
* @param text the buffer holding transliterated and
* untransliterated text
- * @param index an array of three integers. See {@link
- * #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode&) const }.
+ * @param index an array of three integers.
* @param insertion text to be inserted and possibly
* transliterated into the translation buffer at
* <code>index.limit</code>.
* for details.
* @param text the buffer holding transliterated and
* untransliterated text
- * @param index an array of three integers. See {@link
- * #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode&) const }.
+ * @param index an array of three integers. See {@link #transliterate(Replaceable&, UTransPosition&, const UnicodeString*, UErrorCode&) const }.
* @param status Output param to filled in with a success or an error.
* @see #transliterate(Replaceable, int[], String)
* @stable ICU 2.0
*
* <p>If this transliterator has a filter, break up the input text into runs
* of unfiltered characters. Pass each run to
- * <subclass>.handleTransliterate().
+ * subclass.handleTransliterate().
*
* <p>In incremental mode, if rollback is TRUE, perform a special
* incremental procedure in which several passes are made over the input
/**
* Registers a factory function that creates transliterators of
* a given ID.
+ *
+ * Because ICU may choose to cache Transliterators internally, this must
+ * be called at application startup, prior to any calls to
+ * Transliterator::createXXX to avoid undefined behavior.
+ *
* @param id the ID being registered
* @param factory a function pointer that will be copied and
* called later when the given ID is passed to createInstance()
* After this call the Transliterator class owns the adoptedObj
* and will delete it.
*
+ * Because ICU may choose to cache Transliterators internally, this must
+ * be called at application startup, prior to any calls to
+ * Transliterator::createXXX to avoid undefined behavior.
+ *
* @param adoptedObj an instance of subclass of
* <code>Transliterator</code> that defines <tt>clone()</tt>
* @see #createInstance
protected:
+#ifndef U_HIDE_INTERNAL_API
/**
- * @internal
* @param id the ID being registered
* @param factory a function pointer that will be copied and
* called later when the given ID is passed to createInstance()
* @param context a context pointer that will be stored and
* later passed to the factory function when an ID matching
* the registration ID is being instantiated with this factory.
+ * @internal
*/
static void _registerFactory(const UnicodeString& id,
Factory factory,
static void _registerSpecialInverse(const UnicodeString& target,
const UnicodeString& inverseTarget,
UBool bidirectional);
+#endif /* U_HIDE_INTERNAL_API */
public:
* Any attempt to construct an unregistered transliterator based
* on its ID will fail.
*
+ * Because ICU may choose to cache Transliterators internally, this should
+ * be called during application shutdown, after all calls to
+ * Transliterator::createXXX to avoid undefined behavior.
+ *
* @param ID the ID of the transliterator or class
* @return the <code>Object</code> that was registered with
* <code>ID</code>, or <code>null</code> if none was
protected:
+#ifndef U_HIDE_INTERNAL_API
/**
* Non-mutexed internal method
* @internal
const UnicodeString& source,
const UnicodeString& target,
UnicodeString& result);
+#endif /* U_HIDE_INTERNAL_API */
protected:
static UBool initializeRegistry(UErrorCode &status);
public:
+#ifndef U_HIDE_OBSOLETE_API
/**
* Return the number of IDs currently registered with the system.
* To retrieve the actual IDs, call getAvailableID(i) with
* may become invalid if another thread calls unregister
*/
static const UnicodeString& U_EXPORT2 getAvailableID(int32_t index);
+#endif /* U_HIDE_OBSOLETE_API */
};
inline int32_t Transliterator::getMaximumContextLength(void) const {
inline void Transliterator::setID(const UnicodeString& id) {
ID = id;
// NUL-terminate the ID string, which is a non-aliased copy.
- ID.append((UChar)0);
+ ID.append((char16_t)0);
ID.truncate(ID.length()-1);
}
+#ifndef U_HIDE_INTERNAL_API
inline Transliterator::Token Transliterator::integerToken(int32_t i) {
Token t;
t.integer = i;
t.pointer = p;
return t;
}
+#endif /* U_HIDE_INTERNAL_API */
U_NAMESPACE_END
+#endif // U_SHOW_CPLUSPLUS_API
#endif /* #if !UCONFIG_NO_TRANSLITERATION */