]> granicus.if.org Git - icu/commitdiff
ICU-13177 Fixing Visual Studio build warnings in number formatting code.
authorShane Carr <shane@unicode.org>
Thu, 28 Sep 2017 22:53:31 +0000 (22:53 +0000)
committerShane Carr <shane@unicode.org>
Thu, 28 Sep 2017 22:53:31 +0000 (22:53 +0000)
X-SVN-Rev: 40510

icu4c/source/i18n/number_affixutils.h
icu4c/source/i18n/number_decimfmtprops.h
icu4c/source/i18n/number_patternmodifier.h
icu4c/source/i18n/number_patternstring.h
icu4c/source/i18n/number_scientific.h
icu4c/source/i18n/number_types.h
icu4c/source/i18n/unicode/numberformatter.h

index 1e3c30d27194a6fb2ff4d116a9a88f302d98cc64..db10f866c4add4b3455b06717922759395a1fbbd 100644 (file)
@@ -44,7 +44,8 @@ struct AffixTag {
         {}
 };
 
-class SymbolProvider {
+// Exported as U_I18N_API because it is a base class for other exported types
+class U_I18N_API SymbolProvider {
   public:
     // TODO: Could this be more efficient if it returned by reference?
     virtual UnicodeString getSymbol(AffixPatternType type) const = 0;
index 3afd0078de9ca9cacab6e18b03461420cb0c3cca..3815b250f25970c8b6b73b4d32c94508642ba34e 100644 (file)
@@ -10,6 +10,7 @@
 #include "unicode/plurrule.h"
 #include "unicode/currpinf.h"
 #include "unicode/unum.h"
+#include "unicode/localpointer.h"
 #include "number_types.h"
 
 U_NAMESPACE_BEGIN
@@ -17,7 +18,9 @@ namespace number {
 namespace impl {
 
 // TODO: Figure out a nicer way to deal with CurrencyPluralInfo.
-struct CurrencyPluralInfoWrapper {
+// Exported as U_I18N_API because it is a public member field of exported DecimalFormatProperties
+struct U_I18N_API CurrencyPluralInfoWrapper {
+#pragma warning(suppress: 4251)  // LocalPointer is defined in a header file; why does Visual Studio complain?
     LocalPointer<CurrencyPluralInfo> fPtr;
 
     CurrencyPluralInfoWrapper() {}
@@ -28,6 +31,7 @@ struct CurrencyPluralInfoWrapper {
     }
 };
 
+// Exported as U_I18N_API because it is needed for the unit test PatternStringTest
 struct U_I18N_API DecimalFormatProperties {
 
   public:
index 45f9dc352eab120e1af8515f1bfaa3bc42b29475..8ea1e24d9a875f3850af863992543cd087edf5e4 100644 (file)
@@ -16,21 +16,27 @@ U_NAMESPACE_BEGIN
 namespace number {
 namespace impl {
 
+// Forward declaration
+class MutablePatternModifier;
+       
+// Exported as U_I18N_API because it is needed for the unit test PatternModifierTest
 class U_I18N_API ImmutablePatternModifier : public MicroPropsGenerator {
   public:
-    ImmutablePatternModifier(ParameterizedModifier *pm, const PluralRules *rules,
-                             const MicroPropsGenerator *parent);
-
-    ~ImmutablePatternModifier() override = default;
+       ~ImmutablePatternModifier() override = default;
 
     void processQuantity(DecimalQuantity &, MicroProps &micros, UErrorCode &status) const override;
 
     void applyToMicros(MicroProps &micros, DecimalQuantity &quantity) const;
 
   private:
-    const LocalPointer<ParameterizedModifier> pm;
+       ImmutablePatternModifier(ParameterizedModifier *pm, const PluralRules *rules, const MicroPropsGenerator *parent);
+
+#pragma warning(suppress: 4251)  // Member is private and does not need to be exported
+       const LocalPointer<ParameterizedModifier> pm;
     const PluralRules *rules;
     const MicroPropsGenerator *parent;
+
+       friend class MutablePatternModifier;
 };
 
 /**
index 03f08cdf3415a65a439d6b1707c38ba133e0fb5c..43b03b426a5ce7ff22b3f8f5a2261b853ea49942 100644 (file)
@@ -25,7 +25,8 @@ struct Endpoints {
     int32_t end = 0;
 };
 
-struct ParsedSubpatternInfo {
+// Exported as U_I18N_API because it is a public member field of exported ParsedPatternInfo
+struct U_I18N_API ParsedSubpatternInfo {
     int64_t groupingSizes = 0x0000ffffffff0000L;
     int32_t integerLeadingHashSigns = 0;
     int32_t integerTrailingHashSigns = 0;
@@ -52,7 +53,8 @@ struct ParsedSubpatternInfo {
     Endpoints paddingEndpoints;
 };
 
-struct U_I18N_API ParsedPatternInfo : public AffixPatternProvider {
+// Exported as U_I18N_API because it is needed for the unit test PatternStringTest
+struct U_I18N_API ParsedPatternInfo : public AffixPatternProvider, public UMemory {
     UnicodeString pattern;
     ParsedSubpatternInfo positive;
     ParsedSubpatternInfo negative;
@@ -93,7 +95,9 @@ struct U_I18N_API ParsedPatternInfo : public AffixPatternProvider {
         // TODO: We don't currently do anything with the message string.
         // This method is here as a shell for Java compatibility.
         inline void toParseException(const char16_t *message) { (void)message; }
-    } state;
+    }
+#pragma warning(suppress: 4251)  // Member is private and does not need to be exported
+       state;
 
     // NOTE: In Java, these are written as pure functions.
     // In C++, they're written as methods.
index 6bdd24aa3c3edcf08b713606b95df51f3931eadf..8ba60e9414640e42c4737dab2a15e03fb242b250 100644 (file)
@@ -33,7 +33,7 @@ class U_I18N_API ScientificModifier : public UMemory, public Modifier {
     const ScientificHandler *fHandler;
 };
 
-class U_I18N_API ScientificHandler : public UMemory, public MicroPropsGenerator, public MultiplierProducer {
+class ScientificHandler : public UMemory, public MicroPropsGenerator, public MultiplierProducer {
   public:
     ScientificHandler(const Notation *notation, const DecimalFormatSymbols *symbols,
                       const MicroPropsGenerator *parent);
index d652c523de80b7d1a53871dd7a3fa6c7478ddfee..b6ade0a4e2530dadf9a1a5bd57aafe72c4999c31 100644 (file)
@@ -94,7 +94,8 @@ enum CompactType {
 
 
 // TODO: Should this be moved somewhere else, maybe where other ICU classes can use it?
-class CharSequence {
+// Exported as U_I18N_API because it is a base class for other exported types
+class U_I18N_API CharSequence {
 public:
     virtual ~CharSequence() = default;
 
@@ -147,6 +148,8 @@ class U_I18N_API AffixPatternProvider {
  *
  * A Modifier is usually immutable, except in cases such as {@link MurkyModifier}, which are mutable for performance
  * reasons.
+ *
+ * Exported as U_I18N_API because it is a base class for other exported types
  */
 class U_I18N_API Modifier {
   public:
@@ -205,7 +208,7 @@ class U_I18N_API Modifier {
  * quantity-dependent. Each element in the linked list calls {@link #processQuantity} on its "parent", then does its
  * work, and then returns the result.
  *
- * @author sffc
+ * Exported as U_I18N_API because it is a base class for other exported types
  *
  */
 class U_I18N_API MicroPropsGenerator {
@@ -231,8 +234,9 @@ class MultiplierProducer {
     virtual int32_t getMultiplier(int32_t magnitude) const = 0;
 };
 
+// Exported as U_I18N_API because it is a public member field of exported DecimalFormatProperties
 template<typename T>
-class NullableValue {
+class U_I18N_API NullableValue {
   public:
     NullableValue() : fNull(true) {}
 
index 5b6719fc0fbc27c098169fbb7c9ed95255b52d4a..2127f9dd48c259a27fdf7e26cdb4628943d532be 100644 (file)
@@ -1818,7 +1818,9 @@ class U_I18N_API LocalizedNumberFormatter
     ~LocalizedNumberFormatter();
 
   private:
+#pragma warning(suppress: 4251)  // Member is private and does not need to be exported
     std::atomic<const impl::NumberFormatterImpl *> fCompiled{nullptr};
+#pragma warning(suppress: 4251)  // Member is private and does not need to be exported
     std::atomic<uint32_t> fCallCount{0};
 
     LocalizedNumberFormatter() = default;