ICU-21053 Fix compile problems with UCONFIG_NO_FORMATTING = 1

See #1115
This commit is contained in:
Craig Cornelius 2020-04-20 16:26:58 +00:00
parent 3dce0ab5c6
commit 2f4e2e43ce
4 changed files with 19 additions and 1 deletions

View File

@ -348,6 +348,7 @@ const ListFormatInternal* ListFormatter::getListFormatInternal(
return result;
}
#if !UCONFIG_NO_FORMATTING
static const char* typeWidthToStyleString(UListFormatterType type, UListFormatterWidth width) {
switch (type) {
case ULISTFMT_TYPE_AND:
@ -391,6 +392,7 @@ static const char* typeWidthToStyleString(UListFormatterType type, UListFormatte
return nullptr;
}
#endif
static const UChar solidus = 0x2F;
static const UChar aliasPrefix[] = { 0x6C,0x69,0x73,0x74,0x50,0x61,0x74,0x74,0x65,0x72,0x6E,0x2F }; // "listPattern/"
@ -511,9 +513,14 @@ ListFormatter* ListFormatter::createInstance(UErrorCode& errorCode) {
}
ListFormatter* ListFormatter::createInstance(const Locale& locale, UErrorCode& errorCode) {
#if !UCONFIG_NO_FORMATTING
return createInstance(locale, ULISTFMT_TYPE_AND, ULISTFMT_WIDTH_WIDE, errorCode);
#else
return createInstance(locale, "standard", errorCode);
#endif
}
#if !UCONFIG_NO_FORMATTING
ListFormatter* ListFormatter::createInstance(
const Locale& locale, UListFormatterType type, UListFormatterWidth width, UErrorCode& errorCode) {
const char* style = typeWidthToStyleString(type, width);
@ -523,6 +530,7 @@ ListFormatter* ListFormatter::createInstance(
}
return createInstance(locale, style, errorCode);
}
#endif
ListFormatter* ListFormatter::createInstance(const Locale& locale, const char *style, UErrorCode& errorCode) {
const ListFormatInternal* listFormatInternal = getListFormatInternal(locale, style, errorCode);

View File

@ -483,6 +483,8 @@ public:
*/
const UnicodeString& getDecimal() const;
#if !UCONFIG_NO_FORMATTING
#ifndef U_HIDE_DRAFT_API
/**
* Get the default hour cycle for a locale. Uses the locale that the
@ -499,6 +501,8 @@ public:
UDateFormatHourCycle getDefaultHourCycle(UErrorCode& status) const;
#endif /* U_HIDE_DRAFT_API */
#endif /* #if !UCONFIG_NO_FORMATTING */
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*

View File

@ -186,6 +186,7 @@ class U_I18N_API ListFormatter : public UObject{
static ListFormatter* createInstance(const Locale& locale, UErrorCode& errorCode);
#ifndef U_HIDE_DRAFT_API
#if !UCONFIG_NO_FORMATTING
/**
* Creates a ListFormatter for the given locale, list type, and style.
*
@ -198,8 +199,9 @@ class U_I18N_API ListFormatter : public UObject{
*/
static ListFormatter* createInstance(
const Locale& locale, UListFormatterType type, UListFormatterWidth width, UErrorCode& errorCode);
#endif /* !UCONFIG_NO_FORMATTING */
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_INTERNAL_API
/**
* Creates a ListFormatter appropriate for a locale and style.

View File

@ -652,6 +652,8 @@ udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
const UChar *skeleton, int32_t skeletonLength,
int32_t *pLength);
#if !UCONFIG_NO_FORMATTING
#ifndef U_HIDE_DRAFT_API
/**
* Return the default hour cycle for a locale. Uses the locale that the
@ -670,4 +672,6 @@ U_DRAFT UDateFormatHourCycle U_EXPORT2
udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode);
#endif /* U_HIDE_DRAFT_API */
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif