// TODO(ICU-20920): Get this list from data
const char16_t* const gSimpleUnits[] = {
u"one", // note: expected to be index 0
- u"100kilometer",
- u"acre",
- u"ampere",
- u"arc-minute",
- u"arc-second",
- u"astronomical-unit",
- u"atmosphere",
- u"bar",
- u"barrel",
- u"bit",
- u"british-thermal-unit",
- u"bushel",
- u"byte",
- u"calorie",
+ u"candela",
u"carat",
- u"celsius",
- u"century",
- u"cup",
- u"cup-metric",
- u"dalton",
- u"day",
- u"day-person",
- u"decade",
- u"degree",
- u"dot", // (as in "dot-per-inch")
- u"dunam",
- u"earth-mass",
- u"electronvolt",
- u"em",
- u"fahrenheit",
- u"fathom",
- u"fluid-ounce",
- u"fluid-ounce-imperial",
- u"foodcalorie",
- u"foot",
- u"furlong",
- u"g-force",
- u"gallon",
- u"gallon-imperial",
- u"generic", // (i.e., "temperature-generic")
u"gram",
- u"hectare", // (note: other "are" derivatives are uncommon)
- u"hertz",
- u"horsepower",
- u"hour",
+ u"ounce",
+ u"ounce-troy",
+ u"pound",
+ u"kilogram",
+ u"stone",
+ u"ton",
+ u"metric-ton",
+ u"earth-mass",
+ u"solar-mass",
+ u"point",
u"inch",
- u"inch-hg",
- u"joule",
- u"karat",
- u"kelvin",
- u"knot",
- u"light-year",
- u"liter",
- u"lux",
+ u"foot",
+ u"yard",
u"meter",
- u"meter-of-mercury", // (not "millimeter-of-mercury")
- u"metric-ton",
+ u"fathom",
+ u"furlong",
u"mile",
+ u"nautical-mile",
u"mile-scandinavian",
+ u"100-kilometer",
+ u"earth-radius",
+ u"solar-radius",
+ u"astronomical-unit",
+ u"light-year",
+ u"parsec",
+ u"second",
u"minute",
- u"mole",
+ u"hour",
+ u"day",
+ u"day-person",
+ u"week",
+ u"week-person",
u"month",
u"month-person",
- u"nautical-mile",
- u"newton",
- u"ohm",
- u"ounce",
- u"ounce-troy",
- u"parsec",
- u"pascal",
- u"percent",
- u"permille",
+ u"year",
+ u"year-person",
+ u"decade",
+ u"century",
+ u"ampere",
+ u"fahrenheit",
+ u"kelvin",
+ u"celsius",
+ u"arc-second",
+ u"arc-minute",
+ u"degree",
+ u"radian",
+ u"revolution",
+ u"item",
+ u"mole",
u"permillion",
u"permyriad",
- u"pint",
- u"pint-metric",
+ u"permille",
+ u"percent",
+ u"karat",
+ u"portion",
+ u"bit",
+ u"byte",
+ u"dot",
u"pixel",
- u"point",
- u"pound",
+ u"em",
+ u"hertz",
+ u"newton",
u"pound-force",
- u"quart",
- u"radian",
- u"revolution",
- u"second",
- u"solar-luminosity",
- u"solar-mass",
- u"solar-radius",
- u"stone",
- u"tablespoon",
- u"teaspoon",
+ u"pascal",
+ u"bar",
+ u"atmosphere",
+ u"ofhg",
+ u"electronvolt",
+ u"dalton",
+ u"joule",
+ u"calorie",
+ u"british-thermal-unit",
+ u"foodcalorie",
u"therm-us",
- u"ton",
- u"volt",
u"watt",
- u"week",
- u"week-person",
- u"yard",
- u"year",
- u"year-person",
+ u"horsepower",
+ u"solar-luminosity",
+ u"volt",
+ u"ohm",
+ u"dunam",
+ u"acre",
+ u"hectare",
+ u"teaspoon",
+ u"tablespoon",
+ u"fluid-ounce-imperial",
+ u"fluid-ounce",
+ u"cup",
+ u"cup-metric",
+ u"pint",
+ u"pint-metric",
+ u"quart",
+ u"liter",
+ u"gallon",
+ u"gallon-imperial",
+ u"bushel",
+ u"barrel",
+ u"knot",
+ u"g-force",
+ u"lux",
};
icu::UInitOnce gUnitExtrasInitOnce = U_INITONCE_INITIALIZER;
U_NAMESPACE_BEGIN
+/**
+ * A struct representing a single unit (optional SI prefix and dimensionality).
+ */
struct SingleUnitImpl : public UMemory {
/**
* Gets a single unit from the MeasureUnit. If there are multiple single units, sets an error