1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************** 385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho* Copyright (c) 2001-2008, International Business Machines 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Corporation and others. All Rights Reserved. 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************** 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Date Name Description 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 08/10/2001 aliu Creation. 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************** 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/ 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef _TRANSREG_H 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define _TRANSREG_H 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_TRANSLITERATION 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/uobject.h" 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/translit.h" 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "hash.h" 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "uvector.h" 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hoclass TransliteratorEntry; 2585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Hoclass TransliteratorSpec; 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass UnicodeString; 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//------------------------------------------------------------------ 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// TransliteratorAlias 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//------------------------------------------------------------------ 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * A TransliteratorAlias object is returned by get() if the given ID 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * actually translates into something else. The caller then invokes 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the create() method on the alias to create the actual 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * transliterator, and deletes the alias. 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Why all the shenanigans? To prevent circular calls between 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the registry code and the transliterator code that deadlocks. 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass TransliteratorAlias : public UMemory { 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public: 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct a simple alias (type == SIMPLE) 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param aliasID the given id. 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorAlias(const UnicodeString& aliasID, const UnicodeSet* compoundFilter); 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct a compound RBT alias (type == COMPOUND) 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorAlias(const UnicodeString& ID, const UnicodeString& idBlocks, 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UVector* adoptedTransliterators, 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeSet* compoundFilter); 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Construct a rules alias (type = RULES) 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorAlias(const UnicodeString& theID, 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& rules, 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UTransDirection dir); 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ~TransliteratorAlias(); 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The whole point of create() is that the caller must invoke 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * it when the registry mutex is NOT held, to prevent deadlock. 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * It may only be called once. 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Note: Only call create() if isRuleBased() returns FALSE. 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method must be called *outside* of the TransliteratorRegistry 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * mutex. 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Transliterator* create(UParseError&, UErrorCode&); 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return TRUE if this alias is rule-based. If so, the caller 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * must call parse() on it, then call TransliteratorRegistry::reget(). 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool isRuleBased() const; 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 83ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 84ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If isRuleBased() returns TRUE, then the caller must call this 85ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * method, followed by TransliteratorRegistry::reget(). The latter 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * method must be called inside the TransliteratorRegistry mutex. 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Note: Only call parse() if isRuleBased() returns TRUE. 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method must be called *outside* of the TransliteratorRegistry 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * mutex, because it can instantiate Transliterators embedded in 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the rules via the "&Latin-Arabic()" syntax. 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void parse(TransliteratorParser& parser, 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UParseError& pe, UErrorCode& ec) const; 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private: 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // We actually come in three flavors: 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 1. Simple alias 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Here aliasID is the alias string. Everything else is 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // null, zero, empty. 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 2. CompoundRBT 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Here ID is the ID, aliasID is the idBlock, trans is the 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // contained RBT, and idSplitPoint is the offet in aliasID 105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // where the contained RBT goes. compoundFilter is the 106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // compound filter, and it is _not_ owned. 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // 3. Rules 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Here ID is the ID, aliasID is the rules string. 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // idSplitPoint is the UTransDirection. 110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString ID; 111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString aliasesOrRules; 112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UVector* transes; // owned 113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeSet* compoundFilter; // alias 114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UTransDirection direction; 115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru enum { SIMPLE, COMPOUND, RULES } type; 116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorAlias(const TransliteratorAlias &other); // forbid copying of this class 118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorAlias &operator=(const TransliteratorAlias &other); // forbid copying of this class 119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/** 123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * A registry of system transliterators. This is the data structure 124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * that implements the mapping between transliterator IDs and the data 125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * or function pointers used to create the corresponding 126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * transliterators. There is one instance of the registry that is 127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * created statically. 128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The registry consists of a dynamic component -- a hashtable -- and 130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * a static component -- locale resource bundles. The dynamic store 131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * is semantically overlaid on the static store, so the static mapping 132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * can be dynamically overridden. 133ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 134ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This is an internal class that is only used by Transliterator. 135ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Transliterator maintains one static instance of this class and 136ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * delegates all registry-related operations to it. 137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @author Alan Liu 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass TransliteratorRegistry : public UMemory { 141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public: 143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Contructor 146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code. 147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorRegistry(UErrorCode& status); 149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Nonvirtual destructor -- this class is not subclassable. 152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ~TransliteratorRegistry(); 154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //------------------------------------------------------------------ 156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Basic public API 157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //------------------------------------------------------------------ 158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 159ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 160ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Given a simple ID (forward direction, no inline filter, not 161ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * compound) attempt to instantiate it from the registry. Return 162ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 0 on failure. 163ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 164ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return a non-NULL aliasReturn value if the ID points to an alias. 165ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * We cannot instantiate it ourselves because the alias may contain 166ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * filters or compounds, which we do not understand. Caller should 167ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * make aliasReturn NULL before calling. 168ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ID the given ID 169ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param aliasReturn output param to receive TransliteratorAlias; 170ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * should be NULL on entry 171ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param parseError Struct to recieve information on position 172ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * of error if an error is encountered 173ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param status Output param set to success/failure code. 174ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 175ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Transliterator* get(const UnicodeString& ID, 176ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorAlias*& aliasReturn, 177ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 178ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 179ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 180ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * The caller must call this after calling get(), if [a] calling get() 181ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * returns an alias, and [b] the alias is rule based. In that 182ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * situation the caller must call alias->parse() to do the parsing 183ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * OUTSIDE THE REGISTRY MUTEX, then call this method to retry 184ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * instantiating the transliterator. 185ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 186ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Note: Another alias might be returned by this method. 187ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 188ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * This method (like all public methods of this class) must be called 189ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * from within the TransliteratorRegistry mutex. 190ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * 191ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param aliasReturn output param to receive TransliteratorAlias; 192ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * should be NULL on entry 193ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 194ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Transliterator* reget(const UnicodeString& ID, 195ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorParser& parser, 196ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorAlias*& aliasReturn, 197ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 198ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 199ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 200ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Register a prototype (adopted). This adds an entry to the 201ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * dynamic store, or replaces an existing entry. Any entry in the 202ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * underlying static locale resource store is masked. 203ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 204ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void put(Transliterator* adoptedProto, 20585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool visible, 20685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& ec); 207ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 208ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 209ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Register an ID and a factory function pointer. This adds an 210ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * entry to the dynamic store, or replaces an existing entry. Any 211ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * entry in the underlying static locale resource store is masked. 212ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 213ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void put(const UnicodeString& ID, 214ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Transliterator::Factory factory, 215ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Transliterator::Token context, 21685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool visible, 21785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& ec); 218ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 219ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 220ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Register an ID and a resource name. This adds an entry to the 221ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * dynamic store, or replaces an existing entry. Any entry in the 222ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * underlying static locale resource store is masked. 223ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 224ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void put(const UnicodeString& ID, 225ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& resourceName, 226ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UTransDirection dir, 227ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool readonlyResourceAlias, 22885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool visible, 22985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& ec); 230ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 231ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 232ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Register an ID and an alias ID. This adds an entry to the 233ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * dynamic store, or replaces an existing entry. Any entry in the 234ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * underlying static locale resource store is masked. 235ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 236ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void put(const UnicodeString& ID, 237ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& alias, 238ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool readonlyAliasAlias, 23985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UBool visible, 24085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho UErrorCode& ec); 241ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 242ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 243ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Unregister an ID. This removes an entry from the dynamic store 244ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * if there is one. The static locale resource store is 245ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * unaffected. 246ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param ID the given ID. 247ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 248ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void remove(const UnicodeString& ID); 249ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 250ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //------------------------------------------------------------------ 251ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Public ID and spec management 252ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //------------------------------------------------------------------ 253ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 254ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 255ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return a StringEnumeration over the IDs currently registered 256ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * with the system. 257ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 258ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 259ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru StringEnumeration* getAvailableIDs() const; 260ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 261ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 262ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * == OBSOLETE - remove in ICU 3.4 == 263ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the number of IDs currently registered with the system. 264ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * To retrieve the actual IDs, call getAvailableID(i) with 265ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * i from 0 to countAvailableIDs() - 1. 266ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the number of IDs currently registered with the system. 267ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 268ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 269ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t countAvailableIDs(void) const; 270ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 271ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 272ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * == OBSOLETE - remove in ICU 3.4 == 273ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the index-th available ID. index must be between 0 274ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and countAvailableIDs() - 1, inclusive. If index is out of 275ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * range, the result of getAvailableID(0) is returned. 276ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param index the given index. 277ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the index-th available ID. index must be between 0 278ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * and countAvailableIDs() - 1, inclusive. If index is out of 279ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * range, the result of getAvailableID(0) is returned. 280ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @internal 281ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 282ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& getAvailableID(int32_t index) const; 283ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 284ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 285ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the number of registered source specifiers. 286ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the number of registered source specifiers. 287ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 288ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t countAvailableSources(void) const; 289ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 290ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 291ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return a registered source specifier. 292ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param index which specifier to return, from 0 to n-1, where 293ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * n = countAvailableSources() 294ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result fill-in paramter to receive the source specifier. 295ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If index is out of range, result will be empty. 296ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return reference to result 297ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 298ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getAvailableSource(int32_t index, 299ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& result) const; 300ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 301ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 302ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the number of registered target specifiers for a given 303ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * source specifier. 304ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param source the given source specifier. 305ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the number of registered target specifiers for a given 306ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * source specifier. 307ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 308ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t countAvailableTargets(const UnicodeString& source) const; 309ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 310ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 311ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return a registered target specifier for a given source. 312ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param index which specifier to return, from 0 to n-1, where 313ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * n = countAvailableTargets(source) 314ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param source the source specifier 315ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result fill-in paramter to receive the target specifier. 316ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * If source is invalid or if index is out of range, result will 317ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * be empty. 318ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return reference to result 319ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 320ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getAvailableTarget(int32_t index, 321ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& source, 322ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& result) const; 323ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 324ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 325ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return the number of registered variant specifiers for a given 326ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * source-target pair. There is always at least one variant: If 327ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * just source-target is registered, then the single variant 328ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * NO_VARIANT is returned. If source-target/variant is registered 329ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * then that variant is returned. 330ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param source the source specifiers 331ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param target the target specifiers 332ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return the number of registered variant specifiers for a given 333ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * source-target pair. 334ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 335ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t countAvailableVariants(const UnicodeString& source, 336ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& target) const; 337ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 338ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 339ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Return a registered variant specifier for a given source-target 340ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * pair. If NO_VARIANT is one of the variants, then it will be 341ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * at index 0. 342ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param index which specifier to return, from 0 to n-1, where 343ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * n = countAvailableVariants(source, target) 344ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param source the source specifier 345ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param target the target specifier 346ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @param result fill-in paramter to receive the variant 347ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specifier. If source is invalid or if target is invalid or if 348ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * index is out of range, result will be empty. 349ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @return reference to result 350ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 351ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& getAvailableVariant(int32_t index, 352ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& source, 353ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& target, 354ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& result) const; 355ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 356ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private: 357ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 358ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //---------------------------------------------------------------- 359ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Private implementation 360ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru //---------------------------------------------------------------- 361ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 36285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho TransliteratorEntry* find(const UnicodeString& ID); 363ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 36485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho TransliteratorEntry* find(UnicodeString& source, 365ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& target, 366ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& variant); 367ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 36885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho TransliteratorEntry* findInDynamicStore(const TransliteratorSpec& src, 36985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const TransliteratorSpec& trg, 370ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& variant) const; 371ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 37285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho TransliteratorEntry* findInStaticStore(const TransliteratorSpec& src, 37385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const TransliteratorSpec& trg, 374ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& variant); 375ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 37685bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho static TransliteratorEntry* findInBundle(const TransliteratorSpec& specToOpen, 37785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho const TransliteratorSpec& specToFind, 378ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& variant, 379ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UTransDirection direction); 380ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 381ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void registerEntry(const UnicodeString& source, 382ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& target, 383ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& variant, 38485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho TransliteratorEntry* adopted, 385ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool visible); 386ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 387ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void registerEntry(const UnicodeString& ID, 38885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho TransliteratorEntry* adopted, 389ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool visible); 390ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 391ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void registerEntry(const UnicodeString& ID, 392ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& source, 393ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& target, 394ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& variant, 39585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho TransliteratorEntry* adopted, 396ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UBool visible); 397ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 398ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void registerSTV(const UnicodeString& source, 399ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& target, 400ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& variant); 401ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 402ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void removeSTV(const UnicodeString& source, 403ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& target, 404ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const UnicodeString& variant); 405ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 406ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Transliterator* instantiateEntry(const UnicodeString& ID, 40785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho TransliteratorEntry *entry, 408ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorAlias*& aliasReturn, 409ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UErrorCode& status); 410ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 411ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 412ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * A StringEnumeration over the registered IDs in this object. 413ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 414ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru class Enumeration : public StringEnumeration { 415ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public: 416ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Enumeration(const TransliteratorRegistry& reg); 417ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~Enumeration(); 418ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual int32_t count(UErrorCode& status) const; 419ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual const UnicodeString* snext(UErrorCode& status); 420ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual void reset(UErrorCode& status); 421ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static UClassID U_EXPORT2 getStaticClassID(); 422ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual UClassID getDynamicClassID() const; 423ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private: 424ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t index; 425ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const TransliteratorRegistry& reg; 426ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru }; 427ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru friend class Enumeration; 428ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 429ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru private: 430ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 431ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 432ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Dynamic registry mapping full IDs to Entry objects. This 433ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * contains both public and internal entities. The visibility is 434ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * controlled by whether an entry is listed in availableIDs and 435ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * specDAG or not. 436ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 437ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Hashtable registry; 438ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 439ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 440ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * DAG of visible IDs by spec. Hashtable: source => (Hashtable: 441ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * target => (UVector: variant)) The UVector of variants is never 442ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * empty. For a source-target with no variant, the special 443ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * variant NO_VARIANT (the empty string) is stored in slot zero of 444ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the UVector. 445ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 446ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Hashtable specDAG; 447ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 448ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 449ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Vector of public full IDs. 450ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 451ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UVector availableIDs; 452ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 453ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorRegistry(const TransliteratorRegistry &other); // forbid copying of this class 454ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru TransliteratorRegistry &operator=(const TransliteratorRegistry &other); // forbid copying of this class 455ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 456ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 457ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END 458ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 459ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_TRANSLITERATION */ 460ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 461ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif 462ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru//eof 463