ICU-13725 Fix many of the C4251 warnings by DLL-exporting explicit template instantiations.

X-SVN-Rev: 41306
This commit is contained in:
Jeff Genovy 2018-05-02 06:49:00 +00:00
parent b840d51ed9
commit f5082ad3a7
4 changed files with 36 additions and 1 deletions

View file

@ -115,6 +115,15 @@ getPatternForStyle(const Locale& locale, const char* nsName, CldrPatternStyle st
} // namespace utils
#define DECNUM_INITIAL_CAPACITY 34
// Export an explicit template instantiation of the MaybeStackHeaderAndArray that is used as a data member of DecNum.
// When building DLLs for Windows this is required even though no direct access to the MaybeStackHeaderAndArray leaks out of the i18n library.
// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackHeaderAndArray<decNumber, char, DECNUM_INITIAL_CAPACITY>;
#endif
/** A very thin C++ wrapper around decNumber.h */
// Exported as U_I18N_API for tests
class U_I18N_API DecNum : public UMemory {
@ -151,7 +160,7 @@ class U_I18N_API DecNum : public UMemory {
}
private:
static constexpr int32_t kDefaultDigits = 34;
static constexpr int32_t kDefaultDigits = DECNUM_INITIAL_CAPACITY;
MaybeStackHeaderAndArray<decNumber, char, kDefaultDigits> fData;
decContext fContext;

View file

@ -44,6 +44,13 @@ class CodePointMatcher : public NumberParseMatcher, public UMemory {
};
// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of CodePointMatcherWarehouse.
// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
// (See numparse_compositions.h, digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackArray<CodePointMatcher*, 3>;
#endif
/**
* A warehouse to retain ownership of CodePointMatchers.
*/
@ -155,6 +162,12 @@ class AffixPatternMatcherBuilder : public TokenConsumer, public MutableMatcherCo
void addMatcher(NumberParseMatcher& matcher) override;
};
// Export an explicit template instantiation of the CompactUnicodeString that is used as a data member of AffixPatternMatcher.
// When building DLLs for Windows this is required even though no direct access to the CompactUnicodeString leaks out of the i18n library.
// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API CompactUnicodeString<4>;
#endif
// Exported as U_I18N_API for tests
class U_I18N_API AffixPatternMatcher : public ArraySeriesMatcher {

View file

@ -78,6 +78,12 @@ class U_I18N_API SeriesMatcher : public CompositionMatcher {
SeriesMatcher() = default;
};
// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of ArraySeriesMatcher.
// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
// (See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackArray<const NumberParseMatcher*, 3>;
#endif
/**
* An implementation of SeriesMatcher that references an array of matchers.

View file

@ -22,6 +22,13 @@
U_NAMESPACE_BEGIN namespace numparse {
namespace impl {
// Export an explicit template instantiation of the MaybeStackArray that is used as a data member of NumberParserImpl.
// When building DLLs for Windows this is required even though no direct access to the MaybeStackArray leaks out of the i18n library.
// (See numparse_compositions.h, numparse_affixes.h, datefmt.h, and others for similar examples.)
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
template class U_I18N_API MaybeStackArray<const NumberParseMatcher*, 10>;
#endif
// Exported as U_I18N_API for tests
class U_I18N_API NumberParserImpl : public MutableMatcherCollection {
public: