Fix MSVC compilation errors

This commit is contained in:
Tim Chevalier 2024-06-18 14:08:39 -07:00
parent 325474c454
commit dea6034c66
2 changed files with 37 additions and 39 deletions

View file

@ -234,7 +234,6 @@ namespace message2 {
return tz;
}
DateFormat* defaultDateTimeInstance(const Locale& locale, UErrorCode& errorCode) {
NULL_ON_ERROR(errorCode);
LocalPointer<DateFormat> df(DateFormat::createDateTimeInstance(DateFormat::SHORT, DateFormat::SHORT, locale));

View file

@ -67,44 +67,6 @@ namespace message2 {
virtual ~FormattableObject();
}; // class FormattableObject
struct DateInfo;
class Formattable;
} // namespace message2
U_NAMESPACE_END
/// @cond DOXYGEN_IGNORE
// Export an explicit template instantiation of the std::variant that is used
// to represent the message2::Formattable class.
// (When building DLLs for Windows this is required.)
// (See measunit_impl.h, datefmt.h, collationiterator.h, erarules.h and others
// for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
#if defined(U_REAL_MSVC) && defined(_MSVC_STL_VERSION)
template class U_I18N_API std::_Variant_storage_<false,
double,
int64_t,
icu::UnicodeString,
icu::Formattable,
icu::message2::DateInfo;
const icu::message2::FormattableObject *,
std::pair<const icu::message2::Formattable *,int32_t>>;
#endif
typedef std::pair<const icu::message2::Formattable*, int32_t> P;
template class U_I18N_API std::variant<double,
int64_t,
icu::UnicodeString,
icu::Formattable,
icu::message2::DateInfo,
const icu::message2::FormattableObject*,
P>;
#endif
/// @endcond
U_NAMESPACE_BEGIN
namespace message2 {
/**
* The `DateInfo` struct represents all the information needed to
* format a date with a time zone. It includes an absolute date and a time zone name,
@ -149,6 +111,43 @@ namespace message2 {
TimeZone* createTimeZone(UErrorCode& status) const;
};
class Formattable;
} // namespace message2
U_NAMESPACE_END
/// @cond DOXYGEN_IGNORE
// Export an explicit template instantiation of the std::variant that is used
// to represent the message2::Formattable class.
// (When building DLLs for Windows this is required.)
// (See measunit_impl.h, datefmt.h, collationiterator.h, erarules.h and others
// for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
#if defined(U_REAL_MSVC) && defined(_MSVC_STL_VERSION)
template class U_I18N_API std::_Variant_storage_<false,
double,
int64_t,
icu::UnicodeString,
icu::Formattable,
icu::message2::DateInfo,
const icu::message2::FormattableObject *,
std::pair<const icu::message2::Formattable *,int32_t>>;
#endif
typedef std::pair<const icu::message2::Formattable*, int32_t> P;
template class U_I18N_API std::variant<double,
int64_t,
icu::UnicodeString,
icu::Formattable,
icu::message2::DateInfo,
const icu::message2::FormattableObject*,
P>;
#endif
/// @endcond
U_NAMESPACE_BEGIN
namespace message2 {
/**
* The `Formattable` class represents a typed value that can be formatted,
* originating either from a message argument or a literal in the code.