Lines Matching refs:current
44 int8_t LocaleMatcher::IsMoreSuitable(const LocaleInfo *current, const LocaleInfo *other, const LocaleInfo *request)
48 if (current != nullptr && other == nullptr) {
52 if (current == nullptr && other != nullptr) {
53 // 1 means current is more suitable
58 if (current == nullptr && other == nullptr) {
61 bool isLangEqual = CompareLanguage(current, other);
63 // current or other language is null, not null language is better
64 bool result = CompareRegionWhenLangIsNotEqual(current, other, request);
68 LocaleUtil::EncodeRegionByLocaleInfo(current);
73 return CompareLanguageIgnoreOldNewCode(current, other, request);
83 int8_t isRegionEqual = CompareRegion(current, other, request);
85 return CompareLanguageIgnoreOldNewCode(current, other, request);
90 bool LocaleMatcher::CompareLanguage(const LocaleInfo *current, const LocaleInfo *other)
92 uint16_t currentEncodedLanguage = LocaleUtil::EncodeLanguageByLocaleInfo(current);
118 bool LocaleMatcher::CompareRegionWhenLangIsNotEqual(const LocaleInfo *current, const LocaleInfo *other,
121 int8_t qaagResult = CompareRegionWhenQaag(current, other, request);
129 if (current != nullptr) {
130 return (current->GetRegion().length() == 0) ||
131 ((LocaleUtil::EncodeRegion(current->GetRegion().c_str())) == LocaleUtil::EncodeRegion("US"));
137 if (current != nullptr) {
138 return IsSimilarToUsEnglish(current);
144 return current != nullptr;
147 int8_t LocaleMatcher::CompareRegionWhenQaag(const LocaleInfo *current, const LocaleInfo *other,
152 if ((current != nullptr) && (LocaleUtil::EncodeLocale(current->GetLanguage().c_str(), nullptr,
153 current->GetRegion().c_str()) == LocaleMatcher::EN_GB_ENCODE)) {
232 int8_t LocaleMatcher::CompareRegion(const LocaleInfo *current, const LocaleInfo *other, const LocaleInfo *request)
234 uint16_t currentEncodedRegion = LocaleUtil::EncodeRegionByLocaleInfo(current);
237 return CompareWhenRegionIsNull(currentEncodedRegion, otherEncodedRegion, current, other, request);
244 (current == nullptr) ? nullptr : current->GetRegion().c_str());
261 result = CompareDefaultRegion(current, other, request);
273 return AlphabeticallyCompare(current, currentEncodedLocale, other, otherEncodedLocale);
277 const LocaleInfo *current, const LocaleInfo *other, const LocaleInfo *request)
279 if (current == nullptr || current->GetRegion().length() == 0) {
285 int8_t qaagResult = CompareRegionWhenQaag(current, other, request);
299 // current and other region is not null.alphabetically
302 (current == nullptr) ? nullptr : current->GetRegion().c_str());
305 return AlphabeticallyCompare(current, currentEncodedLocale, other, otherEncodedLocale);
332 int8_t LocaleMatcher::AlphabeticallyCompare(const LocaleInfo *current, uint64_t currentEncodedLocale,
338 if (current == nullptr || current->GetRegion().length() == 0) {
345 char currentFirstChar = (current->GetRegion())[0];
415 int8_t LocaleMatcher::CompareDefaultRegion(const LocaleInfo *current, const LocaleInfo *other,
418 int8_t qaagResult = CompareRegionWhenQaag(current, other, request);
424 (current == nullptr) ? nullptr : current->GetRegion().c_str());
453 int8_t LocaleMatcher::CompareLanguageIgnoreOldNewCode(const LocaleInfo *current, const LocaleInfo *other,
456 uint16_t currentLanguageEncode = LocaleUtil::EncodeLanguageByLocaleInfo(current);
468 bool LocaleMatcher::Match(const LocaleInfo *current, const LocaleInfo *other)
470 if (current == nullptr || other == nullptr) {
474 bool isLanguageEqual = CompareLanguage(current, other);
478 return CompareScript(current, other);
481 bool LocaleMatcher::CompareScript(const LocaleInfo *current, const LocaleInfo *other)
485 if ((current != nullptr) && (current->GetScript().length() == 0)) {
486 currentEncodedScript = FindDefaultScriptEncode(current->GetLanguage().c_str(), current->GetRegion().c_str());
488 currentEncodedScript = LocaleUtil::EncodeScriptByLocaleInfo(current);
495 if (current != nullptr && other != nullptr) {
496 // when current locale is en-Qaag is equal en-Latn
497 if (LocaleUtil::EncodeLocale(current->GetLanguage().c_str(), current->GetScript().c_str(), nullptr) ==
511 uint16_t currentRegionEncode = LocaleUtil::EncodeRegionByLocaleInfo(current);