2017-01-20 00:20:31 +00:00
|
|
|
// © 2016 and later: Unicode, Inc. and others.
|
2016-06-15 18:58:17 +00:00
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
2014-02-04 00:29:17 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
2016-05-31 21:45:07 +00:00
|
|
|
* Copyright (c) 2004-2016, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
2014-02-04 00:29:17 +00:00
|
|
|
**********************************************************************
|
|
|
|
* Author: Alan Liu
|
|
|
|
* Created: April 26, 2004
|
|
|
|
* Since: ICU 3.0
|
|
|
|
**********************************************************************
|
|
|
|
*/
|
2014-03-11 17:40:23 +00:00
|
|
|
#include "utypeinfo.h" // for 'typeid' to work
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
#include "unicode/measunit.h"
|
2014-03-11 17:40:23 +00:00
|
|
|
|
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
#include "unicode/uenum.h"
|
|
|
|
#include "ustrenum.h"
|
|
|
|
#include "cstring.h"
|
|
|
|
#include "uassert.h"
|
|
|
|
|
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2014-03-11 17:40:23 +00:00
|
|
|
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MeasureUnit)
|
|
|
|
|
2014-09-04 17:42:00 +00:00
|
|
|
// All code between the "Start generated code" comment and
|
|
|
|
// the "End generated code" comment is auto generated code
|
|
|
|
// and must not be edited manually. For instructions on how to correctly
|
|
|
|
// update this code, refer to:
|
2014-12-05 20:52:28 +00:00
|
|
|
// http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit
|
2014-09-04 17:42:00 +00:00
|
|
|
//
|
2014-06-02 22:47:11 +00:00
|
|
|
// Start generated code
|
|
|
|
|
2017-09-10 02:02:02 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
static const int32_t gOffsets[] = {
|
2014-09-03 21:08:45 +00:00
|
|
|
0,
|
|
|
|
2,
|
2015-06-28 03:26:33 +00:00
|
|
|
7,
|
|
|
|
16,
|
2016-02-02 00:38:16 +00:00
|
|
|
20,
|
|
|
|
24,
|
2017-01-23 16:20:59 +00:00
|
|
|
285,
|
|
|
|
295,
|
|
|
|
306,
|
|
|
|
310,
|
|
|
|
316,
|
|
|
|
320,
|
|
|
|
340,
|
2017-01-24 08:22:23 +00:00
|
|
|
341,
|
|
|
|
352,
|
2017-09-10 02:02:02 +00:00
|
|
|
355,
|
|
|
|
361,
|
|
|
|
366,
|
|
|
|
370,
|
|
|
|
374,
|
|
|
|
399
|
2014-02-04 00:29:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const int32_t gIndexes[] = {
|
|
|
|
0,
|
2014-09-02 23:18:20 +00:00
|
|
|
2,
|
2015-06-28 03:26:33 +00:00
|
|
|
7,
|
|
|
|
16,
|
2016-02-02 00:38:16 +00:00
|
|
|
20,
|
|
|
|
24,
|
2017-01-23 16:20:59 +00:00
|
|
|
24,
|
|
|
|
34,
|
|
|
|
45,
|
2016-02-02 00:38:16 +00:00
|
|
|
49,
|
2017-01-23 16:20:59 +00:00
|
|
|
55,
|
2016-02-02 00:38:16 +00:00
|
|
|
59,
|
2017-01-23 16:20:59 +00:00
|
|
|
79,
|
2017-01-24 08:22:23 +00:00
|
|
|
80,
|
|
|
|
91,
|
2017-09-10 02:02:02 +00:00
|
|
|
94,
|
|
|
|
100,
|
|
|
|
105,
|
|
|
|
109,
|
|
|
|
113,
|
|
|
|
138
|
2014-02-04 00:29:17 +00:00
|
|
|
};
|
|
|
|
|
2014-12-05 20:52:28 +00:00
|
|
|
// Must be sorted alphabetically.
|
2014-02-04 00:29:17 +00:00
|
|
|
static const char * const gTypes[] = {
|
|
|
|
"acceleration",
|
|
|
|
"angle",
|
|
|
|
"area",
|
2016-02-02 00:38:16 +00:00
|
|
|
"concentr",
|
2014-09-02 23:18:20 +00:00
|
|
|
"consumption",
|
2014-02-04 00:29:17 +00:00
|
|
|
"currency",
|
2014-09-02 23:18:20 +00:00
|
|
|
"digital",
|
2014-02-04 00:29:17 +00:00
|
|
|
"duration",
|
2014-09-02 23:18:20 +00:00
|
|
|
"electric",
|
|
|
|
"energy",
|
|
|
|
"frequency",
|
2014-02-04 00:29:17 +00:00
|
|
|
"length",
|
2014-09-02 23:18:20 +00:00
|
|
|
"light",
|
2014-02-04 00:29:17 +00:00
|
|
|
"mass",
|
2017-09-10 02:02:02 +00:00
|
|
|
"none",
|
2014-02-04 00:29:17 +00:00
|
|
|
"power",
|
|
|
|
"pressure",
|
|
|
|
"speed",
|
|
|
|
"temperature",
|
|
|
|
"volume"
|
|
|
|
};
|
|
|
|
|
2014-12-05 20:52:28 +00:00
|
|
|
// Must be grouped by type and sorted alphabetically within each type.
|
2014-02-04 00:29:17 +00:00
|
|
|
static const char * const gSubTypes[] = {
|
2014-09-03 21:08:45 +00:00
|
|
|
"g-force",
|
2014-09-02 23:18:20 +00:00
|
|
|
"meter-per-second-squared",
|
2014-09-03 21:08:45 +00:00
|
|
|
"arc-minute",
|
2014-02-04 00:29:17 +00:00
|
|
|
"arc-second",
|
|
|
|
"degree",
|
2014-09-02 23:18:20 +00:00
|
|
|
"radian",
|
2015-06-28 03:26:33 +00:00
|
|
|
"revolution",
|
2014-09-03 21:08:45 +00:00
|
|
|
"acre",
|
2014-02-04 00:29:17 +00:00
|
|
|
"hectare",
|
2014-09-02 23:18:20 +00:00
|
|
|
"square-centimeter",
|
2014-02-04 00:29:17 +00:00
|
|
|
"square-foot",
|
2014-09-02 23:18:20 +00:00
|
|
|
"square-inch",
|
2014-02-04 00:29:17 +00:00
|
|
|
"square-kilometer",
|
|
|
|
"square-meter",
|
|
|
|
"square-mile",
|
2014-09-02 23:18:20 +00:00
|
|
|
"square-yard",
|
2016-02-02 00:38:16 +00:00
|
|
|
"karat",
|
|
|
|
"milligram-per-deciliter",
|
|
|
|
"millimole-per-liter",
|
|
|
|
"part-per-million",
|
2015-06-28 03:26:33 +00:00
|
|
|
"liter-per-100kilometers",
|
2014-09-03 21:08:45 +00:00
|
|
|
"liter-per-kilometer",
|
2014-09-02 23:18:20 +00:00
|
|
|
"mile-per-gallon",
|
2016-02-02 00:38:16 +00:00
|
|
|
"mile-per-gallon-imperial",
|
2014-09-03 21:08:45 +00:00
|
|
|
"ADP",
|
2014-02-04 00:29:17 +00:00
|
|
|
"AED",
|
|
|
|
"AFA",
|
|
|
|
"AFN",
|
|
|
|
"ALL",
|
|
|
|
"AMD",
|
|
|
|
"ANG",
|
|
|
|
"AOA",
|
|
|
|
"AON",
|
|
|
|
"AOR",
|
|
|
|
"ARA",
|
|
|
|
"ARP",
|
|
|
|
"ARS",
|
|
|
|
"ATS",
|
|
|
|
"AUD",
|
|
|
|
"AWG",
|
|
|
|
"AYM",
|
|
|
|
"AZM",
|
|
|
|
"AZN",
|
|
|
|
"BAD",
|
|
|
|
"BAM",
|
|
|
|
"BBD",
|
|
|
|
"BDT",
|
|
|
|
"BEC",
|
|
|
|
"BEF",
|
|
|
|
"BEL",
|
|
|
|
"BGL",
|
|
|
|
"BGN",
|
|
|
|
"BHD",
|
|
|
|
"BIF",
|
|
|
|
"BMD",
|
|
|
|
"BND",
|
|
|
|
"BOB",
|
|
|
|
"BOV",
|
|
|
|
"BRC",
|
|
|
|
"BRE",
|
|
|
|
"BRL",
|
|
|
|
"BRN",
|
|
|
|
"BRR",
|
|
|
|
"BSD",
|
|
|
|
"BTN",
|
|
|
|
"BWP",
|
|
|
|
"BYB",
|
2017-01-23 16:20:59 +00:00
|
|
|
"BYN",
|
2014-02-04 00:29:17 +00:00
|
|
|
"BYR",
|
|
|
|
"BZD",
|
|
|
|
"CAD",
|
|
|
|
"CDF",
|
|
|
|
"CHC",
|
|
|
|
"CHE",
|
|
|
|
"CHF",
|
|
|
|
"CHW",
|
|
|
|
"CLF",
|
|
|
|
"CLP",
|
|
|
|
"CNY",
|
|
|
|
"COP",
|
|
|
|
"COU",
|
|
|
|
"CRC",
|
|
|
|
"CSD",
|
|
|
|
"CSK",
|
|
|
|
"CUC",
|
|
|
|
"CUP",
|
|
|
|
"CVE",
|
|
|
|
"CYP",
|
|
|
|
"CZK",
|
|
|
|
"DDM",
|
|
|
|
"DEM",
|
|
|
|
"DJF",
|
|
|
|
"DKK",
|
|
|
|
"DOP",
|
|
|
|
"DZD",
|
|
|
|
"ECS",
|
|
|
|
"ECV",
|
|
|
|
"EEK",
|
|
|
|
"EGP",
|
|
|
|
"ERN",
|
|
|
|
"ESA",
|
|
|
|
"ESB",
|
|
|
|
"ESP",
|
|
|
|
"ETB",
|
|
|
|
"EUR",
|
|
|
|
"FIM",
|
|
|
|
"FJD",
|
|
|
|
"FKP",
|
|
|
|
"FRF",
|
|
|
|
"GBP",
|
|
|
|
"GEK",
|
|
|
|
"GEL",
|
|
|
|
"GHC",
|
|
|
|
"GHP",
|
|
|
|
"GHS",
|
|
|
|
"GIP",
|
|
|
|
"GMD",
|
|
|
|
"GNF",
|
|
|
|
"GQE",
|
|
|
|
"GRD",
|
|
|
|
"GTQ",
|
|
|
|
"GWP",
|
|
|
|
"GYD",
|
|
|
|
"HKD",
|
|
|
|
"HNL",
|
|
|
|
"HRD",
|
|
|
|
"HRK",
|
|
|
|
"HTG",
|
|
|
|
"HUF",
|
|
|
|
"IDR",
|
|
|
|
"IEP",
|
|
|
|
"ILS",
|
|
|
|
"INR",
|
|
|
|
"IQD",
|
|
|
|
"IRR",
|
|
|
|
"ISK",
|
|
|
|
"ITL",
|
|
|
|
"JMD",
|
|
|
|
"JOD",
|
|
|
|
"JPY",
|
|
|
|
"KES",
|
|
|
|
"KGS",
|
|
|
|
"KHR",
|
|
|
|
"KMF",
|
|
|
|
"KPW",
|
|
|
|
"KRW",
|
|
|
|
"KWD",
|
|
|
|
"KYD",
|
|
|
|
"KZT",
|
|
|
|
"LAK",
|
|
|
|
"LBP",
|
|
|
|
"LKR",
|
|
|
|
"LRD",
|
|
|
|
"LSL",
|
|
|
|
"LTL",
|
|
|
|
"LTT",
|
|
|
|
"LUC",
|
|
|
|
"LUF",
|
|
|
|
"LUL",
|
|
|
|
"LVL",
|
|
|
|
"LVR",
|
|
|
|
"LYD",
|
|
|
|
"MAD",
|
|
|
|
"MDL",
|
|
|
|
"MGA",
|
|
|
|
"MGF",
|
|
|
|
"MKD",
|
|
|
|
"MLF",
|
|
|
|
"MMK",
|
|
|
|
"MNT",
|
|
|
|
"MOP",
|
|
|
|
"MRO",
|
|
|
|
"MTL",
|
|
|
|
"MUR",
|
|
|
|
"MVR",
|
|
|
|
"MWK",
|
|
|
|
"MXN",
|
|
|
|
"MXV",
|
|
|
|
"MYR",
|
|
|
|
"MZM",
|
|
|
|
"MZN",
|
|
|
|
"NAD",
|
|
|
|
"NGN",
|
|
|
|
"NIO",
|
|
|
|
"NLG",
|
|
|
|
"NOK",
|
|
|
|
"NPR",
|
|
|
|
"NZD",
|
|
|
|
"OMR",
|
|
|
|
"PAB",
|
|
|
|
"PEI",
|
|
|
|
"PEN",
|
|
|
|
"PES",
|
|
|
|
"PGK",
|
|
|
|
"PHP",
|
|
|
|
"PKR",
|
|
|
|
"PLN",
|
|
|
|
"PLZ",
|
|
|
|
"PTE",
|
|
|
|
"PYG",
|
|
|
|
"QAR",
|
|
|
|
"ROL",
|
|
|
|
"RON",
|
|
|
|
"RSD",
|
|
|
|
"RUB",
|
|
|
|
"RUR",
|
|
|
|
"RWF",
|
|
|
|
"SAR",
|
|
|
|
"SBD",
|
|
|
|
"SCR",
|
|
|
|
"SDD",
|
|
|
|
"SDG",
|
|
|
|
"SEK",
|
|
|
|
"SGD",
|
|
|
|
"SHP",
|
|
|
|
"SIT",
|
|
|
|
"SKK",
|
|
|
|
"SLL",
|
|
|
|
"SOS",
|
|
|
|
"SRD",
|
|
|
|
"SRG",
|
|
|
|
"SSP",
|
|
|
|
"STD",
|
|
|
|
"SVC",
|
|
|
|
"SYP",
|
|
|
|
"SZL",
|
|
|
|
"THB",
|
|
|
|
"TJR",
|
|
|
|
"TJS",
|
|
|
|
"TMM",
|
|
|
|
"TMT",
|
|
|
|
"TND",
|
|
|
|
"TOP",
|
|
|
|
"TPE",
|
|
|
|
"TRL",
|
|
|
|
"TRY",
|
|
|
|
"TTD",
|
|
|
|
"TWD",
|
|
|
|
"TZS",
|
|
|
|
"UAH",
|
|
|
|
"UAK",
|
|
|
|
"UGX",
|
|
|
|
"USD",
|
|
|
|
"USN",
|
|
|
|
"USS",
|
|
|
|
"UYI",
|
|
|
|
"UYU",
|
|
|
|
"UZS",
|
|
|
|
"VEB",
|
|
|
|
"VEF",
|
|
|
|
"VND",
|
|
|
|
"VUV",
|
|
|
|
"WST",
|
|
|
|
"XAF",
|
|
|
|
"XAG",
|
|
|
|
"XAU",
|
|
|
|
"XBA",
|
|
|
|
"XBB",
|
|
|
|
"XBC",
|
|
|
|
"XBD",
|
|
|
|
"XCD",
|
|
|
|
"XDR",
|
|
|
|
"XEU",
|
|
|
|
"XOF",
|
|
|
|
"XPD",
|
|
|
|
"XPF",
|
|
|
|
"XPT",
|
|
|
|
"XSU",
|
|
|
|
"XTS",
|
|
|
|
"XUA",
|
|
|
|
"XXX",
|
|
|
|
"YDD",
|
|
|
|
"YER",
|
|
|
|
"YUM",
|
|
|
|
"YUN",
|
|
|
|
"ZAL",
|
|
|
|
"ZAR",
|
|
|
|
"ZMK",
|
|
|
|
"ZMW",
|
|
|
|
"ZRN",
|
|
|
|
"ZRZ",
|
|
|
|
"ZWD",
|
|
|
|
"ZWL",
|
|
|
|
"ZWN",
|
|
|
|
"ZWR",
|
2014-09-03 21:08:45 +00:00
|
|
|
"bit",
|
2014-09-02 23:18:20 +00:00
|
|
|
"byte",
|
|
|
|
"gigabit",
|
|
|
|
"gigabyte",
|
|
|
|
"kilobit",
|
|
|
|
"kilobyte",
|
|
|
|
"megabit",
|
|
|
|
"megabyte",
|
|
|
|
"terabit",
|
|
|
|
"terabyte",
|
2015-06-28 03:26:33 +00:00
|
|
|
"century",
|
2014-09-03 21:08:45 +00:00
|
|
|
"day",
|
2014-02-04 00:29:17 +00:00
|
|
|
"hour",
|
2014-09-02 23:18:20 +00:00
|
|
|
"microsecond",
|
2014-02-04 00:29:17 +00:00
|
|
|
"millisecond",
|
|
|
|
"minute",
|
|
|
|
"month",
|
2014-09-02 23:18:20 +00:00
|
|
|
"nanosecond",
|
2014-02-04 00:29:17 +00:00
|
|
|
"second",
|
|
|
|
"week",
|
|
|
|
"year",
|
2014-09-03 21:08:45 +00:00
|
|
|
"ampere",
|
2014-09-02 23:18:20 +00:00
|
|
|
"milliampere",
|
|
|
|
"ohm",
|
|
|
|
"volt",
|
2014-09-03 21:08:45 +00:00
|
|
|
"calorie",
|
2014-09-02 23:18:20 +00:00
|
|
|
"foodcalorie",
|
|
|
|
"joule",
|
|
|
|
"kilocalorie",
|
|
|
|
"kilojoule",
|
|
|
|
"kilowatt-hour",
|
2014-09-03 21:08:45 +00:00
|
|
|
"gigahertz",
|
2014-09-02 23:18:20 +00:00
|
|
|
"hertz",
|
|
|
|
"kilohertz",
|
|
|
|
"megahertz",
|
2014-09-03 21:08:45 +00:00
|
|
|
"astronomical-unit",
|
2014-02-04 00:29:17 +00:00
|
|
|
"centimeter",
|
2014-09-02 23:18:20 +00:00
|
|
|
"decimeter",
|
|
|
|
"fathom",
|
2014-02-04 00:29:17 +00:00
|
|
|
"foot",
|
2014-09-02 23:18:20 +00:00
|
|
|
"furlong",
|
2014-02-04 00:29:17 +00:00
|
|
|
"inch",
|
|
|
|
"kilometer",
|
|
|
|
"light-year",
|
|
|
|
"meter",
|
2014-09-02 23:18:20 +00:00
|
|
|
"micrometer",
|
2014-02-04 00:29:17 +00:00
|
|
|
"mile",
|
2015-06-28 03:26:33 +00:00
|
|
|
"mile-scandinavian",
|
2014-02-04 00:29:17 +00:00
|
|
|
"millimeter",
|
2014-09-02 23:18:20 +00:00
|
|
|
"nanometer",
|
|
|
|
"nautical-mile",
|
|
|
|
"parsec",
|
2014-02-04 00:29:17 +00:00
|
|
|
"picometer",
|
2017-01-24 08:22:23 +00:00
|
|
|
"point",
|
2014-02-04 00:29:17 +00:00
|
|
|
"yard",
|
2014-09-03 21:08:45 +00:00
|
|
|
"lux",
|
|
|
|
"carat",
|
2014-02-04 00:29:17 +00:00
|
|
|
"gram",
|
|
|
|
"kilogram",
|
2014-09-02 23:18:20 +00:00
|
|
|
"metric-ton",
|
|
|
|
"microgram",
|
|
|
|
"milligram",
|
2014-02-04 00:29:17 +00:00
|
|
|
"ounce",
|
2014-09-02 23:18:20 +00:00
|
|
|
"ounce-troy",
|
2014-02-04 00:29:17 +00:00
|
|
|
"pound",
|
2014-09-02 23:18:20 +00:00
|
|
|
"stone",
|
|
|
|
"ton",
|
2017-09-10 02:02:02 +00:00
|
|
|
"base",
|
|
|
|
"percent",
|
|
|
|
"permille",
|
2014-09-03 21:08:45 +00:00
|
|
|
"gigawatt",
|
2014-02-04 00:29:17 +00:00
|
|
|
"horsepower",
|
|
|
|
"kilowatt",
|
2014-09-02 23:18:20 +00:00
|
|
|
"megawatt",
|
|
|
|
"milliwatt",
|
2014-02-04 00:29:17 +00:00
|
|
|
"watt",
|
2014-09-03 21:08:45 +00:00
|
|
|
"hectopascal",
|
2014-02-04 00:29:17 +00:00
|
|
|
"inch-hg",
|
|
|
|
"millibar",
|
2014-09-02 23:18:20 +00:00
|
|
|
"millimeter-of-mercury",
|
|
|
|
"pound-per-square-inch",
|
2014-09-03 21:08:45 +00:00
|
|
|
"kilometer-per-hour",
|
2015-06-28 03:26:33 +00:00
|
|
|
"knot",
|
2014-02-04 00:29:17 +00:00
|
|
|
"meter-per-second",
|
|
|
|
"mile-per-hour",
|
2014-09-03 21:08:45 +00:00
|
|
|
"celsius",
|
2014-02-04 00:29:17 +00:00
|
|
|
"fahrenheit",
|
2015-06-28 03:26:33 +00:00
|
|
|
"generic",
|
2014-09-02 23:18:20 +00:00
|
|
|
"kelvin",
|
2014-09-03 21:08:45 +00:00
|
|
|
"acre-foot",
|
2014-09-02 23:18:20 +00:00
|
|
|
"bushel",
|
|
|
|
"centiliter",
|
|
|
|
"cubic-centimeter",
|
|
|
|
"cubic-foot",
|
|
|
|
"cubic-inch",
|
2014-02-04 00:29:17 +00:00
|
|
|
"cubic-kilometer",
|
2014-09-02 23:18:20 +00:00
|
|
|
"cubic-meter",
|
2014-02-04 00:29:17 +00:00
|
|
|
"cubic-mile",
|
2014-09-02 23:18:20 +00:00
|
|
|
"cubic-yard",
|
|
|
|
"cup",
|
2015-06-28 03:26:33 +00:00
|
|
|
"cup-metric",
|
2014-09-02 23:18:20 +00:00
|
|
|
"deciliter",
|
|
|
|
"fluid-ounce",
|
|
|
|
"gallon",
|
2016-02-02 00:38:16 +00:00
|
|
|
"gallon-imperial",
|
2014-09-02 23:18:20 +00:00
|
|
|
"hectoliter",
|
|
|
|
"liter",
|
|
|
|
"megaliter",
|
|
|
|
"milliliter",
|
|
|
|
"pint",
|
2015-06-28 03:26:33 +00:00
|
|
|
"pint-metric",
|
2014-09-02 23:18:20 +00:00
|
|
|
"quart",
|
|
|
|
"tablespoon",
|
|
|
|
"teaspoon"
|
2014-02-04 00:29:17 +00:00
|
|
|
};
|
|
|
|
|
2014-12-05 20:52:28 +00:00
|
|
|
// Must be sorted by first value and then second value.
|
|
|
|
static int32_t unitPerUnitToSingleUnit[][4] = {
|
2017-09-10 02:02:02 +00:00
|
|
|
{327, 297, 17, 0},
|
|
|
|
{329, 303, 17, 2},
|
|
|
|
{331, 297, 17, 3},
|
|
|
|
{331, 388, 4, 2},
|
|
|
|
{331, 389, 4, 3},
|
|
|
|
{346, 386, 3, 1},
|
|
|
|
{349, 11, 16, 4},
|
|
|
|
{391, 327, 4, 1}
|
2014-12-05 20:52:28 +00:00
|
|
|
};
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createGForce(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(0, 0, status);
|
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMeterPerSecondSquared(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(0, 1, status);
|
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createArcMinute(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(1, 0, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createArcSecond(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(1, 1, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createDegree(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(1, 2, status);
|
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createRadian(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(1, 3, status);
|
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2015-09-23 18:32:26 +00:00
|
|
|
MeasureUnit *MeasureUnit::createRevolutionAngle(UErrorCode &status) {
|
2015-06-28 03:26:33 +00:00
|
|
|
return MeasureUnit::create(1, 4, status);
|
|
|
|
}
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createAcre(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(2, 0, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createHectare(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(2, 1, status);
|
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createSquareCentimeter(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(2, 2, status);
|
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createSquareFoot(UErrorCode &status) {
|
2014-09-02 23:18:20 +00:00
|
|
|
return MeasureUnit::create(2, 3, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createSquareInch(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(2, 4, status);
|
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createSquareKilometer(UErrorCode &status) {
|
2014-09-02 23:18:20 +00:00
|
|
|
return MeasureUnit::create(2, 5, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createSquareMeter(UErrorCode &status) {
|
2014-09-02 23:18:20 +00:00
|
|
|
return MeasureUnit::create(2, 6, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createSquareMile(UErrorCode &status) {
|
2014-09-02 23:18:20 +00:00
|
|
|
return MeasureUnit::create(2, 7, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
2014-09-03 21:08:45 +00:00
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createSquareYard(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(2, 8, status);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createKarat(UErrorCode &status) {
|
2014-09-03 21:08:45 +00:00
|
|
|
return MeasureUnit::create(3, 0, status);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMilligramPerDeciliter(UErrorCode &status) {
|
2014-09-03 21:08:45 +00:00
|
|
|
return MeasureUnit::create(3, 1, status);
|
|
|
|
}
|
2014-02-04 00:29:17 +00:00
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMillimolePerLiter(UErrorCode &status) {
|
2015-06-28 03:26:33 +00:00
|
|
|
return MeasureUnit::create(3, 2, status);
|
|
|
|
}
|
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createPartPerMillion(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(3, 3, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createLiterPer100Kilometers(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(4, 0, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createLiterPerKilometer(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(4, 1, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createMilePerGallon(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(4, 2, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createMilePerGallonImperial(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(4, 3, status);
|
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createBit(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(6, 0, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createByte(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(6, 1, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createGigabit(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(6, 2, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createGigabyte(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(6, 3, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createKilobit(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(6, 4, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createKilobyte(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(6, 5, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createMegabit(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(6, 6, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMegabyte(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(6, 7, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createTerabit(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(6, 8, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createTerabyte(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(6, 9, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createCentury(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 0, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createDay(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 1, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createHour(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 2, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMicrosecond(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 3, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMillisecond(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 4, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMinute(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 5, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMonth(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 6, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createNanosecond(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 7, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createSecond(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 8, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createWeek(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 9, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
2014-09-03 21:08:45 +00:00
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createYear(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(7, 10, status);
|
2015-06-28 03:26:33 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createAmpere(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(8, 0, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createMilliampere(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(8, 1, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createOhm(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(8, 2, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createVolt(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(8, 3, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-02-04 00:29:17 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createCalorie(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(9, 0, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createFoodcalorie(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(9, 1, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createJoule(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(9, 2, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createKilocalorie(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(9, 3, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createKilojoule(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(9, 4, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createKilowattHour(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(9, 5, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createGigahertz(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(10, 0, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createHertz(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(10, 1, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createKilohertz(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(10, 2, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createMegahertz(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(10, 3, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createAstronomicalUnit(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 0, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createCentimeter(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 1, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createDecimeter(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 2, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createFathom(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 3, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createFoot(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 4, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createFurlong(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 5, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createInch(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 6, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createKilometer(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 7, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createLightYear(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 8, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createMeter(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 9, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMicrometer(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 10, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMile(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 11, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMileScandinavian(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 12, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
2014-09-03 21:08:45 +00:00
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMillimeter(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 13, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createNanometer(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 14, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-02-04 00:29:17 +00:00
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createNauticalMile(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 15, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createParsec(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 16, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createPicometer(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 17, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2017-01-24 08:22:23 +00:00
|
|
|
MeasureUnit *MeasureUnit::createPoint(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(11, 18, status);
|
2015-06-28 03:26:33 +00:00
|
|
|
}
|
|
|
|
|
2017-01-24 08:22:23 +00:00
|
|
|
MeasureUnit *MeasureUnit::createYard(UErrorCode &status) {
|
|
|
|
return MeasureUnit::create(11, 19, status);
|
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createLux(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(12, 0, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createCarat(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 0, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createGram(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 1, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createKilogram(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 2, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
2014-09-03 21:08:45 +00:00
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createMetricTon(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 3, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-02-04 00:29:17 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMicrogram(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 4, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createMilligram(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 5, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createOunce(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 6, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createOunceTroy(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 7, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createPound(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 8, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createStone(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 9, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createTon(UErrorCode &status) {
|
2017-01-23 16:20:59 +00:00
|
|
|
return MeasureUnit::create(13, 10, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createGigawatt(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(15, 0, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createHorsepower(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(15, 1, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createKilowatt(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(15, 2, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMegawatt(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(15, 3, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createMilliwatt(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(15, 4, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createWatt(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(15, 5, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createHectopascal(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(16, 0, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createInchHg(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(16, 1, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createMillibar(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(16, 2, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMillimeterOfMercury(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(16, 3, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createPoundPerSquareInch(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(16, 4, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createKilometerPerHour(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(17, 0, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createKnot(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(17, 1, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMeterPerSecond(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(17, 2, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMilePerHour(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(17, 3, status);
|
2015-06-28 03:26:33 +00:00
|
|
|
}
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createCelsius(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(18, 0, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createFahrenheit(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(18, 1, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
2014-09-03 21:08:45 +00:00
|
|
|
|
2015-09-23 18:32:26 +00:00
|
|
|
MeasureUnit *MeasureUnit::createGenericTemperature(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(18, 2, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createKelvin(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(18, 3, status);
|
2015-06-28 03:26:33 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createAcreFoot(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 0, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-02-04 00:29:17 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createBushel(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 1, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createCentiliter(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 2, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createCubicCentimeter(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 3, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createCubicFoot(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 4, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createCubicInch(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 5, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createCubicKilometer(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 6, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2014-09-03 21:08:45 +00:00
|
|
|
MeasureUnit *MeasureUnit::createCubicMeter(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 7, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::createCubicMile(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 8, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
2014-09-03 21:08:45 +00:00
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createCubicYard(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 9, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit *MeasureUnit::createCup(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 10, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createCupMetric(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 11, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-02-04 00:29:17 +00:00
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createDeciliter(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 12, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createFluidOunce(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 13, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2015-06-28 03:26:33 +00:00
|
|
|
MeasureUnit *MeasureUnit::createGallon(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 14, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createGallonImperial(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 15, status);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
2014-09-03 21:08:45 +00:00
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createHectoliter(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 16, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createLiter(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 17, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-02-04 00:29:17 +00:00
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMegaliter(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 18, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createMilliliter(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 19, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createPint(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 20, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createPintMetric(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 21, status);
|
2014-09-03 21:08:45 +00:00
|
|
|
}
|
2014-09-02 23:18:20 +00:00
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createQuart(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 22, status);
|
2015-06-28 03:26:33 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createTablespoon(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 23, status);
|
2015-06-28 03:26:33 +00:00
|
|
|
}
|
|
|
|
|
2016-02-02 00:38:16 +00:00
|
|
|
MeasureUnit *MeasureUnit::createTeaspoon(UErrorCode &status) {
|
2017-09-10 02:02:02 +00:00
|
|
|
return MeasureUnit::create(19, 24, status);
|
2016-02-02 00:38:16 +00:00
|
|
|
}
|
|
|
|
|
2014-06-02 22:47:11 +00:00
|
|
|
// End generated code
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
static int32_t binarySearch(
|
|
|
|
const char * const * array, int32_t start, int32_t end, const char * key) {
|
|
|
|
while (start < end) {
|
|
|
|
int32_t mid = (start + end) / 2;
|
|
|
|
int32_t cmp = uprv_strcmp(array[mid], key);
|
|
|
|
if (cmp < 0) {
|
|
|
|
start = mid + 1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (cmp == 0) {
|
|
|
|
return mid;
|
|
|
|
}
|
|
|
|
end = mid;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
2017-09-12 05:20:50 +00:00
|
|
|
|
|
|
|
MeasureUnit::MeasureUnit() {
|
|
|
|
fCurrency[0] = 0;
|
|
|
|
initNoUnit("base");
|
|
|
|
}
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit::MeasureUnit(const MeasureUnit &other)
|
|
|
|
: fTypeId(other.fTypeId), fSubTypeId(other.fSubTypeId) {
|
|
|
|
uprv_strcpy(fCurrency, other.fCurrency);
|
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit &MeasureUnit::operator=(const MeasureUnit &other) {
|
|
|
|
if (this == &other) {
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
fTypeId = other.fTypeId;
|
|
|
|
fSubTypeId = other.fSubTypeId;
|
|
|
|
uprv_strcpy(fCurrency, other.fCurrency);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
UObject *MeasureUnit::clone() const {
|
|
|
|
return new MeasureUnit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
MeasureUnit::~MeasureUnit() {
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *MeasureUnit::getType() const {
|
|
|
|
return gTypes[fTypeId];
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *MeasureUnit::getSubtype() const {
|
|
|
|
return fCurrency[0] == 0 ? gSubTypes[getOffset()] : fCurrency;
|
|
|
|
}
|
|
|
|
|
|
|
|
UBool MeasureUnit::operator==(const UObject& other) const {
|
2014-03-11 17:40:23 +00:00
|
|
|
if (this == &other) { // Same object, equal
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
if (typeid(*this) != typeid(other)) { // Different types, not equal
|
2014-02-04 00:29:17 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2014-03-11 17:40:23 +00:00
|
|
|
const MeasureUnit &rhs = static_cast<const MeasureUnit&>(other);
|
2014-02-04 00:29:17 +00:00
|
|
|
return (
|
2014-03-11 17:40:23 +00:00
|
|
|
fTypeId == rhs.fTypeId
|
|
|
|
&& fSubTypeId == rhs.fSubTypeId
|
|
|
|
&& uprv_strcmp(fCurrency, rhs.fCurrency) == 0);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int32_t MeasureUnit::getIndex() const {
|
|
|
|
return gIndexes[fTypeId] + fSubTypeId;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t MeasureUnit::getAvailable(
|
|
|
|
MeasureUnit *dest,
|
|
|
|
int32_t destCapacity,
|
|
|
|
UErrorCode &errorCode) {
|
|
|
|
if (U_FAILURE(errorCode)) {
|
|
|
|
return 0;
|
|
|
|
}
|
2014-08-28 22:13:45 +00:00
|
|
|
if (destCapacity < UPRV_LENGTHOF(gSubTypes)) {
|
2014-02-04 00:29:17 +00:00
|
|
|
errorCode = U_BUFFER_OVERFLOW_ERROR;
|
2014-08-28 22:13:45 +00:00
|
|
|
return UPRV_LENGTHOF(gSubTypes);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
int32_t idx = 0;
|
2014-08-28 22:13:45 +00:00
|
|
|
for (int32_t typeIdx = 0; typeIdx < UPRV_LENGTHOF(gTypes); ++typeIdx) {
|
2014-02-04 00:29:17 +00:00
|
|
|
int32_t len = gOffsets[typeIdx + 1] - gOffsets[typeIdx];
|
|
|
|
for (int32_t subTypeIdx = 0; subTypeIdx < len; ++subTypeIdx) {
|
|
|
|
dest[idx].setTo(typeIdx, subTypeIdx);
|
|
|
|
++idx;
|
|
|
|
}
|
|
|
|
}
|
2014-08-28 22:13:45 +00:00
|
|
|
U_ASSERT(idx == UPRV_LENGTHOF(gSubTypes));
|
|
|
|
return UPRV_LENGTHOF(gSubTypes);
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int32_t MeasureUnit::getAvailable(
|
|
|
|
const char *type,
|
|
|
|
MeasureUnit *dest,
|
|
|
|
int32_t destCapacity,
|
|
|
|
UErrorCode &errorCode) {
|
|
|
|
if (U_FAILURE(errorCode)) {
|
|
|
|
return 0;
|
|
|
|
}
|
2014-08-28 22:13:45 +00:00
|
|
|
int32_t typeIdx = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), type);
|
2014-02-04 00:29:17 +00:00
|
|
|
if (typeIdx == -1) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int32_t len = gOffsets[typeIdx + 1] - gOffsets[typeIdx];
|
|
|
|
if (destCapacity < len) {
|
|
|
|
errorCode = U_BUFFER_OVERFLOW_ERROR;
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
for (int subTypeIdx = 0; subTypeIdx < len; ++subTypeIdx) {
|
|
|
|
dest[subTypeIdx].setTo(typeIdx, subTypeIdx);
|
|
|
|
}
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
StringEnumeration* MeasureUnit::getAvailableTypes(UErrorCode &errorCode) {
|
|
|
|
UEnumeration *uenum = uenum_openCharStringsEnumeration(
|
2014-08-28 22:13:45 +00:00
|
|
|
gTypes, UPRV_LENGTHOF(gTypes), &errorCode);
|
2014-02-04 00:29:17 +00:00
|
|
|
if (U_FAILURE(errorCode)) {
|
|
|
|
uenum_close(uenum);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
StringEnumeration *result = new UStringEnumeration(uenum);
|
|
|
|
if (result == NULL) {
|
|
|
|
errorCode = U_MEMORY_ALLOCATION_ERROR;
|
|
|
|
uenum_close(uenum);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t MeasureUnit::getIndexCount() {
|
2014-08-28 22:13:45 +00:00
|
|
|
return gIndexes[UPRV_LENGTHOF(gIndexes) - 1];
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
|
2015-11-14 00:31:21 +00:00
|
|
|
int32_t MeasureUnit::internalGetIndexForTypeAndSubtype(const char *type, const char *subtype) {
|
|
|
|
int32_t t = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), type);
|
|
|
|
if (t < 0) {
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
int32_t st = binarySearch(gSubTypes, gOffsets[t], gOffsets[t + 1], subtype);
|
|
|
|
if (st < 0) {
|
|
|
|
return st;
|
|
|
|
}
|
|
|
|
return gIndexes[t] + st - gOffsets[t];
|
|
|
|
}
|
|
|
|
|
2014-12-05 20:52:28 +00:00
|
|
|
MeasureUnit *MeasureUnit::resolveUnitPerUnit(
|
|
|
|
const MeasureUnit &unit, const MeasureUnit &perUnit) {
|
|
|
|
int32_t unitOffset = unit.getOffset();
|
|
|
|
int32_t perUnitOffset = perUnit.getOffset();
|
|
|
|
|
|
|
|
// binary search for (unitOffset, perUnitOffset)
|
|
|
|
int32_t start = 0;
|
|
|
|
int32_t end = UPRV_LENGTHOF(unitPerUnitToSingleUnit);
|
|
|
|
while (start < end) {
|
|
|
|
int32_t mid = (start + end) / 2;
|
|
|
|
int32_t *midRow = unitPerUnitToSingleUnit[mid];
|
|
|
|
if (unitOffset < midRow[0]) {
|
|
|
|
end = mid;
|
|
|
|
} else if (unitOffset > midRow[0]) {
|
|
|
|
start = mid + 1;
|
|
|
|
} else if (perUnitOffset < midRow[1]) {
|
|
|
|
end = mid;
|
|
|
|
} else if (perUnitOffset > midRow[1]) {
|
|
|
|
start = mid + 1;
|
|
|
|
} else {
|
|
|
|
// We found a resolution for our unit / per-unit combo
|
|
|
|
// return it.
|
|
|
|
return new MeasureUnit(midRow[2], midRow[3]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
MeasureUnit *MeasureUnit::create(int typeId, int subTypeId, UErrorCode &status) {
|
|
|
|
if (U_FAILURE(status)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
MeasureUnit *result = new MeasureUnit(typeId, subTypeId);
|
|
|
|
if (result == NULL) {
|
|
|
|
status = U_MEMORY_ALLOCATION_ERROR;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MeasureUnit::initTime(const char *timeId) {
|
2014-08-28 22:13:45 +00:00
|
|
|
int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "duration");
|
2014-02-04 00:29:17 +00:00
|
|
|
U_ASSERT(result != -1);
|
|
|
|
fTypeId = result;
|
|
|
|
result = binarySearch(gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], timeId);
|
|
|
|
U_ASSERT(result != -1);
|
|
|
|
fSubTypeId = result - gOffsets[fTypeId];
|
|
|
|
}
|
|
|
|
|
|
|
|
void MeasureUnit::initCurrency(const char *isoCurrency) {
|
2014-08-28 22:13:45 +00:00
|
|
|
int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "currency");
|
2014-02-04 00:29:17 +00:00
|
|
|
U_ASSERT(result != -1);
|
|
|
|
fTypeId = result;
|
|
|
|
result = binarySearch(
|
|
|
|
gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], isoCurrency);
|
|
|
|
if (result != -1) {
|
|
|
|
fSubTypeId = result - gOffsets[fTypeId];
|
|
|
|
} else {
|
2014-08-28 22:13:45 +00:00
|
|
|
uprv_strncpy(fCurrency, isoCurrency, UPRV_LENGTHOF(fCurrency));
|
2015-11-19 18:58:42 +00:00
|
|
|
fCurrency[3] = 0;
|
2014-02-04 00:29:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-10 02:02:02 +00:00
|
|
|
void MeasureUnit::initNoUnit(const char *subtype) {
|
|
|
|
int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "none");
|
|
|
|
U_ASSERT(result != -1);
|
|
|
|
fTypeId = result;
|
|
|
|
result = binarySearch(gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], subtype);
|
|
|
|
U_ASSERT(result != -1);
|
|
|
|
fSubTypeId = result - gOffsets[fTypeId];
|
|
|
|
}
|
|
|
|
|
2014-02-04 00:29:17 +00:00
|
|
|
void MeasureUnit::setTo(int32_t typeId, int32_t subTypeId) {
|
|
|
|
fTypeId = typeId;
|
|
|
|
fSubTypeId = subTypeId;
|
|
|
|
fCurrency[0] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t MeasureUnit::getOffset() const {
|
|
|
|
return gOffsets[fTypeId] + fSubTypeId;
|
|
|
|
}
|
|
|
|
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
2014-03-11 17:40:23 +00:00
|
|
|
#endif /* !UNCONFIG_NO_FORMATTING */
|