ICU-21215 Add default constructor to FormattedNumberRange

This commit is contained in:
Shane F. Carr 2021-08-20 15:04:37 -05:00
parent 8cd025bb9c
commit c12c5b5a4c
2 changed files with 12 additions and 0 deletions

View file

@ -641,6 +641,15 @@ class U_I18N_API FormattedNumberRange : public UMemory, public FormattedValue {
*/
UNumberRangeIdentityResult getIdentityResult(UErrorCode& status) const;
#ifndef U_HIDE_DRAFT_API
/**
* Default constructor; makes an empty FormattedNumberRange.
* @draft ICU 70
*/
FormattedNumberRange()
: fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {}
#endif
/**
* Copying not supported; use move constructor instead.
*/

View file

@ -827,6 +827,9 @@ void NumberRangeFormatterTest::testCopyMove() {
assertEquals("FormattedNumberRange move constructor", u"1,005,00 $US", result.toString(status));
result = l1.formatFormattableRange(3, 6, status);
assertEquals("FormattedNumberRange move assignment", u"3,006,00 $US", result.toString(status));
FormattedNumberRange fnrdefault;
fnrdefault.toString(status);
status.expectErrorAndReset(U_INVALID_STATE_ERROR);
}
void NumberRangeFormatterTest::toObject() {