aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/common/servlkf.cpp
diff options
context:
space:
mode:
authorneksard <neksard@yandex-team.ru>2022-02-10 16:45:33 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:33 +0300
commit1d9c550e7c38e051d7961f576013a482003a70d9 (patch)
treeb2cc84ee7850122e7ccf51d0ea21e4fa7e7a5685 /contrib/libs/icu/common/servlkf.cpp
parent8f7cf138264e0caa318144bf8a2c950e0b0a8593 (diff)
downloadydb-1d9c550e7c38e051d7961f576013a482003a70d9.tar.gz
Restoring authorship annotation for <neksard@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/icu/common/servlkf.cpp')
-rw-r--r--contrib/libs/icu/common/servlkf.cpp302
1 files changed, 151 insertions, 151 deletions
diff --git a/contrib/libs/icu/common/servlkf.cpp b/contrib/libs/icu/common/servlkf.cpp
index e45d7d1170..84f2347cdd 100644
--- a/contrib/libs/icu/common/servlkf.cpp
+++ b/contrib/libs/icu/common/servlkf.cpp
@@ -1,152 +1,152 @@
// © 2016 and later: Unicode, Inc. and others.
-// License & terms of use: http://www.unicode.org/copyright.html
-/**
- *******************************************************************************
- * Copyright (C) 2001-2014, International Business Machines Corporation and *
- * others. All Rights Reserved. *
- *******************************************************************************
- *
- *******************************************************************************
- */
-#include "unicode/utypes.h"
-
-#if !UCONFIG_NO_SERVICE
-
-#include "unicode/resbund.h"
-#include "uresimp.h"
-#include "cmemory.h"
-#include "servloc.h"
-#include "ustrfmt.h"
-#include "uhash.h"
-#include "charstr.h"
-#include "ucln_cmn.h"
-#include "uassert.h"
-
-#define UNDERSCORE_CHAR ((UChar)0x005f)
-#define AT_SIGN_CHAR ((UChar)64)
-#define PERIOD_CHAR ((UChar)46)
-
-
-U_NAMESPACE_BEGIN
-
-LocaleKeyFactory::LocaleKeyFactory(int32_t coverage)
- : _name()
- , _coverage(coverage)
-{
-}
-
-LocaleKeyFactory::LocaleKeyFactory(int32_t coverage, const UnicodeString& name)
- : _name(name)
- , _coverage(coverage)
-{
-}
-
-LocaleKeyFactory::~LocaleKeyFactory() {
-}
-
-UObject*
-LocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const {
- if (handlesKey(key, status)) {
- const LocaleKey& lkey = (const LocaleKey&)key;
- int32_t kind = lkey.kind();
- Locale loc;
- lkey.currentLocale(loc);
-
- return handleCreate(loc, kind, service, status);
- }
- return NULL;
-}
-
-UBool
-LocaleKeyFactory::handlesKey(const ICUServiceKey& key, UErrorCode& status) const {
- const Hashtable* supported = getSupportedIDs(status);
- if (supported) {
- UnicodeString id;
- key.currentID(id);
- return supported->get(id) != NULL;
- }
- return FALSE;
-}
-
-void
-LocaleKeyFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const {
- const Hashtable* supported = getSupportedIDs(status);
- if (supported) {
- UBool visible = (_coverage & 0x1) == 0;
- const UHashElement* elem = NULL;
- int32_t pos = UHASH_FIRST;
- while ((elem = supported->nextElement(pos)) != NULL) {
- const UnicodeString& id = *((const UnicodeString*)elem->key.pointer);
- if (!visible) {
- result.remove(id);
- } else {
- result.put(id, (void*)this, status); // this is dummy non-void marker used for set semantics
- if (U_FAILURE(status)) {
- break;
- }
- }
- }
- }
-}
-
-UnicodeString&
-LocaleKeyFactory::getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const {
- if ((_coverage & 0x1) == 0) {
- //UErrorCode status = U_ZERO_ERROR;
- // assume if this is called on us, we support some fallback of this id
- // if (isSupportedID(id, status)) {
- Locale loc;
- LocaleUtility::initLocaleFromName(id, loc);
- return loc.getDisplayName(locale, result);
- // }
- }
- result.setToBogus();
- return result;
-}
-
-UObject*
-LocaleKeyFactory::handleCreate(const Locale& /* loc */,
- int32_t /* kind */,
- const ICUService* /* service */,
- UErrorCode& /* status */) const {
- return NULL;
-}
-
-//UBool
-//LocaleKeyFactory::isSupportedID(const UnicodeString& id, UErrorCode& status) const {
-// const Hashtable* ids = getSupportedIDs(status);
-// return ids && ids->get(id);
-//}
-
-const Hashtable*
-LocaleKeyFactory::getSupportedIDs(UErrorCode& /* status */) const {
- return NULL;
-}
-
-#ifdef SERVICE_DEBUG
-UnicodeString&
-LocaleKeyFactory::debug(UnicodeString& result) const
-{
- debugClass(result);
- result.append((UnicodeString)", name: ");
- result.append(_name);
- result.append((UnicodeString)", coverage: ");
- result.append(_coverage);
- return result;
-}
-
-UnicodeString&
-LocaleKeyFactory::debugClass(UnicodeString& result) const
-{
- return result.append((UnicodeString)"LocaleKeyFactory");
-}
-#endif
-
-UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LocaleKeyFactory)
-
-U_NAMESPACE_END
-
-/* !UCONFIG_NO_SERVICE */
-#endif
-
-
+// License & terms of use: http://www.unicode.org/copyright.html
+/**
+ *******************************************************************************
+ * Copyright (C) 2001-2014, International Business Machines Corporation and *
+ * others. All Rights Reserved. *
+ *******************************************************************************
+ *
+ *******************************************************************************
+ */
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_SERVICE
+
+#include "unicode/resbund.h"
+#include "uresimp.h"
+#include "cmemory.h"
+#include "servloc.h"
+#include "ustrfmt.h"
+#include "uhash.h"
+#include "charstr.h"
+#include "ucln_cmn.h"
+#include "uassert.h"
+
+#define UNDERSCORE_CHAR ((UChar)0x005f)
+#define AT_SIGN_CHAR ((UChar)64)
+#define PERIOD_CHAR ((UChar)46)
+
+
+U_NAMESPACE_BEGIN
+
+LocaleKeyFactory::LocaleKeyFactory(int32_t coverage)
+ : _name()
+ , _coverage(coverage)
+{
+}
+
+LocaleKeyFactory::LocaleKeyFactory(int32_t coverage, const UnicodeString& name)
+ : _name(name)
+ , _coverage(coverage)
+{
+}
+
+LocaleKeyFactory::~LocaleKeyFactory() {
+}
+
+UObject*
+LocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const {
+ if (handlesKey(key, status)) {
+ const LocaleKey& lkey = (const LocaleKey&)key;
+ int32_t kind = lkey.kind();
+ Locale loc;
+ lkey.currentLocale(loc);
+
+ return handleCreate(loc, kind, service, status);
+ }
+ return NULL;
+}
+
+UBool
+LocaleKeyFactory::handlesKey(const ICUServiceKey& key, UErrorCode& status) const {
+ const Hashtable* supported = getSupportedIDs(status);
+ if (supported) {
+ UnicodeString id;
+ key.currentID(id);
+ return supported->get(id) != NULL;
+ }
+ return FALSE;
+}
+
+void
+LocaleKeyFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const {
+ const Hashtable* supported = getSupportedIDs(status);
+ if (supported) {
+ UBool visible = (_coverage & 0x1) == 0;
+ const UHashElement* elem = NULL;
+ int32_t pos = UHASH_FIRST;
+ while ((elem = supported->nextElement(pos)) != NULL) {
+ const UnicodeString& id = *((const UnicodeString*)elem->key.pointer);
+ if (!visible) {
+ result.remove(id);
+ } else {
+ result.put(id, (void*)this, status); // this is dummy non-void marker used for set semantics
+ if (U_FAILURE(status)) {
+ break;
+ }
+ }
+ }
+ }
+}
+
+UnicodeString&
+LocaleKeyFactory::getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const {
+ if ((_coverage & 0x1) == 0) {
+ //UErrorCode status = U_ZERO_ERROR;
+ // assume if this is called on us, we support some fallback of this id
+ // if (isSupportedID(id, status)) {
+ Locale loc;
+ LocaleUtility::initLocaleFromName(id, loc);
+ return loc.getDisplayName(locale, result);
+ // }
+ }
+ result.setToBogus();
+ return result;
+}
+
+UObject*
+LocaleKeyFactory::handleCreate(const Locale& /* loc */,
+ int32_t /* kind */,
+ const ICUService* /* service */,
+ UErrorCode& /* status */) const {
+ return NULL;
+}
+
+//UBool
+//LocaleKeyFactory::isSupportedID(const UnicodeString& id, UErrorCode& status) const {
+// const Hashtable* ids = getSupportedIDs(status);
+// return ids && ids->get(id);
+//}
+
+const Hashtable*
+LocaleKeyFactory::getSupportedIDs(UErrorCode& /* status */) const {
+ return NULL;
+}
+
+#ifdef SERVICE_DEBUG
+UnicodeString&
+LocaleKeyFactory::debug(UnicodeString& result) const
+{
+ debugClass(result);
+ result.append((UnicodeString)", name: ");
+ result.append(_name);
+ result.append((UnicodeString)", coverage: ");
+ result.append(_coverage);
+ return result;
+}
+
+UnicodeString&
+LocaleKeyFactory::debugClass(UnicodeString& result) const
+{
+ return result.append((UnicodeString)"LocaleKeyFactory");
+}
+#endif
+
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(LocaleKeyFactory)
+
+U_NAMESPACE_END
+
+/* !UCONFIG_NO_SERVICE */
+#endif
+
+