]> granicus.if.org Git - icu/commitdiff
fix the merge of sffc/units-staging
authorYounies Mahmoud <younies.mahmoud@gmail.com>
Mon, 8 Jun 2020 18:12:48 +0000 (20:12 +0200)
committerYounies Mahmoud <younies.mahmoud@gmail.com>
Mon, 8 Jun 2020 18:12:48 +0000 (20:12 +0200)
icu4c/source/i18n/unitsdata.cpp
icu4c/source/i18n/unitsdata.h

index 2d47f1e5ea7f42d9ae4ece47fc632ea3043bae95..3cc6f9e6fbf812475dc2235fe6cfcebc173d5bf0 100644 (file)
@@ -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_);
index 101010a618a72caeb169f0e5824c601f2a923f3a..061538e8bf418a6c0b3453a889fb6f768ee05ea0 100644 (file)
@@ -92,8 +92,6 @@ class U_I18N_API ConversionRates {
     MaybeStackVector<ConversionRateInfo> 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 {