LEFT | RIGHT |
(no file at all) | |
1 // © 2016 and later: Unicode, Inc. and others. | 1 // © 2016 and later: Unicode, Inc. and others. |
2 // License & terms of use: http://www.unicode.org/copyright.html | 2 // License & terms of use: http://www.unicode.org/copyright.html |
3 /* | 3 /* |
4 ********************************************************************** | 4 ********************************************************************** |
5 * Copyright (c) 2004-2016, International Business Machines | 5 * Copyright (c) 2004-2016, International Business Machines |
6 * Corporation and others. All Rights Reserved. | 6 * Corporation and others. All Rights Reserved. |
7 ********************************************************************** | 7 ********************************************************************** |
8 * Author: Alan Liu | 8 * Author: Alan Liu |
9 * Created: April 20, 2004 | 9 * Created: April 20, 2004 |
10 * Since: ICU 3.0 | 10 * Since: ICU 3.0 |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 | 757 |
758 UnicodeString &MeasureFormat::formatMeasurePerUnit( | 758 UnicodeString &MeasureFormat::formatMeasurePerUnit( |
759 const Measure &measure, | 759 const Measure &measure, |
760 const MeasureUnit &perUnit, | 760 const MeasureUnit &perUnit, |
761 UnicodeString &appendTo, | 761 UnicodeString &appendTo, |
762 FieldPosition &pos, | 762 FieldPosition &pos, |
763 UErrorCode &status) const { | 763 UErrorCode &status) const { |
764 if (U_FAILURE(status)) { | 764 if (U_FAILURE(status)) { |
765 return appendTo; | 765 return appendTo; |
766 } | 766 } |
767 MeasureUnit *resolvedUnit = | 767 bool isResolved = false; |
768 MeasureUnit::resolveUnitPerUnit(measure.getUnit(), perUnit); | 768 MeasureUnit resolvedUnit = |
769 if (resolvedUnit != NULL) { | 769 MeasureUnit::resolveUnitPerUnit(measure.getUnit(), perUnit, &isResolved)
; |
770 Measure newMeasure(measure.getNumber(), resolvedUnit, status); | 770 if (isResolved) { |
| 771 Measure newMeasure(measure.getNumber(), new MeasureUnit(resolvedUnit), s
tatus); |
771 return formatMeasure( | 772 return formatMeasure( |
772 newMeasure, **numberFormat, appendTo, pos, status); | 773 newMeasure, **numberFormat, appendTo, pos, status); |
773 } | 774 } |
774 FieldPosition fpos(pos.getField()); | 775 FieldPosition fpos(pos.getField()); |
775 UnicodeString result; | 776 UnicodeString result; |
776 int32_t offset = withPerUnitAndAppend( | 777 int32_t offset = withPerUnitAndAppend( |
777 formatMeasure( | 778 formatMeasure( |
778 measure, **numberFormat, result, fpos, status), | 779 measure, **numberFormat, result, fpos, status), |
779 perUnit, | 780 perUnit, |
780 appendTo, | 781 appendTo, |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 MeasureFormat* U_EXPORT2 MeasureFormat::createCurrencyFormat(UErrorCode& ec) { | 1267 MeasureFormat* U_EXPORT2 MeasureFormat::createCurrencyFormat(UErrorCode& ec) { |
1267 if (U_FAILURE(ec)) { | 1268 if (U_FAILURE(ec)) { |
1268 return NULL; | 1269 return NULL; |
1269 } | 1270 } |
1270 return MeasureFormat::createCurrencyFormat(Locale::getDefault(), ec); | 1271 return MeasureFormat::createCurrencyFormat(Locale::getDefault(), ec); |
1271 } | 1272 } |
1272 | 1273 |
1273 U_NAMESPACE_END | 1274 U_NAMESPACE_END |
1274 | 1275 |
1275 #endif /* #if !UCONFIG_NO_FORMATTING */ | 1276 #endif /* #if !UCONFIG_NO_FORMATTING */ |
LEFT | RIGHT |