ICU-12061 FieldPosition::DONT_CARE API status and doc update. Fix incorrect usage of FieldPosition(0).
X-SVN-Rev: 39017
This commit is contained in:
parent
306234755f
commit
549c7646bf
@ -319,7 +319,7 @@ DateFormat::format(UDate date, UnicodeString& appendTo) const
|
||||
{
|
||||
// Note that any error information is just lost. That's okay
|
||||
// for this convenience method.
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
return format(date, appendTo, fpos);
|
||||
}
|
||||
|
||||
|
@ -685,7 +685,7 @@ NumberFormat::parseObject(const UnicodeString& source,
|
||||
UnicodeString&
|
||||
NumberFormat::format(double number, UnicodeString& appendTo) const
|
||||
{
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
return format(number, appendTo, pos);
|
||||
}
|
||||
|
||||
@ -695,7 +695,7 @@ NumberFormat::format(double number, UnicodeString& appendTo) const
|
||||
UnicodeString&
|
||||
NumberFormat::format(int32_t number, UnicodeString& appendTo) const
|
||||
{
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
return format(number, appendTo, pos);
|
||||
}
|
||||
|
||||
@ -705,7 +705,7 @@ NumberFormat::format(int32_t number, UnicodeString& appendTo) const
|
||||
UnicodeString&
|
||||
NumberFormat::format(int64_t number, UnicodeString& appendTo) const
|
||||
{
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
return format(number, appendTo, pos);
|
||||
}
|
||||
|
||||
|
@ -218,14 +218,14 @@ PluralFormat::format(const Formattable& obj,
|
||||
|
||||
UnicodeString
|
||||
PluralFormat::format(int32_t number, UErrorCode& status) const {
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
UnicodeString result;
|
||||
return format(Formattable(number), number, result, fpos, status);
|
||||
}
|
||||
|
||||
UnicodeString
|
||||
PluralFormat::format(double number, UErrorCode& status) const {
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
UnicodeString result;
|
||||
return format(Formattable(number), number, result, fpos, status);
|
||||
}
|
||||
|
@ -1570,7 +1570,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
|
||||
} else if (count == 2) {
|
||||
value /= 10;
|
||||
}
|
||||
FieldPosition p(0);
|
||||
FieldPosition p(FieldPosition::DONT_CARE);
|
||||
currentNumberFormat->format(value, appendTo, p);
|
||||
if (count > 3) {
|
||||
currentNumberFormat->setMinimumIntegerDigits(count - 3);
|
||||
@ -2057,7 +2057,7 @@ SimpleDateFormat::zeroPaddingNumber(
|
||||
int32_t value, int32_t minDigits, int32_t maxDigits) const
|
||||
{
|
||||
if (currentNumberFormat!=NULL) {
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
|
||||
currentNumberFormat->setMinimumIntegerDigits(minDigits);
|
||||
currentNumberFormat->setMaximumIntegerDigits(maxDigits);
|
||||
|
@ -471,7 +471,7 @@ umsg_vformat( const UMessageFormat *fmt,
|
||||
}
|
||||
}
|
||||
UnicodeString resultStr;
|
||||
FieldPosition fieldPosition(0);
|
||||
FieldPosition fieldPosition(FieldPosition::DONT_CARE);
|
||||
|
||||
/* format the message */
|
||||
((const MessageFormat*)fmt)->format(args,count,resultStr,fieldPosition,*status);
|
||||
|
@ -58,7 +58,7 @@ U_NAMESPACE_BEGIN
|
||||
* to perform partial formatting or to get information about the
|
||||
* formatted output (such as the position of a field).
|
||||
*
|
||||
* The FieldPosition class is not suitable for subclassing.
|
||||
* The FieldPosition class is not intended for public subclassing.
|
||||
*
|
||||
* <p>
|
||||
* Below is an example of using <code>FieldPosition</code> to aid
|
||||
@ -109,7 +109,8 @@ class U_I18N_API FieldPosition : public UObject {
|
||||
public:
|
||||
/**
|
||||
* DONT_CARE may be specified as the field to indicate that the
|
||||
* caller doesn't need to specify a field. Do not subclass.
|
||||
* caller doesn't need to specify a field.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
enum { DONT_CARE = -1 };
|
||||
|
||||
|
@ -653,7 +653,7 @@ class SimpleDateFormatMutableNFs;
|
||||
* = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz", success );
|
||||
* GregorianCalendar cal(success);
|
||||
* UDate currentTime_1 = cal.getTime(success);
|
||||
* FieldPosition fp(0);
|
||||
* FieldPosition fp(FieldPosition::DONT_CARE);
|
||||
* UnicodeString dateString;
|
||||
* formatter->format( currentTime_1, dateString, fp );
|
||||
* cout << "result: " << dateString << endl;
|
||||
|
@ -179,7 +179,7 @@ void IntlTestDecimalFormatAPI::testAPI(/*char *par*/)
|
||||
Formattable fL(l);
|
||||
|
||||
UnicodeString res1, res2, res3, res4;
|
||||
FieldPosition pos1(0), pos2(0), pos3(0), pos4(0);
|
||||
FieldPosition pos1(FieldPosition::DONT_CARE), pos2(FieldPosition::DONT_CARE), pos3(FieldPosition::DONT_CARE), pos4(FieldPosition::DONT_CARE);
|
||||
|
||||
res1 = def.format(d, res1, pos1);
|
||||
logln( (UnicodeString) "" + (int32_t) d + " formatted to " + res1);
|
||||
|
@ -164,7 +164,7 @@ if (fr != NULL && it != NULL && de != NULL)
|
||||
Formattable fD(d, Formattable::kIsDate);
|
||||
|
||||
UnicodeString res1, res2, res3;
|
||||
FieldPosition pos1(0), pos2(0);
|
||||
FieldPosition pos1(FieldPosition::DONT_CARE), pos2(FieldPosition::DONT_CARE);
|
||||
|
||||
status = U_ZERO_ERROR;
|
||||
res1 = fr->format(d, res1, pos1, status);
|
||||
|
@ -1074,7 +1074,7 @@ void DateFormatRegressionTest::Test4151706(void)
|
||||
errln("Fail: " + e);
|
||||
}*/
|
||||
UnicodeString temp;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
logln(dateString + " -> " + fmt.format(d, temp, pos));
|
||||
}
|
||||
|
||||
@ -1102,7 +1102,7 @@ DateFormatRegressionTest::Test4162071(void)
|
||||
else
|
||||
errln("Parse format \"" + format + "\" failed.");
|
||||
UnicodeString temp;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
logln(dateString + " -> " + df.format(x, temp, pos));
|
||||
//} catch (Exception e) {
|
||||
// errln("Parse format \"" + format + "\" failed.");
|
||||
@ -1564,7 +1564,7 @@ void DateFormatRegressionTest::TestT10334(void) {
|
||||
format.applyPattern(pattern);
|
||||
UDate referenceDate = format.parse(text, status);
|
||||
|
||||
FieldPosition fp(0);
|
||||
FieldPosition fp(FieldPosition::DONT_CARE);
|
||||
UnicodeString formattedString("");
|
||||
pattern = UnicodeString("YYYY LL dd ee cc qq QQ");
|
||||
format.applyPattern(pattern);
|
||||
|
@ -307,7 +307,7 @@ void DateFormatTest::TestWallyWedel()
|
||||
* Format the output.
|
||||
*/
|
||||
UnicodeString fmtOffset;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
sdf->format(today,fmtOffset, pos);
|
||||
// UnicodeString fmtOffset = tzS.toString();
|
||||
UnicodeString *fmtDstOffset = 0;
|
||||
@ -2390,7 +2390,7 @@ void DateFormatTest::TestRelative(int daysdelta,
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
UnicodeString test;
|
||||
Locale en("en");
|
||||
DateFormat *fullrelative = DateFormat::createDateInstance(DateFormat::kFullRelative, loc);
|
||||
@ -3428,7 +3428,7 @@ void DateFormatTest::TestTimeZoneDisplayName()
|
||||
ASSERT_OK(status);
|
||||
cal->adoptTimeZone(tz);
|
||||
UnicodeString result;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
fmt.format(*cal,result,pos);
|
||||
if (result != info[4]) {
|
||||
errln(info[0] + ";" + info[1] + ";" + info[2] + ";" + info[3] + " expected: '" +
|
||||
@ -3941,7 +3941,7 @@ void DateFormatTest::TestFormalChineseDate() {
|
||||
}
|
||||
|
||||
UDate thedate = date(2009-1900, UCAL_JULY, 28);
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
UnicodeString result;
|
||||
sdf->format(thedate,result,pos);
|
||||
|
||||
@ -4130,7 +4130,7 @@ void DateFormatTest::TestMonthPatterns()
|
||||
rootChineseCalendar->set(datePtr->year, datePtr->month-1, datePtr->day);
|
||||
rootChineseCalendar->set(UCAL_IS_LEAP_MONTH, datePtr->isLeapMonth);
|
||||
UnicodeString result;
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
dmft->format(*rootChineseCalendar, result, fpos);
|
||||
if ( result.compare(itemPtr->dateString[idate]) != 0 ) {
|
||||
errln( UnicodeString("FAIL: Chinese calendar format for locale ") + UnicodeString(itemPtr->locale) + ", style " + itemPtr->style +
|
||||
@ -4215,7 +4215,7 @@ void DateFormatTest::TestContext()
|
||||
} else {
|
||||
sdmft->setContext(itemPtr->capitalizationContext, status);
|
||||
UnicodeString result;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
sdmft->format(*cal, result, pos);
|
||||
if (result.compare(itemPtr->expectedFormat) != 0) {
|
||||
errln(UnicodeString("FAIL: format for locale ") + UnicodeString(itemPtr->locale) +
|
||||
@ -4329,7 +4329,7 @@ void DateFormatTest::TestNonGregoFmtParse()
|
||||
cal->set(UCAL_HOUR_OF_DAY, caftItemPtr->hour);
|
||||
cal->set(UCAL_MINUTE, caftItemPtr->minute);
|
||||
UnicodeString result;
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
dfmt->format(*cal, result, fpos);
|
||||
if ( result.compare(caftItemPtr->formattedDate) != 0 ) {
|
||||
errln( UnicodeString("FAIL: date format for locale ") + UnicodeString(itemPtr->locale) + ", style " + itemPtr->style +
|
||||
@ -4777,7 +4777,7 @@ void DateFormatTest::TestNumberFormatOverride() {
|
||||
}
|
||||
|
||||
UnicodeString result;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
fmt->format(test_date,result, pos);
|
||||
|
||||
UnicodeString expected = ((UnicodeString)DATA[i][1]).unescape();;
|
||||
@ -4795,7 +4795,7 @@ void DateFormatTest::TestCreateInstanceForSkeleton() {
|
||||
return;
|
||||
}
|
||||
UnicodeString result;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
fmt->format(date(98, 5-1, 25), result, pos);
|
||||
assertEquals("format yMMMMd", "May 25, 1998", result);
|
||||
fmt.adoptInstead(DateFormat::createInstanceForSkeleton(
|
||||
@ -4819,7 +4819,7 @@ void DateFormatTest::TestCreateInstanceForSkeletonDefault() {
|
||||
return;
|
||||
}
|
||||
UnicodeString result;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
fmt->format(date(98, 5-1, 25), result, pos);
|
||||
assertEquals("format yMMMd", "May 25, 1998", result);
|
||||
}
|
||||
@ -4836,7 +4836,7 @@ void DateFormatTest::TestCreateInstanceForSkeletonWithCalendar() {
|
||||
return;
|
||||
}
|
||||
UnicodeString result;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
|
||||
LocalPointer<Calendar> cal(Calendar::createInstance(
|
||||
TimeZone::createTimeZone("GMT-7:00"),
|
||||
@ -4904,7 +4904,7 @@ void DateFormatTest::TestChangeCalendar() {
|
||||
return;
|
||||
}
|
||||
UnicodeString result;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
fmt->format(date(98, 5-1, 25), result, pos);
|
||||
assertEquals("format yMMMd", "Iyar 29, 5758", result);
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ void DateIntervalFormatTest::testAPI() {
|
||||
errln("Failure encountered: %s", u_errorName(status));
|
||||
return;
|
||||
}
|
||||
FieldPosition pos = 0;
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
fromTime->set(2013, 3, 26);
|
||||
toTime->set(2013, 3, 28);
|
||||
dif->format(*fromTime, *toTime, expected, pos, status);
|
||||
@ -280,7 +280,7 @@ void DateIntervalFormatTest::testAPI() {
|
||||
Formattable formattable;
|
||||
formattable.setInt64(10);
|
||||
UnicodeString res;
|
||||
FieldPosition pos = 0;
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
status = U_ZERO_ERROR;
|
||||
dtitvfmt->format(formattable, res, pos, status);
|
||||
if ( status != U_ILLEGAL_ARGUMENT_ERROR ) {
|
||||
@ -1083,7 +1083,7 @@ void DateIntervalFormatTest::expect(const char** data, int32_t data_length) {
|
||||
|
||||
DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(oneSkeleton, loc, ec);
|
||||
if (!assertSuccess("createInstance(skeleton) in expect", ec)) return;
|
||||
FieldPosition pos=0;
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
dtitvfmt->format(&dtitv, str.remove(), pos, ec);
|
||||
if (!assertSuccess("format in expect", ec)) return;
|
||||
assertEquals((UnicodeString)"\"" + locName + "\\" + oneSkeleton + "\\" + datestr + "\\" + datestr_2 + "\"", ctou(data[i++]), str);
|
||||
@ -1216,7 +1216,7 @@ void DateIntervalFormatTest::testYearFormats() {
|
||||
}
|
||||
UnicodeString actual;
|
||||
UnicodeString expected(ctou("4/26/0113 \\u2013 4/28/0113"));
|
||||
FieldPosition pos = 0;
|
||||
FieldPosition pos;
|
||||
dif->format(*fromTime, *toTime, actual, pos, status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Failure encountered: %s", u_errorName(status));
|
||||
@ -1234,7 +1234,7 @@ void DateIntervalFormatTest::testYearFormats() {
|
||||
}
|
||||
UnicodeString actual;
|
||||
UnicodeString expected(ctou("4/26/13 \\u2013 4/28/13"));
|
||||
FieldPosition pos = 0;
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
dif->format(*fromTime, *toTime, actual, pos, status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Failure encountered: %s", u_errorName(status));
|
||||
@ -1252,7 +1252,7 @@ void DateIntervalFormatTest::testYearFormats() {
|
||||
}
|
||||
UnicodeString actual;
|
||||
UnicodeString expected(ctou("4/26/113 \\u2013 4/28/113"));
|
||||
FieldPosition pos = 0;
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
dif->format(*fromTime, *toTime, actual, pos, status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("Failure encountered: %s", u_errorName(status));
|
||||
@ -1299,7 +1299,7 @@ void DateIntervalFormatTest::expectUserDII(const char** data,
|
||||
DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY, loc, *dtitvinf, ec);
|
||||
delete dtitvinf;
|
||||
if (!assertSuccess("createInstance(skeleton,dtitvinf) in expectUserDII", ec)) return;
|
||||
FieldPosition pos=0;
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
dtitvfmt->format(&dtitv, str.remove(), pos, ec);
|
||||
if (!assertSuccess("format in expectUserDII", ec)) return;
|
||||
assertEquals((UnicodeString)"\"" + locName + "\\" + datestr + "\\" + datestr_2 + "\"", ctou(data[i++]), str);
|
||||
@ -1470,7 +1470,7 @@ void DateIntervalFormatTest::stress(const char** data, int32_t data_length,
|
||||
if (!assertSuccess("adoptDateFormat()", ec)) return;
|
||||
}
|
||||
*/
|
||||
FieldPosition pos=0;
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
dtitvfmt->format(&dtitv, str.remove(), pos, ec);
|
||||
if (!assertSuccess("format", ec)) return;
|
||||
#ifdef DTIFMTTS_DEBUG
|
||||
@ -1495,7 +1495,7 @@ void DateIntervalFormatTest::stress(const char** data, int32_t data_length,
|
||||
DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY, loc, *dtitvinf, ec);
|
||||
delete dtitvinf;
|
||||
if (!assertSuccess("createInstance(skeleton,dtitvinf)", ec)) return;
|
||||
FieldPosition pos=0;
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
dtitvfmt->format(&dtitv, str.remove(), pos, ec);
|
||||
if ( uprv_strcmp(locName, "th") ) {
|
||||
if (!assertSuccess("format", ec)) return;
|
||||
@ -1559,7 +1559,7 @@ void DateIntervalFormatTest::threadFunc11669(int32_t threadNum) {
|
||||
(void)threadNum;
|
||||
for (int loop=0; loop<1000; ++loop) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
UnicodeString result;
|
||||
gIntervalFormatter->format(gInterval, result, pos, status);
|
||||
if (U_FAILURE(status)) {
|
||||
@ -1587,7 +1587,7 @@ void DateIntervalFormatTest::testTicket11669() {
|
||||
intervalStart->set(2009, 6, 1, 14, 0);
|
||||
intervalEnd->set(2009, 6, 2, 14, 0);
|
||||
DateInterval interval(intervalStart->getTime(status), intervalEnd->getTime(status));
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
UnicodeString expectedResult;
|
||||
formatter->format(&interval, expectedResult, pos, status);
|
||||
if (U_FAILURE(status)) {
|
||||
|
@ -1552,7 +1552,7 @@ LocaleTest::Test4105828()
|
||||
return;
|
||||
}
|
||||
UnicodeString result;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
fmt->format((int32_t)1, result, pos);
|
||||
UnicodeString temp;
|
||||
if(result != "100%") {
|
||||
|
@ -1264,7 +1264,7 @@ void MeasureFormatTest::TestFormatSingleArg() {
|
||||
return;
|
||||
}
|
||||
UnicodeString buffer;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
fmt.format(
|
||||
new Measure(3.5, MeasureUnit::createFoot(status), status),
|
||||
buffer,
|
||||
@ -1457,7 +1457,7 @@ void MeasureFormatTest::helperTestMultiples(
|
||||
UMeasureFormatWidth width,
|
||||
const char *expected) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
MeasureFormat fmt(locale, width, status);
|
||||
if (!assertSuccess("Error creating format object", status)) {
|
||||
return;
|
||||
@ -1525,7 +1525,7 @@ void MeasureFormatTest::helperTestManyLocaleDurations( const char *localeID,
|
||||
return;
|
||||
}
|
||||
UnicodeString buffer;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
fmt.formatMeasures(measures, measureCount, buffer, pos, status);
|
||||
if (U_FAILURE(status)) {
|
||||
errln("MeasureFormat::formatMeasures failed for locale %s, width %d, status: %s", localeID, (int)width, u_errorName(status));
|
||||
@ -1683,7 +1683,7 @@ void MeasureFormatTest::TestBadArg() {
|
||||
if (!assertSuccess("Error creating format object", status)) {
|
||||
return;
|
||||
}
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
UnicodeString buffer;
|
||||
fmt.format(
|
||||
9.3,
|
||||
@ -1791,7 +1791,7 @@ void MeasureFormatTest::TestUnitPerUnitResolution() {
|
||||
if (!assertSuccess("Create of format unit and per unit", status)) {
|
||||
return;
|
||||
}
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
UnicodeString actual;
|
||||
fmt.formatMeasurePerUnit(
|
||||
measure,
|
||||
@ -1866,7 +1866,7 @@ void MeasureFormatTest::verifyFormatWithPrefix(
|
||||
int32_t measureCount,
|
||||
const char *expected) {
|
||||
UnicodeString result(prefix);
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
fmt.formatMeasures(measures, measureCount, result, pos, status);
|
||||
if (!assertSuccess("Error formatting", status)) {
|
||||
|
@ -122,7 +122,7 @@ if (cur_fr != NULL)
|
||||
Formattable fL(l);
|
||||
|
||||
UnicodeString res1, res2, res3, res4, res5, res6;
|
||||
FieldPosition pos1(0), pos2(0), pos3(0), pos4(0);
|
||||
FieldPosition pos1(FieldPosition::DONT_CARE), pos2(FieldPosition::DONT_CARE), pos3(FieldPosition::DONT_CARE), pos4(FieldPosition::DONT_CARE);
|
||||
|
||||
res1 = cur_fr->format(d, res1);
|
||||
logln( (UnicodeString) "" + (int32_t) d + " formatted to " + res1);
|
||||
|
@ -618,7 +618,7 @@ void NumberFormat2Test::TestBenchmark() {
|
||||
Locale en("en");
|
||||
DecimalFormatSymbols *sym = new DecimalFormatSymbols(en, status);
|
||||
DecimalFormat2 fmt(en, "0.0000000", status);
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPostion::DONT_CARE);
|
||||
clock_t start = clock();
|
||||
for (int32_t i = 0; i < 100000; ++i) {
|
||||
UParseError perror;
|
||||
@ -637,7 +637,7 @@ void NumberFormat2Test::TestBenchmark2() {
|
||||
Locale en("en");
|
||||
DecimalFormatSymbols *sym = new DecimalFormatSymbols(en, status);
|
||||
DecimalFormat fmt("0.0000000", sym, status);
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPostion::DONT_CARE);
|
||||
clock_t start = clock();
|
||||
for (int32_t i = 0; i < 100000; ++i) {
|
||||
UParseError perror;
|
||||
|
@ -8402,7 +8402,7 @@ void NumberFormatTest::TestBenchmark() {
|
||||
DecimalFormat fmt("0.0000000", new DecimalFormatSymbols(sym), status);
|
||||
// DecimalFormat fmt("0.00000E0", new DecimalFormatSymbols(sym), status);
|
||||
// DecimalFormat fmt("0", new DecimalFormatSymbols(sym), status);
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
clock_t start = clock();
|
||||
for (int32_t i = 0; i < 1000000; ++i) {
|
||||
UnicodeString append;
|
||||
@ -8417,7 +8417,7 @@ void NumberFormatTest::TestBenchmark() {
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
MessageFormat fmt("{0, plural, one {I have # friend.} other {I have # friends.}}", status);
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
Formattable one(1.0);
|
||||
Formattable three(3.0);
|
||||
clock_t start = clock();
|
||||
@ -8434,7 +8434,7 @@ void NumberFormatTest::TestBenchmark() {
|
||||
Locale en("en");
|
||||
Measure measureC(23, MeasureUnit::createCelsius(status), status);
|
||||
MeasureFormat fmt(en, UMEASFMT_WIDTH_WIDE, status);
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
clock_t start = clock();
|
||||
for (int32_t i = 0; i < 1000000; ++i) {
|
||||
UnicodeString appendTo;
|
||||
|
@ -294,14 +294,14 @@ void NumberFormatRegressionTest::Test4088161 (void)
|
||||
df->setMinimumFractionDigits(0);
|
||||
df->setMaximumFractionDigits(16);
|
||||
UnicodeString sBuf1;
|
||||
FieldPosition fp1(0);
|
||||
FieldPosition fp1(FieldPosition::DONT_CARE);
|
||||
logln(UnicodeString("d = ") + d);
|
||||
logln(UnicodeString("maxFractionDigits = ") + df->getMaximumFractionDigits());
|
||||
|
||||
logln(" format(d) = '" + df->format(d, sBuf1, fp1) + "'");
|
||||
df->setMaximumFractionDigits(17);
|
||||
UnicodeString sBuf2;
|
||||
FieldPosition fp2(0);
|
||||
FieldPosition fp2(FieldPosition::DONT_CARE);
|
||||
logln(UnicodeString("maxFractionDigits = ") + df->getMaximumFractionDigits());
|
||||
sBuf2 = df->format(d, sBuf2, fp2);
|
||||
if(sBuf2 != "100")
|
||||
@ -386,7 +386,7 @@ void NumberFormatRegressionTest::Test4088503 (void)
|
||||
FieldPosition fp(FieldPosition::DONT_CARE);
|
||||
//try {
|
||||
logln(df->format((int32_t)123, sBuf, fp));
|
||||
//if(fp == FieldPosition(0))
|
||||
//if(fp == FieldPosition(FieldPosition::DONT_CARE))
|
||||
// errln("Test for bug 4088503 failed.");
|
||||
/*} catch (Exception foo) {
|
||||
errln("Test for bug 4088503 failed.");
|
||||
@ -694,7 +694,7 @@ void NumberFormatRegressionTest::Test4090489 (void)
|
||||
double d = 1.000000000000001E7;
|
||||
//BigDecimal bd = new BigDecimal(d);
|
||||
UnicodeString sb;
|
||||
FieldPosition fp(0);
|
||||
FieldPosition fp(FieldPosition::DONT_CARE);
|
||||
logln(UnicodeString("d = ") + d);
|
||||
//logln("BigDecimal.toString(): " + bd.toString());
|
||||
df->format(d, sb, fp);
|
||||
@ -1399,7 +1399,7 @@ void NumberFormatRegressionTest::Test4062486(void)
|
||||
return;
|
||||
}
|
||||
UnicodeString formatted;
|
||||
FieldPosition field(0);
|
||||
FieldPosition field(FieldPosition::DONT_CARE);
|
||||
double num = 1234.5;
|
||||
fmt->format(num, formatted, field);
|
||||
if (field.getBeginIndex() != 0 && field.getEndIndex() != 5)
|
||||
|
@ -144,7 +144,7 @@ void IntlTestSimpleDateFormatAPI::testAPI(/*char *par*/)
|
||||
Formattable fD(d, Formattable::kIsDate);
|
||||
|
||||
UnicodeString res1, res2;
|
||||
FieldPosition pos1(0), pos2(0);
|
||||
FieldPosition pos1(FieldPosition::DONT_CARE), pos2(FieldPosition::DONT_CARE);
|
||||
|
||||
res1 = def.format(d, res1, pos1);
|
||||
logln( (UnicodeString) "" + d + " formatted to " + res1);
|
||||
|
@ -50,7 +50,7 @@ TestChoiceFormat::TestSimpleExample( void )
|
||||
UnicodeString str;
|
||||
UnicodeString res1, res2;
|
||||
UErrorCode status;
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
Formattable f;
|
||||
int32_t ix;
|
||||
//for (double i = 0.0; i <= 8.0; ++i) {
|
||||
@ -182,7 +182,7 @@ TestChoiceFormat::TestComplexExample( void )
|
||||
it_errln("*** ChoiceFormat to Pattern result!");
|
||||
}
|
||||
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
|
||||
UnicodeString checkstr[] = {
|
||||
"There are corrupted files on Disk_A",
|
||||
|
@ -141,7 +141,7 @@ void TestMessageFormat::testBug3()
|
||||
continue;
|
||||
}
|
||||
Formattable result;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
buffer.remove();
|
||||
form->format(myNumber, buffer, pos);
|
||||
success = U_ZERO_ERROR;
|
||||
@ -163,7 +163,7 @@ void TestMessageFormat::testBug1()
|
||||
"1.0<=Arg<2.0",
|
||||
"2.0<-Arg"};
|
||||
ChoiceFormat *cf = new ChoiceFormat(limit, formats, 3);
|
||||
FieldPosition status(0);
|
||||
FieldPosition status(FieldPosition::DONT_CARE);
|
||||
UnicodeString toAppendTo;
|
||||
cf->format((int32_t)1, toAppendTo, status);
|
||||
if (toAppendTo != "1.0<=Arg<2.0") {
|
||||
@ -321,7 +321,7 @@ void TestMessageFormat::PatternTest()
|
||||
//it_out << "Pat out: " << form->toPattern(buffer));
|
||||
UnicodeString result;
|
||||
int32_t count = 4;
|
||||
FieldPosition fieldpos(0);
|
||||
FieldPosition fieldpos(FieldPosition::DONT_CARE);
|
||||
form->format(testArgs, count, result, fieldpos, success);
|
||||
if (U_FAILURE(success)) {
|
||||
dataerrln("MessageFormat failed test #3 - %s", u_errorName(success));
|
||||
@ -381,7 +381,7 @@ void TestMessageFormat::sample()
|
||||
UnicodeString abc("abc");
|
||||
UnicodeString def("def");
|
||||
Formattable testArgs1[] = { abc, def };
|
||||
FieldPosition fieldpos(0);
|
||||
FieldPosition fieldpos(FieldPosition::DONT_CARE);
|
||||
assertEquals("format",
|
||||
"There are abc files on def",
|
||||
form->format(testArgs1, 2, buffer2, fieldpos, success));
|
||||
@ -1002,7 +1002,7 @@ void TestMessageFormat::testSetLocale()
|
||||
|
||||
MessageFormat msg( formatStr, err);
|
||||
result = "";
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
result = msg.format(
|
||||
arguments,
|
||||
3,
|
||||
@ -1074,7 +1074,7 @@ void TestMessageFormat::testFormat()
|
||||
|
||||
err = U_ZERO_ERROR;
|
||||
MessageFormat msg( formatStr, err);
|
||||
FieldPosition fp(0);
|
||||
FieldPosition fp(FieldPosition::DONT_CARE);
|
||||
|
||||
result = "";
|
||||
fp = 0;
|
||||
@ -1406,7 +1406,7 @@ static void _testCopyConstructor2()
|
||||
UnicodeString formatStr("Hello World on {0,date,full}", "");
|
||||
UnicodeString resultStr(" ", "");
|
||||
UnicodeString result;
|
||||
FieldPosition fp(0);
|
||||
FieldPosition fp(FieldPosition::DONT_CARE);
|
||||
UDate d = Calendar::getNow();
|
||||
const Formattable fargs( d, Formattable::kIsDate );
|
||||
|
||||
@ -1552,7 +1552,7 @@ void TestMessageFormat::TestRBNF(void) {
|
||||
if (U_FAILURE(ec)) {
|
||||
errln((UnicodeString)"Failed to parse test argument " + values[j]);
|
||||
} else {
|
||||
FieldPosition fp(0);
|
||||
FieldPosition fp(FieldPosition::DONT_CARE);
|
||||
UnicodeString result;
|
||||
fmt->format(args, 1, result, fp, ec);
|
||||
logln((UnicodeString)"value: " + toString(args[0]) + " --> " + result + UnicodeString(" ec: ") + u_errorName(ec));
|
||||
@ -1644,7 +1644,7 @@ void TestMessageFormat::TestCompatibleApostrophe() {
|
||||
}
|
||||
|
||||
Formattable zero0[] = { (int32_t)0 };
|
||||
FieldPosition fieldpos(0);
|
||||
FieldPosition fieldpos(FieldPosition::DONT_CARE);
|
||||
UnicodeString buffer1, buffer2;
|
||||
assertEquals("incompatible ICU MessageFormat compatibility-apostrophe behavior",
|
||||
"ab12'3'4''.yz",
|
||||
@ -1848,7 +1848,7 @@ void TestMessageFormat::TestTrimArgumentName() {
|
||||
return;
|
||||
}
|
||||
Formattable args[1] = { (int32_t)2 };
|
||||
FieldPosition ignore(0);
|
||||
FieldPosition ignore(FieldPosition::DONT_CARE);
|
||||
UnicodeString result;
|
||||
assertEquals("trim-numbered-arg format() failed", "a #,#2.0 z",
|
||||
m.format(args, 1, result, ignore, errorCode));
|
||||
@ -1873,7 +1873,7 @@ void TestMessageFormat::TestSelectOrdinal() {
|
||||
return;
|
||||
}
|
||||
Formattable args[1] = { (int32_t)21 };
|
||||
FieldPosition ignore(0);
|
||||
FieldPosition ignore(FieldPosition::DONT_CARE);
|
||||
UnicodeString result;
|
||||
assertEquals("plural-and-ordinal format(21) failed", "21 files, 21st file",
|
||||
m.format(args, 1, result, ignore, errorCode), TRUE);
|
||||
|
@ -183,7 +183,7 @@ TimeZoneFormatTest::TestTimeZoneRoundTrip(void) {
|
||||
|
||||
for (int32_t datidx = 0; datidx < nDates; datidx++) {
|
||||
UnicodeString tzstr;
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
// Format
|
||||
sdf->setTimeZone(*tz);
|
||||
sdf->format(DATES[datidx], tzstr, fpos);
|
||||
@ -653,7 +653,7 @@ void TimeZoneFormatTest::RunTimeRoundTripTests(int32_t threadNumber) {
|
||||
}
|
||||
|
||||
UnicodeString text;
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
sdf->format(testTimes[testidx], text, fpos);
|
||||
|
||||
UDate parsedDate = sdf->parse(text, status);
|
||||
|
@ -413,7 +413,7 @@ TimeZoneRegressionTest::checkCalendar314(GregorianCalendar *testCal, TimeZone *t
|
||||
}
|
||||
|
||||
UnicodeString output;
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
output = testTZ->getID(output) + " " + sdf->format(testDate, output, pos) +
|
||||
" Offset(" + tzOffsetFloat + ")" +
|
||||
" RawOffset(" + tzRawOffsetFloat + ")" +
|
||||
@ -892,7 +892,7 @@ TimeZoneRegressionTest::Test4162593()
|
||||
UnicodeString temp;
|
||||
logln(tz->getID(temp) + ":");
|
||||
for (int32_t i = 0; i < 4; ++i) {
|
||||
FieldPosition pos(0);
|
||||
FieldPosition pos(FieldPosition::DONT_CARE);
|
||||
zone[i].remove();
|
||||
zone[i] = fmt->format(d+ i*ONE_HOUR, zone[i], pos);
|
||||
logln(UnicodeString("") + i + ": " + d + " / " + zone[i]);
|
||||
|
@ -1,3 +1,5 @@
|
||||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2010-2016,International Business Machines
|
||||
@ -165,7 +167,7 @@ public:
|
||||
|
||||
for (int32_t datidx = 0; datidx < nDates; datidx++) {
|
||||
UnicodeString tzstr;
|
||||
FieldPosition fpos(0);
|
||||
FieldPosition fpos(FieldPosition::DONT_CARE);
|
||||
|
||||
// Format
|
||||
sdf->setTimeZone(*tz);
|
||||
|
Loading…
Reference in New Issue
Block a user