Lines Matching refs:unit

27     "decimal", "percent", "currency", "unit"
238 // Get All ICU measure unit
245 // Find measure unit according to sanctioned unit
246 // then return measure unit
247 for (auto &unit : units) {
248 if (std::strcmp(sanctionedUnit.c_str(), unit.getSubtype()) == 0) {
249 return unit;
256 bool IsSanctionedSimpleUnitIdentifier(const std::string &unit)
258 // 1. If unitIdentifier is listed in sanctioned unit set, return true.
259 auto it = SANCTIONED_UNIT.find(unit);
269 bool IsWellFormedUnitIdentifier(const std::string &unit, icu::MeasureUnit &icuUnit, icu::MeasureUnit &icuPerUnit)
275 auto pos = unit.find("-per-");
276 if (IsSanctionedSimpleUnitIdentifier(unit) && pos == std::string::npos) {
277 result = ToMeasureUnit(unit);
286 if (pos == std::string::npos || unit.find("-per-", afterPos) != std::string::npos) {
291 std::string numerator = unit.substr(0, pos);
301 std::string denominator = unit.substr(pos + JSNumberFormat::PERUNIT_STRING);
326 // 3. Let style be ? GetOption(options, "style", "string", « "decimal", "percent", "currency", "unit" », "decimal").
381 // 10. Let unit be ? GetOption(options, "unit", "string", undefined, undefined).
383 JSHandle<JSTaggedValue> unit =
386 numberFormat->SetUnit(thread, unit);
388 // 11. If unit is not undefined, then
389 // If the result of IsWellFormedUnitIdentifier(unit) is false, throw a RangeError exception.
392 if (!unit->IsUndefined()) {
393 JSHandle<EcmaString> unitStr = JSHandle<EcmaString>::Cast(unit);
402 // 15.12. if style is "unit" and unit is undefined, throw a TypeError exception.
404 THROW_TYPE_ERROR_AND_RETURN(thread, "style is unit but unit is undefined", fractionDigitsOption);
433 *icuNumberFormatter = icuNumberFormatter->unit(icu::CurrencyUnit(currencyUStr.getBuffer(), status));
458 // 15. If style is "unit", then
459 // if unit is not undefiend set unit to LocalizedNumberFormatter
464 *icuNumberFormatter = icuNumberFormatter->unit(icuUnit);
610 // UNUM_UNIT_WIDTH_FULL_NAME Print the full name of the unit, without any abbreviations.
622 icuNumberFormatter = icuNumberFormatter.unit(icu::MeasureUnit::getPercent()).
758 // return the minor unit value corresponding to the currency from the list; otherwise, return 2.
892 // Special case in ICU when style is unit and unit is percent
1004 // [[Unit]] "unit"
1065 JSHandle<JSTaggedValue> unit(thread, numberFormat->GetUnit());
1066 if (!unit->IsUndefined()) {
1069 JSObject::CreateDataPropertyOrThrow(thread, options, property, unit);