+// -------------------------------------
+// Default implementation sets unsupported error; subclasses should
+// override.
+
+UnicodeString&
+NumberFormat::format(double /* unused number */,
+ UnicodeString& toAppendTo,
+ FieldPositionIterator* /* unused posIter */,
+ UErrorCode& status) const
+{
+ if (!U_FAILURE(status)) {
+ status = U_UNSUPPORTED_ERROR;
+ }
+ return toAppendTo;
+}
+
+// -------------------------------------
+// Default implementation sets unsupported error; subclasses should
+// override.
+
+UnicodeString&
+NumberFormat::format(int32_t /* unused number */,
+ UnicodeString& toAppendTo,
+ FieldPositionIterator* /* unused posIter */,
+ UErrorCode& status) const
+{
+ if (!U_FAILURE(status)) {
+ status = U_UNSUPPORTED_ERROR;
+ }
+ return toAppendTo;
+}
+
+// -------------------------------------
+// Default implementation sets unsupported error; subclasses should
+// override.
+
+UnicodeString&
+NumberFormat::format(int64_t /* unused number */,
+ UnicodeString& toAppendTo,
+ FieldPositionIterator* /* unused posIter */,
+ UErrorCode& status) const
+{
+ if (!U_FAILURE(status)) {
+ status = U_UNSUPPORTED_ERROR;
+ }
+ return toAppendTo;
+}
+
+// ------------------------------------------
+// These functions add the status code, just fall back to the non-status versions
+UnicodeString&
+NumberFormat::format(double number,
+ UnicodeString& appendTo,
+ FieldPosition& pos,
+ UErrorCode &status) const {
+ if(U_SUCCESS(status)) {
+ return format(number,appendTo,pos);
+ } else {
+ return appendTo;
+ }
+}
+
+UnicodeString&
+NumberFormat::format(int32_t number,
+ UnicodeString& appendTo,
+ FieldPosition& pos,
+ UErrorCode &status) const {
+ if(U_SUCCESS(status)) {
+ return format(number,appendTo,pos);
+ } else {
+ return appendTo;
+ }
+}
+
+UnicodeString&
+NumberFormat::format(int64_t number,
+ UnicodeString& appendTo,
+ FieldPosition& pos,
+ UErrorCode &status) const {
+ if(U_SUCCESS(status)) {
+ return format(number,appendTo,pos);
+ } else {
+ return appendTo;
+ }
+}
+
+
+
+// -------------------------------------
+// Decimal Number format() default implementation
+// Subclasses do not normally override this function, but rather the DigitList
+// formatting functions..
+// The expected call chain from here is
+// this function ->
+// NumberFormat::format(Formattable ->
+// DecimalFormat::format(DigitList
+//
+// Or, for subclasses of Formattable that do not know about DigitList,
+// this Function ->
+// NumberFormat::format(Formattable ->
+// NumberFormat::format(DigitList ->
+// XXXFormat::format(double
+
+UnicodeString&
+NumberFormat::format(const StringPiece &decimalNum,
+ UnicodeString& toAppendTo,
+ FieldPositionIterator* fpi,
+ UErrorCode& status) const
+{
+ Formattable f;
+ f.setDecimalNumber(decimalNum, status);
+ format(f, toAppendTo, fpi, status);
+ return toAppendTo;
+}
+
+/**
+ *