+CurrencyUnit::CurrencyUnit(const CurrencyUnit& other) : MeasureUnit(other) {
+ u_strcpy(isoCode, other.isoCode);
+}
+
+CurrencyUnit::CurrencyUnit(const MeasureUnit& other, UErrorCode& ec) : MeasureUnit(other) {
+ // Make sure this is a currency.
+ // OK to hard-code the string because we are comparing against another hard-coded string.
+ if (uprv_strcmp("currency", getType()) != 0) {
+ ec = U_ILLEGAL_ARGUMENT_ERROR;
+ isoCode[0] = 0;
+ } else {
+ // Get the ISO Code from the subtype field.
+ u_charsToUChars(getSubtype(), isoCode, 4);
+ isoCode[3] = 0; // make 100% sure it is NUL-terminated
+ }
+}
+
+CurrencyUnit::CurrencyUnit() : MeasureUnit() {
+ u_strcpy(isoCode, kDefaultCurrency);
+ char simpleIsoCode[4];
+ u_UCharsToChars(isoCode, simpleIsoCode, 4);
+ initCurrency(simpleIsoCode);