From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Wed, 2 May 2018 08:18:00 +0000 (+0000) Subject: ICU-13725 Fix last remaining C4251 warnings/errors by bringing back the CurrencyPlura... X-Git-Tag: release-62-rc~167 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d5e369e783733e1016731cec30c2f606acae83a;p=icu ICU-13725 Fix last remaining C4251 warnings/errors by bringing back the CurrencyPluralInfoWrapper. X-SVN-Rev: 41308 --- diff --git a/icu4c/source/i18n/number_decimfmtprops.h b/icu4c/source/i18n/number_decimfmtprops.h index 05788dbe363..4a78ed1b9b8 100644 --- a/icu4c/source/i18n/number_decimfmtprops.h +++ b/icu4c/source/i18n/number_decimfmtprops.h @@ -17,9 +17,6 @@ U_NAMESPACE_BEGIN -namespace number { -namespace impl { - // Export an explicit template instantiation of the LocalPointer that is used as a // data member of CurrencyPluralInfoWrapper. // (When building DLLs for Windows this is required.) @@ -30,25 +27,30 @@ template class U_I18N_API LocalPointerBase; template class U_I18N_API LocalPointer; #endif -// Exported as U_I18N_API because it is a public member field of exported DecimalFormatProperties -template -struct U_I18N_API CopyableLocalPointer { - LocalPointer fPtr; - - CopyableLocalPointer() = default; - - CopyableLocalPointer(const CopyableLocalPointer& other) { - if (!other.fPtr.isNull()) { - fPtr.adoptInstead(new T(*other.fPtr)); - } - } +namespace number { +namespace impl { - CopyableLocalPointer& operator=(const CopyableLocalPointer& other) { - if (!other.fPtr.isNull()) { - fPtr.adoptInstead(new T(*other.fPtr)); - } - return *this; - } +// Exported as U_I18N_API because it is a public member field of exported DecimalFormatProperties +// Using this wrapper is rather unfortunate, but is needed on Windows platforms in order to allow +// for DLL-exporting an fully specified template instantiation. +class U_I18N_API CurrencyPluralInfoWrapper { +public: + LocalPointer fPtr; + + CurrencyPluralInfoWrapper() = default; + + CurrencyPluralInfoWrapper(const CurrencyPluralInfoWrapper& other) { + if (!other.fPtr.isNull()) { + fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr)); + } + } + + CurrencyPluralInfoWrapper& operator=(const CurrencyPluralInfoWrapper& other) { + if (!other.fPtr.isNull()) { + fPtr.adoptInstead(new CurrencyPluralInfo(*other.fPtr)); + } + return *this; + } }; /** Controls the set of rules for parsing a string from the old DecimalFormat API. */ @@ -91,7 +93,7 @@ struct U_I18N_API DecimalFormatProperties { public: NullableValue compactStyle; NullableValue currency; - CopyableLocalPointer currencyPluralInfo; + CurrencyPluralInfoWrapper currencyPluralInfo; NullableValue currencyUsage; bool decimalPatternMatchRequired; bool decimalSeparatorAlwaysShown;