ICU-11572 API proposal updates for approved constants

X-SVN-Rev: 37961
This commit is contained in:
Scott Russell 2015-09-16 00:14:58 +00:00
parent 39f7040439
commit c179cf974c
4 changed files with 13 additions and 12 deletions

View file

@ -934,7 +934,7 @@ void SimpleDateFormat::initializeBooleanAttributes()
setBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, true, status);
setBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, true, status);
setBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, true, status);
setBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, true, status);
setBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, true, status);
}
@ -2125,7 +2125,7 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
abutPat = -1; // End of any abutting fields
if (! matchLiterals(fPattern, i, text, pos, getBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, status), getBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, status), isLenient())) {
if (! matchLiterals(fPattern, i, text, pos, getBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, status), getBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, status), isLenient())) {
status = U_PARSE_ERROR;
goto ExitParse;
}

View file

@ -875,13 +875,14 @@ typedef enum UDateFormatBooleanAttribute {
#ifndef U_HIDE_DRAFT_API
/**
* indicates tolerance of a partial literal match
* @draft ICU 53
* e.g. accepting "--mon-02-march-2011" for a pattern of "'--: 'EEE-WW-MMMM-yyyy"
* @draft ICU 56
*/
UDAT_PARSE_PARTIAL_MATCH = 2,
UDAT_PARSE_PARTIAL_LITERAL_MATCH = 2,
/**
* indicates tolerance of pattern mismatch between input data and specified format pattern.
* e.g. accepting "September" for a month pattern of MMM ("Sep")
* @draft ICU 53
* @draft ICU 56
*/
UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3,
#endif /* U_HIDE_DRAFT_API */

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2014, International Business Machines Corporation and
* Copyright (c) 1997-2015, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
@ -1542,14 +1542,14 @@ void DateFormatRegressionTest::TestT10334(void) {
return;
}
format.setBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, FALSE, status);
format.setBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, FALSE, status);
format.parse(text, status);
if (!U_FAILURE(status)) {
errln("parse partial match did NOT fail in strict mode - %s", u_errorName(status));
}
status = U_ZERO_ERROR;
format.setBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, TRUE, status);
format.setBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, TRUE, status);
format.parse(text, status);
if (U_FAILURE(status)) {
errln("parse partial match failure in lenient mode - %s", u_errorName(status));
@ -1636,7 +1636,7 @@ void DateFormatRegressionTest::TestT10619(void) {
sdmft->setLenient(itemPtr->leniency);
sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, itemPtr->leniency, status);
sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, itemPtr->leniency, status);
sdmft->setBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, itemPtr->leniency, status);
sdmft->setBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, itemPtr->leniency, status);
sdmft->parse(itemPtr->parseString, pos);
delete sdmft;

View file

@ -4457,7 +4457,7 @@ void DateFormatTest::TestDateFormatLeniency() {
}
sdmft->setBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, itemPtr->leniency, status).
setBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, itemPtr->leniency, status).
setBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, itemPtr->leniency, status);
setBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, itemPtr->leniency, status);
UDate d = sdmft->parse(itemPtr->parseString, pos);
if(itemPtr->expectedResult.length() == 0) {
@ -4597,7 +4597,7 @@ void DateFormatTest::TestParseLeniencyAPIs() {
assertTrue("isCalendarLenient default", fmt->isCalendarLenient());
assertTrue("ALLOW_WHITESPACE default", fmt->getBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, status));
assertTrue("ALLOW_NUMERIC default", fmt->getBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, status));
assertTrue("PARTIAL_MATCH default", fmt->getBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, status));
assertTrue("PARTIAL_MATCH default", fmt->getBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, status));
assertTrue("MULTIPLE_PATTERNS default", fmt->getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status));
// Set calendar to strict
@ -4616,7 +4616,7 @@ void DateFormatTest::TestParseLeniencyAPIs() {
assertFalse("ALLOW_WHITESPACE after setLenient(FALSE)", fmt->getBooleanAttribute(UDAT_PARSE_ALLOW_WHITESPACE, status));
assertFalse("ALLOW_NUMERIC after setLenient(FALSE)", fmt->getBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, status));
// These two boolean attributes are NOT affected according to the API specification
assertTrue("PARTIAL_MATCH after setLenient(FALSE)", fmt->getBooleanAttribute(UDAT_PARSE_PARTIAL_MATCH, status));
assertTrue("PARTIAL_MATCH after setLenient(FALSE)", fmt->getBooleanAttribute(UDAT_PARSE_PARTIAL_LITERAL_MATCH, status));
assertTrue("MULTIPLE_PATTERNS after setLenient(FALSE)", fmt->getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status));
// Allow white space leniency