1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
5 * Copyright (C) 2001-2014, International Business Machines Corporation and *
6 * others. All Rights Reserved. *
7 *******************************************************************************
9 *******************************************************************************
11 #include "unicode/utypes.h"
13 #if !UCONFIG_NO_SERVICE
15 #include "unicode/resbund.h"
24 #define UNDERSCORE_CHAR ((UChar)0x005f)
25 #define AT_SIGN_CHAR ((UChar)64)
26 #define PERIOD_CHAR ((UChar)46)
31 ******************************************************************
34 SimpleLocaleKeyFactory::SimpleLocaleKeyFactory(UObject* objToAdopt,
35 const UnicodeString& locale,
38 : LocaleKeyFactory(coverage)
45 SimpleLocaleKeyFactory::SimpleLocaleKeyFactory(UObject* objToAdopt,
49 : LocaleKeyFactory(coverage)
54 LocaleUtility::initNameFromLocale(locale, _id);
57 SimpleLocaleKeyFactory::~SimpleLocaleKeyFactory()
64 SimpleLocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const
66 if (U_SUCCESS(status)) {
67 const LocaleKey& lkey = (const LocaleKey&)key;
68 if (_kind == LocaleKey::KIND_ANY || _kind == lkey.kind()) {
70 lkey.currentID(keyID);
72 return service->cloneInstance(_obj);
80 //SimpleLocaleKeyFactory::isSupportedID(const UnicodeString& id, UErrorCode& /* status */) const
86 SimpleLocaleKeyFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const
88 if (U_SUCCESS(status)) {
89 if (_coverage & 0x1) {
92 result.put(_id, (void*)this, status);
99 SimpleLocaleKeyFactory::debug(UnicodeString& result) const
101 LocaleKeyFactory::debug(result);
102 result.append((UnicodeString)", id: ");
104 result.append((UnicodeString)", kind: ");
105 result.append(_kind);
110 SimpleLocaleKeyFactory::debugClass(UnicodeString& result) const
112 return result.append((UnicodeString)"SimpleLocaleKeyFactory");
116 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleLocaleKeyFactory)
120 /* !UCONFIG_NO_SERVICE */