We're updating the issue view to help you get more done. 

Need subclass overloads of format()

Description

Some of the useful overloads of the format() method in the Format hierarchy are
hidden in the subclasses due to C++'s visibility rules.

For example, in DateFormat we have the method:

UnicodeString& format(UDate date, UnicodeString& result) const;

Now consider the code:

UErrorCode status = U_ZERO_ERROR;
SimpleDateFormat fmt("MM/dd/yy", Locale::US, status);
// YUCK!: Look what we have to do to get to DF::format(UDate, US&)!
((DateFormat*)&fmt)->format(someUDate, someUnicodeString);

Clients should be able to just say:

fmt.format(someUDate, someUnicodeString);

To fix this, add the following to the SimpleDateFormat header:

inline UnicodeString& format(UDate date, UnicodeString& result) const {
return DateFormat::format(date, result);
}

This bug applies to other Format subclasses and may apply to other obscured
overloads in the Format framework.

Status

Assignee

TracBot

Reporter

TracBot

Labels

Reviewer

None

Time Needed

None

Start date

None

Components

Priority

assess