mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-3078 add StringEnumeration* getAvailableIDs(); mark countAvailableIDs() and getAvailableID() as obsolete
X-SVN-Rev: 14553
This commit is contained in:
parent
0626ff10e1
commit
4ba4259df7
2 changed files with 48 additions and 18 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "unicode/unifltlg.h"
|
||||
#include "unicode/uniset.h"
|
||||
#include "unicode/uscript.h"
|
||||
#include "unicode/strenum.h"
|
||||
#include "cpdtrans.h"
|
||||
#include "nultrans.h"
|
||||
#include "rbt_data.h"
|
||||
|
@ -1188,6 +1189,7 @@ void Transliterator::unregister(const UnicodeString& ID) {
|
|||
}
|
||||
|
||||
/**
|
||||
* == OBSOLETE - remove in ICU 3.4 ==
|
||||
* Return the number of IDs currently registered with the system.
|
||||
* To retrieve the actual IDs, call getAvailableID(i) with
|
||||
* i from 0 to countAvailableIDs() - 1.
|
||||
|
@ -1199,6 +1201,7 @@ int32_t Transliterator::countAvailableIDs(void) {
|
|||
}
|
||||
|
||||
/**
|
||||
* == OBSOLETE - remove in ICU 3.4 ==
|
||||
* Return the index-th available ID. index must be between 0
|
||||
* and countAvailableIDs() - 1, inclusive. If index is out of
|
||||
* range, the result of getAvailableID(0) is returned.
|
||||
|
@ -1215,6 +1218,21 @@ const UnicodeString& Transliterator::getAvailableID(int32_t index) {
|
|||
return *result;
|
||||
}
|
||||
|
||||
StringEnumeration* Transliterator::getAvailableIDs(UErrorCode& ec) {
|
||||
if (U_FAILURE(ec)) return NULL;
|
||||
StringEnumeration* result = NULL;
|
||||
umtx_init(®istryMutex);
|
||||
umtx_lock(®istryMutex);
|
||||
if (HAVE_REGISTRY) {
|
||||
result = registry->getAvailableIDs();
|
||||
}
|
||||
umtx_unlock(®istryMutex);
|
||||
if (result == NULL) {
|
||||
ec = U_INTERNAL_TRANSLITERATOR_ERROR;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t Transliterator::countAvailableSources(void) {
|
||||
umtx_init(®istryMutex);
|
||||
Mutex lock(®istryMutex);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "unicode/unistr.h"
|
||||
#include "unicode/parseerr.h"
|
||||
#include "unicode/utrans.h" // UTransPosition, UTransDirection
|
||||
#include "unicode/strenum.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
|
@ -1031,25 +1032,15 @@ public:
|
|||
public:
|
||||
|
||||
/**
|
||||
* Return the number of IDs currently registered with the system.
|
||||
* To retrieve the actual IDs, call getAvailableID(i) with
|
||||
* i from 0 to countAvailableIDs() - 1.
|
||||
* @return the number of IDs currently registered with the system.
|
||||
* @stable ICU 2.0
|
||||
* Return a StringEnumeration over the IDs available at the time of the
|
||||
* call, including user-registered IDs.
|
||||
* @param ec input-output error code
|
||||
* @return a newly-created StringEnumeration over the transliterators
|
||||
* available at the time of the call. The caller should delete this object
|
||||
* when done using it.
|
||||
* @draft ICU 3.0
|
||||
*/
|
||||
static int32_t countAvailableIDs(void);
|
||||
|
||||
/**
|
||||
* Return the index-th available ID. index must be between 0
|
||||
* and countAvailableIDs() - 1, inclusive. If index is out of
|
||||
* range, the result of getAvailableID(0) is returned.
|
||||
* @param index the given ID index.
|
||||
* @return the index-th available ID. index must be between 0
|
||||
* and countAvailableIDs() - 1, inclusive. If index is out of
|
||||
* range, the result of getAvailableID(0) is returned.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
static const UnicodeString& getAvailableID(int32_t index);
|
||||
static StringEnumeration* getAvailableIDs(UErrorCode& ec);
|
||||
|
||||
/**
|
||||
* Return the number of registered source specifiers.
|
||||
|
@ -1203,6 +1194,27 @@ public:
|
|||
private:
|
||||
static UBool initializeRegistry(void);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Return the number of IDs currently registered with the system.
|
||||
* To retrieve the actual IDs, call getAvailableID(i) with
|
||||
* i from 0 to countAvailableIDs() - 1.
|
||||
* @return the number of IDs currently registered with the system.
|
||||
* @obsolete ICU 3.4 use getAvailableIDs() instead
|
||||
*/
|
||||
static int32_t countAvailableIDs(void);
|
||||
|
||||
/**
|
||||
* Return the index-th available ID. index must be between 0
|
||||
* and countAvailableIDs() - 1, inclusive. If index is out of
|
||||
* range, the result of getAvailableID(0) is returned.
|
||||
* @param index the given ID index.
|
||||
* @return the index-th available ID. index must be between 0
|
||||
* and countAvailableIDs() - 1, inclusive. If index is out of
|
||||
* range, the result of getAvailableID(0) is returned.
|
||||
* @obsolete ICU 3.4 use getAvailableIDs() instead
|
||||
*/
|
||||
static const UnicodeString& getAvailableID(int32_t index);
|
||||
};
|
||||
|
||||
inline int32_t Transliterator::getMaximumContextLength(void) const {
|
||||
|
|
Loading…
Add table
Reference in a new issue