"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "source/i18n/listformatter.cpp" between
icu4c-67rc-src.tgz and icu4c-67_1-src.tgz

About: ICU (International Components for Unicode) is a set of C/C++ and Java libraries providing Unicode and Globalization support for software applications on a wide variety of platforms.

listformatter.cpp  (icu4c-67rc-src.tgz):listformatter.cpp  (icu4c-67_1-src.tgz)
skipping to change at line 349 skipping to change at line 349
} else { } else {
listPatternHash->put(key, result, errorCode); listPatternHash->put(key, result, errorCode);
if (U_FAILURE(errorCode)) { if (U_FAILURE(errorCode)) {
return nullptr; return nullptr;
} }
} }
} }
return result; return result;
} }
#if !UCONFIG_NO_FORMATTING
static const char* typeWidthToStyleString(UListFormatterType type, UListFormatte rWidth width) { static const char* typeWidthToStyleString(UListFormatterType type, UListFormatte rWidth width) {
switch (type) { switch (type) {
case ULISTFMT_TYPE_AND: case ULISTFMT_TYPE_AND:
switch (width) { switch (width) {
case ULISTFMT_WIDTH_WIDE: case ULISTFMT_WIDTH_WIDE:
return "standard"; return "standard";
case ULISTFMT_WIDTH_SHORT: case ULISTFMT_WIDTH_SHORT:
return "standard-short"; return "standard-short";
case ULISTFMT_WIDTH_NARROW: case ULISTFMT_WIDTH_NARROW:
return "standard-narrow"; return "standard-narrow";
skipping to change at line 392 skipping to change at line 393
return "unit-short"; return "unit-short";
case ULISTFMT_WIDTH_NARROW: case ULISTFMT_WIDTH_NARROW:
return "unit-narrow"; return "unit-narrow";
default: default:
return nullptr; return nullptr;
} }
} }
return nullptr; return nullptr;
} }
#endif
static const UChar solidus = 0x2F; static const UChar solidus = 0x2F;
static const UChar aliasPrefix[] = { 0x6C,0x69,0x73,0x74,0x50,0x61,0x74,0x74,0x6 5,0x72,0x6E,0x2F }; // "listPattern/" static const UChar aliasPrefix[] = { 0x6C,0x69,0x73,0x74,0x50,0x61,0x74,0x74,0x6 5,0x72,0x6E,0x2F }; // "listPattern/"
enum { enum {
kAliasPrefixLen = UPRV_LENGTHOF(aliasPrefix), kAliasPrefixLen = UPRV_LENGTHOF(aliasPrefix),
kStyleLenMax = 24 // longest currently is 14 kStyleLenMax = 24 // longest currently is 14
}; };
struct ListFormatter::ListPatternsSink : public ResourceSink { struct ListFormatter::ListPatternsSink : public ResourceSink {
UnicodeString two, start, middle, end; UnicodeString two, start, middle, end;
skipping to change at line 512 skipping to change at line 514
} }
return result; return result;
} }
ListFormatter* ListFormatter::createInstance(UErrorCode& errorCode) { ListFormatter* ListFormatter::createInstance(UErrorCode& errorCode) {
Locale locale; // The default locale. Locale locale; // The default locale.
return createInstance(locale, errorCode); return createInstance(locale, errorCode);
} }
ListFormatter* ListFormatter::createInstance(const Locale& locale, UErrorCode& e rrorCode) { ListFormatter* ListFormatter::createInstance(const Locale& locale, UErrorCode& e rrorCode) {
#if !UCONFIG_NO_FORMATTING
return createInstance(locale, ULISTFMT_TYPE_AND, ULISTFMT_WIDTH_WIDE, errorC ode); return createInstance(locale, ULISTFMT_TYPE_AND, ULISTFMT_WIDTH_WIDE, errorC ode);
#else
return createInstance(locale, "standard", errorCode);
#endif
} }
#if !UCONFIG_NO_FORMATTING
ListFormatter* ListFormatter::createInstance( ListFormatter* ListFormatter::createInstance(
const Locale& locale, UListFormatterType type, UListFormatterWidth width , UErrorCode& errorCode) { const Locale& locale, UListFormatterType type, UListFormatterWidth width , UErrorCode& errorCode) {
const char* style = typeWidthToStyleString(type, width); const char* style = typeWidthToStyleString(type, width);
if (style == nullptr) { if (style == nullptr) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR; errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return nullptr; return nullptr;
} }
return createInstance(locale, style, errorCode); return createInstance(locale, style, errorCode);
} }
#endif
ListFormatter* ListFormatter::createInstance(const Locale& locale, const char *s tyle, UErrorCode& errorCode) { ListFormatter* ListFormatter::createInstance(const Locale& locale, const char *s tyle, UErrorCode& errorCode) {
const ListFormatInternal* listFormatInternal = getListFormatInternal(locale, style, errorCode); const ListFormatInternal* listFormatInternal = getListFormatInternal(locale, style, errorCode);
if (U_FAILURE(errorCode)) { if (U_FAILURE(errorCode)) {
return nullptr; return nullptr;
} }
ListFormatter* p = new ListFormatter(listFormatInternal); ListFormatter* p = new ListFormatter(listFormatInternal);
if (p == nullptr) { if (p == nullptr) {
errorCode = U_MEMORY_ALLOCATION_ERROR; errorCode = U_MEMORY_ALLOCATION_ERROR;
return nullptr; return nullptr;
 End of changes. 6 change blocks. 
0 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)