From: Younies Mahmoud Date: Mon, 8 Jun 2020 18:12:48 +0000 (+0200) Subject: fix the merge of sffc/units-staging X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e8d838029b9ed118c11379ea2516ff85c00aa1f2;p=icu fix the merge of sffc/units-staging --- diff --git a/icu4c/source/i18n/unitsdata.cpp b/icu4c/source/i18n/unitsdata.cpp index 2d47f1e5ea7..3cc6f9e6fbf 100644 --- a/icu4c/source/i18n/unitsdata.cpp +++ b/icu4c/source/i18n/unitsdata.cpp @@ -392,30 +392,6 @@ const ConversionRateInfo *ConversionRates::extractConversionInfo(StringPiece sou return nullptr; } -// TODO/FIXME: baseUnitIdentifier seems onerous? If this function could access -// extractCompoundBaseUnit directly, we could support any input unit identifier. -// Shall we move extractCompoundBaseUnit to unitsdata.cpp? -CharString U_I18N_API getUnitCategory(const char *baseUnitIdentifier, UErrorCode &status) { - CharString result; - LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", &status)); - LocalUResourceBundlePointer unitQuantities( - ures_getByKey(unitsBundle.getAlias(), "unitQuantities", NULL, &status)); - int32_t categoryLength; - if (U_FAILURE(status)) { return result; } - const UChar *uCategory = - ures_getStringByKey(unitQuantities.getAlias(), baseUnitIdentifier, &categoryLength, &status); - if (U_FAILURE(status)) { - // TODO: manually dealing with consumption-inverse - if (uprv_strcmp(baseUnitIdentifier, "meter-per-cubic-meter") == 0) { - status = U_ZERO_ERROR; - uCategory = ures_getStringByKey(unitQuantities.getAlias(), "cubic-meter-per-meter", - &categoryLength, &status); - } - } - result.appendInvariantChars(uCategory, categoryLength, status); - return result; -} - U_I18N_API UnitPreferences::UnitPreferences(UErrorCode &status) { LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", &status)); UnitPreferencesSink sink(&unitPrefs_, &metadata_); diff --git a/icu4c/source/i18n/unitsdata.h b/icu4c/source/i18n/unitsdata.h index 101010a618a..061538e8bf4 100644 --- a/icu4c/source/i18n/unitsdata.h +++ b/icu4c/source/i18n/unitsdata.h @@ -92,8 +92,6 @@ class U_I18N_API ConversionRates { MaybeStackVector conversionInfo_; }; -CharString U_I18N_API getUnitCategory(const char *baseUnitIdentifier, UErrorCode &status); - // Encapsulates unitPreferenceData information from units resources, specifying // a sequence of output unit preferences. struct U_I18N_API UnitPreference : public UMemory {