From e6fdb36045ba02da4ffdd778e2301a8313b1fed6 Mon Sep 17 00:00:00 2001 From: Peter Edberg Date: Tue, 20 Sep 2016 21:15:22 +0000 Subject: [PATCH] ICU-12738 ICU4C, update measurement unit constants & code X-SVN-Rev: 39298 --- icu4c/source/i18n/measfmt.cpp | 2 +- icu4c/source/i18n/measunit.cpp | 299 +++++++++++---------- icu4c/source/i18n/unicode/measunit.h | 72 +++-- icu4c/source/test/intltest/measfmttest.cpp | 146 ++++++++++ 4 files changed, 356 insertions(+), 163 deletions(-) diff --git a/icu4c/source/i18n/measfmt.cpp b/icu4c/source/i18n/measfmt.cpp index 61618ab44d0..b5a9156ec2c 100644 --- a/icu4c/source/i18n/measfmt.cpp +++ b/icu4c/source/i18n/measfmt.cpp @@ -41,7 +41,7 @@ #include "standardplural.h" #include "unifiedcache.h" -#define MEAS_UNIT_COUNT 134 +#define MEAS_UNIT_COUNT 138 #define WIDTH_INDEX_COUNT (UMEASFMT_WIDTH_NARROW + 1) U_NAMESPACE_BEGIN diff --git a/icu4c/source/i18n/measunit.cpp b/icu4c/source/i18n/measunit.cpp index a4a7c736026..d780b80ce25 100644 --- a/icu4c/source/i18n/measunit.cpp +++ b/icu4c/source/i18n/measunit.cpp @@ -40,20 +40,21 @@ static const int32_t gOffsets[] = { 16, 20, 24, - 284, - 294, - 305, + 28, + 288, + 298, 309, - 315, + 313, 319, - 338, - 339, - 350, - 356, - 361, + 323, + 342, + 343, + 354, + 360, 365, 369, - 394 + 373, + 398 }; static const int32_t gIndexes[] = { @@ -63,20 +64,21 @@ static const int32_t gIndexes[] = { 16, 20, 24, - 24, - 34, - 45, + 28, + 28, + 38, 49, - 55, + 53, 59, - 78, - 79, - 90, - 96, - 101, + 63, + 82, + 83, + 94, + 100, 105, 109, - 134 + 113, + 138 }; // Must be sorted alphabetically. @@ -86,6 +88,7 @@ static const char * const gTypes[] = { "area", "concentr", "consumption", + "coordinate", "currency", "digital", "duration", @@ -128,6 +131,10 @@ static const char * const gSubTypes[] = { "liter-per-kilometer", "mile-per-gallon", "mile-per-gallon-imperial", + "east", + "north", + "south", + "west", "ADP", "AED", "AFA", @@ -502,14 +509,14 @@ static const char * const gSubTypes[] = { // Must be sorted by first value and then second value. static int32_t unitPerUnitToSingleUnit[][4] = { - {326, 296, 16, 0}, - {328, 302, 16, 2}, - {330, 296, 16, 3}, - {330, 383, 4, 2}, - {330, 384, 4, 3}, - {344, 381, 3, 1}, - {347, 11, 15, 4}, - {386, 326, 4, 1} + {330, 300, 17, 0}, + {332, 306, 17, 2}, + {334, 300, 17, 3}, + {334, 387, 4, 2}, + {334, 388, 4, 3}, + {348, 385, 3, 1}, + {351, 11, 16, 4}, + {390, 330, 4, 1} }; MeasureUnit *MeasureUnit::createGForce(UErrorCode &status) { @@ -608,444 +615,460 @@ MeasureUnit *MeasureUnit::createMilePerGallonImperial(UErrorCode &status) { return MeasureUnit::create(4, 3, status); } +MeasureUnit *MeasureUnit::createEast(UErrorCode &status) { + return MeasureUnit::create(5, 0, status); +} + +MeasureUnit *MeasureUnit::createNorth(UErrorCode &status) { + return MeasureUnit::create(5, 1, status); +} + +MeasureUnit *MeasureUnit::createSouth(UErrorCode &status) { + return MeasureUnit::create(5, 2, status); +} + +MeasureUnit *MeasureUnit::createWest(UErrorCode &status) { + return MeasureUnit::create(5, 3, status); +} + MeasureUnit *MeasureUnit::createBit(UErrorCode &status) { - return MeasureUnit::create(6, 0, status); + return MeasureUnit::create(7, 0, status); } MeasureUnit *MeasureUnit::createByte(UErrorCode &status) { - return MeasureUnit::create(6, 1, status); + return MeasureUnit::create(7, 1, status); } MeasureUnit *MeasureUnit::createGigabit(UErrorCode &status) { - return MeasureUnit::create(6, 2, status); + return MeasureUnit::create(7, 2, status); } MeasureUnit *MeasureUnit::createGigabyte(UErrorCode &status) { - return MeasureUnit::create(6, 3, status); + return MeasureUnit::create(7, 3, status); } MeasureUnit *MeasureUnit::createKilobit(UErrorCode &status) { - return MeasureUnit::create(6, 4, status); + return MeasureUnit::create(7, 4, status); } MeasureUnit *MeasureUnit::createKilobyte(UErrorCode &status) { - return MeasureUnit::create(6, 5, status); + return MeasureUnit::create(7, 5, status); } MeasureUnit *MeasureUnit::createMegabit(UErrorCode &status) { - return MeasureUnit::create(6, 6, status); + return MeasureUnit::create(7, 6, status); } MeasureUnit *MeasureUnit::createMegabyte(UErrorCode &status) { - return MeasureUnit::create(6, 7, status); + return MeasureUnit::create(7, 7, status); } MeasureUnit *MeasureUnit::createTerabit(UErrorCode &status) { - return MeasureUnit::create(6, 8, status); + return MeasureUnit::create(7, 8, status); } MeasureUnit *MeasureUnit::createTerabyte(UErrorCode &status) { - return MeasureUnit::create(6, 9, status); + return MeasureUnit::create(7, 9, status); } MeasureUnit *MeasureUnit::createCentury(UErrorCode &status) { - return MeasureUnit::create(7, 0, status); + return MeasureUnit::create(8, 0, status); } MeasureUnit *MeasureUnit::createDay(UErrorCode &status) { - return MeasureUnit::create(7, 1, status); + return MeasureUnit::create(8, 1, status); } MeasureUnit *MeasureUnit::createHour(UErrorCode &status) { - return MeasureUnit::create(7, 2, status); + return MeasureUnit::create(8, 2, status); } MeasureUnit *MeasureUnit::createMicrosecond(UErrorCode &status) { - return MeasureUnit::create(7, 3, status); + return MeasureUnit::create(8, 3, status); } MeasureUnit *MeasureUnit::createMillisecond(UErrorCode &status) { - return MeasureUnit::create(7, 4, status); + return MeasureUnit::create(8, 4, status); } MeasureUnit *MeasureUnit::createMinute(UErrorCode &status) { - return MeasureUnit::create(7, 5, status); + return MeasureUnit::create(8, 5, status); } MeasureUnit *MeasureUnit::createMonth(UErrorCode &status) { - return MeasureUnit::create(7, 6, status); + return MeasureUnit::create(8, 6, status); } MeasureUnit *MeasureUnit::createNanosecond(UErrorCode &status) { - return MeasureUnit::create(7, 7, status); + return MeasureUnit::create(8, 7, status); } MeasureUnit *MeasureUnit::createSecond(UErrorCode &status) { - return MeasureUnit::create(7, 8, status); + return MeasureUnit::create(8, 8, status); } MeasureUnit *MeasureUnit::createWeek(UErrorCode &status) { - return MeasureUnit::create(7, 9, status); + return MeasureUnit::create(8, 9, status); } MeasureUnit *MeasureUnit::createYear(UErrorCode &status) { - return MeasureUnit::create(7, 10, status); + return MeasureUnit::create(8, 10, status); } MeasureUnit *MeasureUnit::createAmpere(UErrorCode &status) { - return MeasureUnit::create(8, 0, status); + return MeasureUnit::create(9, 0, status); } MeasureUnit *MeasureUnit::createMilliampere(UErrorCode &status) { - return MeasureUnit::create(8, 1, status); + return MeasureUnit::create(9, 1, status); } MeasureUnit *MeasureUnit::createOhm(UErrorCode &status) { - return MeasureUnit::create(8, 2, status); + return MeasureUnit::create(9, 2, status); } MeasureUnit *MeasureUnit::createVolt(UErrorCode &status) { - return MeasureUnit::create(8, 3, status); + return MeasureUnit::create(9, 3, status); } MeasureUnit *MeasureUnit::createCalorie(UErrorCode &status) { - return MeasureUnit::create(9, 0, status); + return MeasureUnit::create(10, 0, status); } MeasureUnit *MeasureUnit::createFoodcalorie(UErrorCode &status) { - return MeasureUnit::create(9, 1, status); + return MeasureUnit::create(10, 1, status); } MeasureUnit *MeasureUnit::createJoule(UErrorCode &status) { - return MeasureUnit::create(9, 2, status); + return MeasureUnit::create(10, 2, status); } MeasureUnit *MeasureUnit::createKilocalorie(UErrorCode &status) { - return MeasureUnit::create(9, 3, status); + return MeasureUnit::create(10, 3, status); } MeasureUnit *MeasureUnit::createKilojoule(UErrorCode &status) { - return MeasureUnit::create(9, 4, status); + return MeasureUnit::create(10, 4, status); } MeasureUnit *MeasureUnit::createKilowattHour(UErrorCode &status) { - return MeasureUnit::create(9, 5, status); + return MeasureUnit::create(10, 5, status); } MeasureUnit *MeasureUnit::createGigahertz(UErrorCode &status) { - return MeasureUnit::create(10, 0, status); + return MeasureUnit::create(11, 0, status); } MeasureUnit *MeasureUnit::createHertz(UErrorCode &status) { - return MeasureUnit::create(10, 1, status); + return MeasureUnit::create(11, 1, status); } MeasureUnit *MeasureUnit::createKilohertz(UErrorCode &status) { - return MeasureUnit::create(10, 2, status); + return MeasureUnit::create(11, 2, status); } MeasureUnit *MeasureUnit::createMegahertz(UErrorCode &status) { - return MeasureUnit::create(10, 3, status); + return MeasureUnit::create(11, 3, status); } MeasureUnit *MeasureUnit::createAstronomicalUnit(UErrorCode &status) { - return MeasureUnit::create(11, 0, status); + return MeasureUnit::create(12, 0, status); } MeasureUnit *MeasureUnit::createCentimeter(UErrorCode &status) { - return MeasureUnit::create(11, 1, status); + return MeasureUnit::create(12, 1, status); } MeasureUnit *MeasureUnit::createDecimeter(UErrorCode &status) { - return MeasureUnit::create(11, 2, status); + return MeasureUnit::create(12, 2, status); } MeasureUnit *MeasureUnit::createFathom(UErrorCode &status) { - return MeasureUnit::create(11, 3, status); + return MeasureUnit::create(12, 3, status); } MeasureUnit *MeasureUnit::createFoot(UErrorCode &status) { - return MeasureUnit::create(11, 4, status); + return MeasureUnit::create(12, 4, status); } MeasureUnit *MeasureUnit::createFurlong(UErrorCode &status) { - return MeasureUnit::create(11, 5, status); + return MeasureUnit::create(12, 5, status); } MeasureUnit *MeasureUnit::createInch(UErrorCode &status) { - return MeasureUnit::create(11, 6, status); + return MeasureUnit::create(12, 6, status); } MeasureUnit *MeasureUnit::createKilometer(UErrorCode &status) { - return MeasureUnit::create(11, 7, status); + return MeasureUnit::create(12, 7, status); } MeasureUnit *MeasureUnit::createLightYear(UErrorCode &status) { - return MeasureUnit::create(11, 8, status); + return MeasureUnit::create(12, 8, status); } MeasureUnit *MeasureUnit::createMeter(UErrorCode &status) { - return MeasureUnit::create(11, 9, status); + return MeasureUnit::create(12, 9, status); } MeasureUnit *MeasureUnit::createMicrometer(UErrorCode &status) { - return MeasureUnit::create(11, 10, status); + return MeasureUnit::create(12, 10, status); } MeasureUnit *MeasureUnit::createMile(UErrorCode &status) { - return MeasureUnit::create(11, 11, status); + return MeasureUnit::create(12, 11, status); } MeasureUnit *MeasureUnit::createMileScandinavian(UErrorCode &status) { - return MeasureUnit::create(11, 12, status); + return MeasureUnit::create(12, 12, status); } MeasureUnit *MeasureUnit::createMillimeter(UErrorCode &status) { - return MeasureUnit::create(11, 13, status); + return MeasureUnit::create(12, 13, status); } MeasureUnit *MeasureUnit::createNanometer(UErrorCode &status) { - return MeasureUnit::create(11, 14, status); + return MeasureUnit::create(12, 14, status); } MeasureUnit *MeasureUnit::createNauticalMile(UErrorCode &status) { - return MeasureUnit::create(11, 15, status); + return MeasureUnit::create(12, 15, status); } MeasureUnit *MeasureUnit::createParsec(UErrorCode &status) { - return MeasureUnit::create(11, 16, status); + return MeasureUnit::create(12, 16, status); } MeasureUnit *MeasureUnit::createPicometer(UErrorCode &status) { - return MeasureUnit::create(11, 17, status); + return MeasureUnit::create(12, 17, status); } MeasureUnit *MeasureUnit::createYard(UErrorCode &status) { - return MeasureUnit::create(11, 18, status); + return MeasureUnit::create(12, 18, status); } MeasureUnit *MeasureUnit::createLux(UErrorCode &status) { - return MeasureUnit::create(12, 0, status); + return MeasureUnit::create(13, 0, status); } MeasureUnit *MeasureUnit::createCarat(UErrorCode &status) { - return MeasureUnit::create(13, 0, status); + return MeasureUnit::create(14, 0, status); } MeasureUnit *MeasureUnit::createGram(UErrorCode &status) { - return MeasureUnit::create(13, 1, status); + return MeasureUnit::create(14, 1, status); } MeasureUnit *MeasureUnit::createKilogram(UErrorCode &status) { - return MeasureUnit::create(13, 2, status); + return MeasureUnit::create(14, 2, status); } MeasureUnit *MeasureUnit::createMetricTon(UErrorCode &status) { - return MeasureUnit::create(13, 3, status); + return MeasureUnit::create(14, 3, status); } MeasureUnit *MeasureUnit::createMicrogram(UErrorCode &status) { - return MeasureUnit::create(13, 4, status); + return MeasureUnit::create(14, 4, status); } MeasureUnit *MeasureUnit::createMilligram(UErrorCode &status) { - return MeasureUnit::create(13, 5, status); + return MeasureUnit::create(14, 5, status); } MeasureUnit *MeasureUnit::createOunce(UErrorCode &status) { - return MeasureUnit::create(13, 6, status); + return MeasureUnit::create(14, 6, status); } MeasureUnit *MeasureUnit::createOunceTroy(UErrorCode &status) { - return MeasureUnit::create(13, 7, status); + return MeasureUnit::create(14, 7, status); } MeasureUnit *MeasureUnit::createPound(UErrorCode &status) { - return MeasureUnit::create(13, 8, status); + return MeasureUnit::create(14, 8, status); } MeasureUnit *MeasureUnit::createStone(UErrorCode &status) { - return MeasureUnit::create(13, 9, status); + return MeasureUnit::create(14, 9, status); } MeasureUnit *MeasureUnit::createTon(UErrorCode &status) { - return MeasureUnit::create(13, 10, status); + return MeasureUnit::create(14, 10, status); } MeasureUnit *MeasureUnit::createGigawatt(UErrorCode &status) { - return MeasureUnit::create(14, 0, status); + return MeasureUnit::create(15, 0, status); } MeasureUnit *MeasureUnit::createHorsepower(UErrorCode &status) { - return MeasureUnit::create(14, 1, status); + return MeasureUnit::create(15, 1, status); } MeasureUnit *MeasureUnit::createKilowatt(UErrorCode &status) { - return MeasureUnit::create(14, 2, status); + return MeasureUnit::create(15, 2, status); } MeasureUnit *MeasureUnit::createMegawatt(UErrorCode &status) { - return MeasureUnit::create(14, 3, status); + return MeasureUnit::create(15, 3, status); } MeasureUnit *MeasureUnit::createMilliwatt(UErrorCode &status) { - return MeasureUnit::create(14, 4, status); + return MeasureUnit::create(15, 4, status); } MeasureUnit *MeasureUnit::createWatt(UErrorCode &status) { - return MeasureUnit::create(14, 5, status); + return MeasureUnit::create(15, 5, status); } MeasureUnit *MeasureUnit::createHectopascal(UErrorCode &status) { - return MeasureUnit::create(15, 0, status); + return MeasureUnit::create(16, 0, status); } MeasureUnit *MeasureUnit::createInchHg(UErrorCode &status) { - return MeasureUnit::create(15, 1, status); + return MeasureUnit::create(16, 1, status); } MeasureUnit *MeasureUnit::createMillibar(UErrorCode &status) { - return MeasureUnit::create(15, 2, status); + return MeasureUnit::create(16, 2, status); } MeasureUnit *MeasureUnit::createMillimeterOfMercury(UErrorCode &status) { - return MeasureUnit::create(15, 3, status); + return MeasureUnit::create(16, 3, status); } MeasureUnit *MeasureUnit::createPoundPerSquareInch(UErrorCode &status) { - return MeasureUnit::create(15, 4, status); + return MeasureUnit::create(16, 4, status); } MeasureUnit *MeasureUnit::createKilometerPerHour(UErrorCode &status) { - return MeasureUnit::create(16, 0, status); + return MeasureUnit::create(17, 0, status); } MeasureUnit *MeasureUnit::createKnot(UErrorCode &status) { - return MeasureUnit::create(16, 1, status); + return MeasureUnit::create(17, 1, status); } MeasureUnit *MeasureUnit::createMeterPerSecond(UErrorCode &status) { - return MeasureUnit::create(16, 2, status); + return MeasureUnit::create(17, 2, status); } MeasureUnit *MeasureUnit::createMilePerHour(UErrorCode &status) { - return MeasureUnit::create(16, 3, status); + return MeasureUnit::create(17, 3, status); } MeasureUnit *MeasureUnit::createCelsius(UErrorCode &status) { - return MeasureUnit::create(17, 0, status); + return MeasureUnit::create(18, 0, status); } MeasureUnit *MeasureUnit::createFahrenheit(UErrorCode &status) { - return MeasureUnit::create(17, 1, status); + return MeasureUnit::create(18, 1, status); } MeasureUnit *MeasureUnit::createGenericTemperature(UErrorCode &status) { - return MeasureUnit::create(17, 2, status); + return MeasureUnit::create(18, 2, status); } MeasureUnit *MeasureUnit::createKelvin(UErrorCode &status) { - return MeasureUnit::create(17, 3, status); + return MeasureUnit::create(18, 3, status); } MeasureUnit *MeasureUnit::createAcreFoot(UErrorCode &status) { - return MeasureUnit::create(18, 0, status); + return MeasureUnit::create(19, 0, status); } MeasureUnit *MeasureUnit::createBushel(UErrorCode &status) { - return MeasureUnit::create(18, 1, status); + return MeasureUnit::create(19, 1, status); } MeasureUnit *MeasureUnit::createCentiliter(UErrorCode &status) { - return MeasureUnit::create(18, 2, status); + return MeasureUnit::create(19, 2, status); } MeasureUnit *MeasureUnit::createCubicCentimeter(UErrorCode &status) { - return MeasureUnit::create(18, 3, status); + return MeasureUnit::create(19, 3, status); } MeasureUnit *MeasureUnit::createCubicFoot(UErrorCode &status) { - return MeasureUnit::create(18, 4, status); + return MeasureUnit::create(19, 4, status); } MeasureUnit *MeasureUnit::createCubicInch(UErrorCode &status) { - return MeasureUnit::create(18, 5, status); + return MeasureUnit::create(19, 5, status); } MeasureUnit *MeasureUnit::createCubicKilometer(UErrorCode &status) { - return MeasureUnit::create(18, 6, status); + return MeasureUnit::create(19, 6, status); } MeasureUnit *MeasureUnit::createCubicMeter(UErrorCode &status) { - return MeasureUnit::create(18, 7, status); + return MeasureUnit::create(19, 7, status); } MeasureUnit *MeasureUnit::createCubicMile(UErrorCode &status) { - return MeasureUnit::create(18, 8, status); + return MeasureUnit::create(19, 8, status); } MeasureUnit *MeasureUnit::createCubicYard(UErrorCode &status) { - return MeasureUnit::create(18, 9, status); + return MeasureUnit::create(19, 9, status); } MeasureUnit *MeasureUnit::createCup(UErrorCode &status) { - return MeasureUnit::create(18, 10, status); + return MeasureUnit::create(19, 10, status); } MeasureUnit *MeasureUnit::createCupMetric(UErrorCode &status) { - return MeasureUnit::create(18, 11, status); + return MeasureUnit::create(19, 11, status); } MeasureUnit *MeasureUnit::createDeciliter(UErrorCode &status) { - return MeasureUnit::create(18, 12, status); + return MeasureUnit::create(19, 12, status); } MeasureUnit *MeasureUnit::createFluidOunce(UErrorCode &status) { - return MeasureUnit::create(18, 13, status); + return MeasureUnit::create(19, 13, status); } MeasureUnit *MeasureUnit::createGallon(UErrorCode &status) { - return MeasureUnit::create(18, 14, status); + return MeasureUnit::create(19, 14, status); } MeasureUnit *MeasureUnit::createGallonImperial(UErrorCode &status) { - return MeasureUnit::create(18, 15, status); + return MeasureUnit::create(19, 15, status); } MeasureUnit *MeasureUnit::createHectoliter(UErrorCode &status) { - return MeasureUnit::create(18, 16, status); + return MeasureUnit::create(19, 16, status); } MeasureUnit *MeasureUnit::createLiter(UErrorCode &status) { - return MeasureUnit::create(18, 17, status); + return MeasureUnit::create(19, 17, status); } MeasureUnit *MeasureUnit::createMegaliter(UErrorCode &status) { - return MeasureUnit::create(18, 18, status); + return MeasureUnit::create(19, 18, status); } MeasureUnit *MeasureUnit::createMilliliter(UErrorCode &status) { - return MeasureUnit::create(18, 19, status); + return MeasureUnit::create(19, 19, status); } MeasureUnit *MeasureUnit::createPint(UErrorCode &status) { - return MeasureUnit::create(18, 20, status); + return MeasureUnit::create(19, 20, status); } MeasureUnit *MeasureUnit::createPintMetric(UErrorCode &status) { - return MeasureUnit::create(18, 21, status); + return MeasureUnit::create(19, 21, status); } MeasureUnit *MeasureUnit::createQuart(UErrorCode &status) { - return MeasureUnit::create(18, 22, status); + return MeasureUnit::create(19, 22, status); } MeasureUnit *MeasureUnit::createTablespoon(UErrorCode &status) { - return MeasureUnit::create(18, 23, status); + return MeasureUnit::create(19, 23, status); } MeasureUnit *MeasureUnit::createTeaspoon(UErrorCode &status) { - return MeasureUnit::create(18, 24, status); + return MeasureUnit::create(19, 24, status); } // End generated code diff --git a/icu4c/source/i18n/unicode/measunit.h b/icu4c/source/i18n/unicode/measunit.h index 3c0e0fad5ac..afef83ed0e9 100644 --- a/icu4c/source/i18n/unicode/measunit.h +++ b/icu4c/source/i18n/unicode/measunit.h @@ -257,15 +257,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createRadian(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of angle: revolution. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createRevolutionAngle(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of area: acre. @@ -377,15 +375,13 @@ class U_I18N_API MeasureUnit: public UObject { static MeasureUnit *createPartPerMillion(UErrorCode &status); #endif /* U_HIDE_DRAFT_API */ -#ifndef U_HIDE_DRAFT_API /** * Returns unit of consumption: liter-per-100kilometers. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of consumption: liter-per-kilometer. @@ -413,6 +409,46 @@ class U_I18N_API MeasureUnit: public UObject { static MeasureUnit *createMilePerGallonImperial(UErrorCode &status); #endif /* U_HIDE_DRAFT_API */ +#ifndef U_HIDE_DRAFT_API + /** + * Returns unit of coordinate: east. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @draft ICU 58 + */ + static MeasureUnit *createEast(UErrorCode &status); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns unit of coordinate: north. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @draft ICU 58 + */ + static MeasureUnit *createNorth(UErrorCode &status); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns unit of coordinate: south. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @draft ICU 58 + */ + static MeasureUnit *createSouth(UErrorCode &status); +#endif /* U_HIDE_DRAFT_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Returns unit of coordinate: west. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @draft ICU 58 + */ + static MeasureUnit *createWest(UErrorCode &status); +#endif /* U_HIDE_DRAFT_API */ + /** * Returns unit of digital: bit. * Caller owns returned value and must free it. @@ -493,15 +529,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createTerabyte(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of duration: century. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createCentury(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of duration: day. @@ -791,15 +825,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createMile(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of length: mile-scandinavian. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createMileScandinavian(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of length: millimeter. @@ -1041,15 +1073,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createKilometerPerHour(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of speed: knot. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createKnot(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of speed: meter-per-second. @@ -1083,15 +1113,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createFahrenheit(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of temperature: generic. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createGenericTemperature(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of temperature: kelvin. @@ -1189,15 +1217,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createCup(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of volume: cup-metric. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createCupMetric(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of volume: deciliter. @@ -1273,15 +1299,13 @@ class U_I18N_API MeasureUnit: public UObject { */ static MeasureUnit *createPint(UErrorCode &status); -#ifndef U_HIDE_DRAFT_API /** * Returns unit of volume: pint-metric. * Caller owns returned value and must free it. * @param status ICU error code. - * @draft ICU 56 + * @stable ICU 56 */ static MeasureUnit *createPintMetric(UErrorCode &status); -#endif /* U_HIDE_DRAFT_API */ /** * Returns unit of volume: quart. diff --git a/icu4c/source/test/intltest/measfmttest.cpp b/icu4c/source/test/intltest/measfmttest.cpp index e387308fce5..9830ecc5421 100644 --- a/icu4c/source/test/intltest/measfmttest.cpp +++ b/icu4c/source/test/intltest/measfmttest.cpp @@ -46,6 +46,7 @@ private: void TestCompatible55_1(); void TestCompatible56_1(); void TestCompatible57_1(); + void TestCompatible58_1(); void TestGetAvailable(); void TestExamplesInDocs(); void TestFormatPeriodEn(); @@ -141,6 +142,7 @@ void MeasureFormatTest::runIndexedTest( TESTCASE_AUTO(TestCompatible55_1); TESTCASE_AUTO(TestCompatible56_1); TESTCASE_AUTO(TestCompatible57_1); + TESTCASE_AUTO(TestCompatible58_1); TESTCASE_AUTO(TestGetAvailable); TESTCASE_AUTO(TestExamplesInDocs); TESTCASE_AUTO(TestFormatPeriodEn); @@ -748,6 +750,150 @@ void MeasureFormatTest::TestCompatible57_1() { assertSuccess("", status); } +void MeasureFormatTest::TestCompatible58_1() { + UErrorCode status = U_ZERO_ERROR; + LocalPointer measureUnit; + measureUnit.adoptInstead(MeasureUnit::createGForce(status)); + measureUnit.adoptInstead(MeasureUnit::createMeterPerSecondSquared(status)); + measureUnit.adoptInstead(MeasureUnit::createArcMinute(status)); + measureUnit.adoptInstead(MeasureUnit::createArcSecond(status)); + measureUnit.adoptInstead(MeasureUnit::createDegree(status)); + measureUnit.adoptInstead(MeasureUnit::createRadian(status)); + measureUnit.adoptInstead(MeasureUnit::createRevolutionAngle(status)); + measureUnit.adoptInstead(MeasureUnit::createAcre(status)); + measureUnit.adoptInstead(MeasureUnit::createHectare(status)); + measureUnit.adoptInstead(MeasureUnit::createSquareCentimeter(status)); + measureUnit.adoptInstead(MeasureUnit::createSquareFoot(status)); + measureUnit.adoptInstead(MeasureUnit::createSquareInch(status)); + measureUnit.adoptInstead(MeasureUnit::createSquareKilometer(status)); + measureUnit.adoptInstead(MeasureUnit::createSquareMeter(status)); + measureUnit.adoptInstead(MeasureUnit::createSquareMile(status)); + measureUnit.adoptInstead(MeasureUnit::createSquareYard(status)); + measureUnit.adoptInstead(MeasureUnit::createKarat(status)); + measureUnit.adoptInstead(MeasureUnit::createMilligramPerDeciliter(status)); + measureUnit.adoptInstead(MeasureUnit::createMillimolePerLiter(status)); + measureUnit.adoptInstead(MeasureUnit::createPartPerMillion(status)); + measureUnit.adoptInstead(MeasureUnit::createLiterPer100Kilometers(status)); + measureUnit.adoptInstead(MeasureUnit::createLiterPerKilometer(status)); + measureUnit.adoptInstead(MeasureUnit::createMilePerGallon(status)); + measureUnit.adoptInstead(MeasureUnit::createMilePerGallonImperial(status)); + measureUnit.adoptInstead(MeasureUnit::createEast(status)); + measureUnit.adoptInstead(MeasureUnit::createNorth(status)); + measureUnit.adoptInstead(MeasureUnit::createSouth(status)); + measureUnit.adoptInstead(MeasureUnit::createWest(status)); + measureUnit.adoptInstead(MeasureUnit::createBit(status)); + measureUnit.adoptInstead(MeasureUnit::createByte(status)); + measureUnit.adoptInstead(MeasureUnit::createGigabit(status)); + measureUnit.adoptInstead(MeasureUnit::createGigabyte(status)); + measureUnit.adoptInstead(MeasureUnit::createKilobit(status)); + measureUnit.adoptInstead(MeasureUnit::createKilobyte(status)); + measureUnit.adoptInstead(MeasureUnit::createMegabit(status)); + measureUnit.adoptInstead(MeasureUnit::createMegabyte(status)); + measureUnit.adoptInstead(MeasureUnit::createTerabit(status)); + measureUnit.adoptInstead(MeasureUnit::createTerabyte(status)); + measureUnit.adoptInstead(MeasureUnit::createCentury(status)); + measureUnit.adoptInstead(MeasureUnit::createDay(status)); + measureUnit.adoptInstead(MeasureUnit::createHour(status)); + measureUnit.adoptInstead(MeasureUnit::createMicrosecond(status)); + measureUnit.adoptInstead(MeasureUnit::createMillisecond(status)); + measureUnit.adoptInstead(MeasureUnit::createMinute(status)); + measureUnit.adoptInstead(MeasureUnit::createMonth(status)); + measureUnit.adoptInstead(MeasureUnit::createNanosecond(status)); + measureUnit.adoptInstead(MeasureUnit::createSecond(status)); + measureUnit.adoptInstead(MeasureUnit::createWeek(status)); + measureUnit.adoptInstead(MeasureUnit::createYear(status)); + measureUnit.adoptInstead(MeasureUnit::createAmpere(status)); + measureUnit.adoptInstead(MeasureUnit::createMilliampere(status)); + measureUnit.adoptInstead(MeasureUnit::createOhm(status)); + measureUnit.adoptInstead(MeasureUnit::createVolt(status)); + measureUnit.adoptInstead(MeasureUnit::createCalorie(status)); + measureUnit.adoptInstead(MeasureUnit::createFoodcalorie(status)); + measureUnit.adoptInstead(MeasureUnit::createJoule(status)); + measureUnit.adoptInstead(MeasureUnit::createKilocalorie(status)); + measureUnit.adoptInstead(MeasureUnit::createKilojoule(status)); + measureUnit.adoptInstead(MeasureUnit::createKilowattHour(status)); + measureUnit.adoptInstead(MeasureUnit::createGigahertz(status)); + measureUnit.adoptInstead(MeasureUnit::createHertz(status)); + measureUnit.adoptInstead(MeasureUnit::createKilohertz(status)); + measureUnit.adoptInstead(MeasureUnit::createMegahertz(status)); + measureUnit.adoptInstead(MeasureUnit::createAstronomicalUnit(status)); + measureUnit.adoptInstead(MeasureUnit::createCentimeter(status)); + measureUnit.adoptInstead(MeasureUnit::createDecimeter(status)); + measureUnit.adoptInstead(MeasureUnit::createFathom(status)); + measureUnit.adoptInstead(MeasureUnit::createFoot(status)); + measureUnit.adoptInstead(MeasureUnit::createFurlong(status)); + measureUnit.adoptInstead(MeasureUnit::createInch(status)); + measureUnit.adoptInstead(MeasureUnit::createKilometer(status)); + measureUnit.adoptInstead(MeasureUnit::createLightYear(status)); + measureUnit.adoptInstead(MeasureUnit::createMeter(status)); + measureUnit.adoptInstead(MeasureUnit::createMicrometer(status)); + measureUnit.adoptInstead(MeasureUnit::createMile(status)); + measureUnit.adoptInstead(MeasureUnit::createMileScandinavian(status)); + measureUnit.adoptInstead(MeasureUnit::createMillimeter(status)); + measureUnit.adoptInstead(MeasureUnit::createNanometer(status)); + measureUnit.adoptInstead(MeasureUnit::createNauticalMile(status)); + measureUnit.adoptInstead(MeasureUnit::createParsec(status)); + measureUnit.adoptInstead(MeasureUnit::createPicometer(status)); + measureUnit.adoptInstead(MeasureUnit::createYard(status)); + measureUnit.adoptInstead(MeasureUnit::createLux(status)); + measureUnit.adoptInstead(MeasureUnit::createCarat(status)); + measureUnit.adoptInstead(MeasureUnit::createGram(status)); + measureUnit.adoptInstead(MeasureUnit::createKilogram(status)); + measureUnit.adoptInstead(MeasureUnit::createMetricTon(status)); + measureUnit.adoptInstead(MeasureUnit::createMicrogram(status)); + measureUnit.adoptInstead(MeasureUnit::createMilligram(status)); + measureUnit.adoptInstead(MeasureUnit::createOunce(status)); + measureUnit.adoptInstead(MeasureUnit::createOunceTroy(status)); + measureUnit.adoptInstead(MeasureUnit::createPound(status)); + measureUnit.adoptInstead(MeasureUnit::createStone(status)); + measureUnit.adoptInstead(MeasureUnit::createTon(status)); + measureUnit.adoptInstead(MeasureUnit::createGigawatt(status)); + measureUnit.adoptInstead(MeasureUnit::createHorsepower(status)); + measureUnit.adoptInstead(MeasureUnit::createKilowatt(status)); + measureUnit.adoptInstead(MeasureUnit::createMegawatt(status)); + measureUnit.adoptInstead(MeasureUnit::createMilliwatt(status)); + measureUnit.adoptInstead(MeasureUnit::createWatt(status)); + measureUnit.adoptInstead(MeasureUnit::createHectopascal(status)); + measureUnit.adoptInstead(MeasureUnit::createInchHg(status)); + measureUnit.adoptInstead(MeasureUnit::createMillibar(status)); + measureUnit.adoptInstead(MeasureUnit::createMillimeterOfMercury(status)); + measureUnit.adoptInstead(MeasureUnit::createPoundPerSquareInch(status)); + measureUnit.adoptInstead(MeasureUnit::createKilometerPerHour(status)); + measureUnit.adoptInstead(MeasureUnit::createKnot(status)); + measureUnit.adoptInstead(MeasureUnit::createMeterPerSecond(status)); + measureUnit.adoptInstead(MeasureUnit::createMilePerHour(status)); + measureUnit.adoptInstead(MeasureUnit::createCelsius(status)); + measureUnit.adoptInstead(MeasureUnit::createFahrenheit(status)); + measureUnit.adoptInstead(MeasureUnit::createGenericTemperature(status)); + measureUnit.adoptInstead(MeasureUnit::createKelvin(status)); + measureUnit.adoptInstead(MeasureUnit::createAcreFoot(status)); + measureUnit.adoptInstead(MeasureUnit::createBushel(status)); + measureUnit.adoptInstead(MeasureUnit::createCentiliter(status)); + measureUnit.adoptInstead(MeasureUnit::createCubicCentimeter(status)); + measureUnit.adoptInstead(MeasureUnit::createCubicFoot(status)); + measureUnit.adoptInstead(MeasureUnit::createCubicInch(status)); + measureUnit.adoptInstead(MeasureUnit::createCubicKilometer(status)); + measureUnit.adoptInstead(MeasureUnit::createCubicMeter(status)); + measureUnit.adoptInstead(MeasureUnit::createCubicMile(status)); + measureUnit.adoptInstead(MeasureUnit::createCubicYard(status)); + measureUnit.adoptInstead(MeasureUnit::createCup(status)); + measureUnit.adoptInstead(MeasureUnit::createCupMetric(status)); + measureUnit.adoptInstead(MeasureUnit::createDeciliter(status)); + measureUnit.adoptInstead(MeasureUnit::createFluidOunce(status)); + measureUnit.adoptInstead(MeasureUnit::createGallon(status)); + measureUnit.adoptInstead(MeasureUnit::createGallonImperial(status)); + measureUnit.adoptInstead(MeasureUnit::createHectoliter(status)); + measureUnit.adoptInstead(MeasureUnit::createLiter(status)); + measureUnit.adoptInstead(MeasureUnit::createMegaliter(status)); + measureUnit.adoptInstead(MeasureUnit::createMilliliter(status)); + measureUnit.adoptInstead(MeasureUnit::createPint(status)); + measureUnit.adoptInstead(MeasureUnit::createPintMetric(status)); + measureUnit.adoptInstead(MeasureUnit::createQuart(status)); + measureUnit.adoptInstead(MeasureUnit::createTablespoon(status)); + measureUnit.adoptInstead(MeasureUnit::createTeaspoon(status)); + assertSuccess("", status); +} + void MeasureFormatTest::TestBasic() { UErrorCode status = U_ZERO_ERROR; MeasureUnit *ptr1 = MeasureUnit::createArcMinute(status); -- 2.40.0