// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /** ******************************************************************************* * Copyright (C) 2001-2011, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* * ******************************************************************************* */ #ifndef ICULSERV_H #define ICULSERV_H #include "unicode/utypes.h" #if UCONFIG_NO_SERVICE U_NAMESPACE_BEGIN /* * Allow the declaration of APIs with pointers to ICUService * even when service is removed from the build. */ class ICULocaleService; U_NAMESPACE_END #else #include "unicode/unistr.h" #include "unicode/locid.h" #include "unicode/strenum.h" #include "hash.h" #include "uvector.h" #include "serv.h" #include "locutil.h" U_NAMESPACE_BEGIN class ICULocaleService; class LocaleKey; class LocaleKeyFactory; class SimpleLocaleKeyFactory; class ServiceListener; /* ****************************************************************** */ /** * A subclass of Key that implements a locale fallback mechanism. * The first locale to search for is the locale provided by the * client, and the fallback locale to search for is the current * default locale. If a prefix is present, the currentDescriptor * includes it before the locale proper, separated by "/". This * is the default key instantiated by ICULocaleService.</p> * * <p>Canonicalization adjusts the locale string so that the * section before the first understore is in lower case, and the rest * is in upper case, with no trailing underscores.</p> */ class U_COMMON_API LocaleKey : public ICUServiceKey { … }; /* ****************************************************************** */ /** * A subclass of ICUServiceFactory that uses LocaleKeys, and is able to * 'cover' more specific locales with more general locales that it * supports. * * <p>Coverage may be either of the values VISIBLE or INVISIBLE. * * <p>'Visible' indicates that the specific locale(s) supported by * the factory are registered in getSupportedIDs, 'Invisible' * indicates that they are not. * * <p>Localization of visible ids is handled * by the handling factory, regardless of kind. */ class U_COMMON_API LocaleKeyFactory : public ICUServiceFactory { … }; /* ****************************************************************** */ /** * A LocaleKeyFactory that just returns a single object for a kind/locale. */ class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory { … }; /* ****************************************************************** */ /** * A LocaleKeyFactory that creates a service based on the ICU locale data. * This is a base class for most ICU factories. Subclasses instantiate it * with a constructor that takes a bundle name, which determines the supported * IDs. Subclasses then override handleCreate to create the actual service * object. The default implementation returns a resource bundle. */ class U_COMMON_API ICUResourceBundleFactory : public LocaleKeyFactory { … }; /* ****************************************************************** */ class U_COMMON_API ICULocaleService : public ICUService { … }; U_NAMESPACE_END /* UCONFIG_NO_SERVICE */ #endif /* ICULSERV_H */ #endif