tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

number_scientific.h (1787B)


      1 // © 2017 and later: Unicode, Inc. and others.
      2 // License & terms of use: http://www.unicode.org/copyright.html
      3 
      4 #include "unicode/utypes.h"
      5 
      6 #if !UCONFIG_NO_FORMATTING
      7 #ifndef __NUMBER_SCIENTIFIC_H__
      8 #define __NUMBER_SCIENTIFIC_H__
      9 
     10 #include "number_types.h"
     11 
     12 U_NAMESPACE_BEGIN
     13 namespace number::impl {
     14 
     15 // Forward-declare
     16 class ScientificHandler;
     17 
     18 class U_I18N_API ScientificModifier : public UMemory, public Modifier {
     19  public:
     20    ScientificModifier();
     21 
     22    void set(int32_t exponent, const ScientificHandler *handler);
     23 
     24    int32_t apply(FormattedStringBuilder &output, int32_t leftIndex, int32_t rightIndex,
     25                  UErrorCode &status) const override;
     26 
     27    int32_t getPrefixLength() const override;
     28 
     29    int32_t getCodePointCount() const override;
     30 
     31    bool isStrong() const override;
     32 
     33    bool containsField(Field field) const override;
     34 
     35    void getParameters(Parameters& output) const override;
     36 
     37    bool strictEquals(const Modifier& other) const override;
     38 
     39  private:
     40    int32_t fExponent;
     41    const ScientificHandler *fHandler;
     42 };
     43 
     44 class ScientificHandler : public UMemory, public MicroPropsGenerator, public MultiplierProducer {
     45  public:
     46    ScientificHandler(const Notation *notation, const DecimalFormatSymbols *symbols,
     47                      const MicroPropsGenerator *parent);
     48 
     49    void
     50    processQuantity(DecimalQuantity &quantity, MicroProps &micros, UErrorCode &status) const override;
     51 
     52    int32_t getMultiplier(int32_t magnitude) const override;
     53 
     54  private:
     55    const Notation::ScientificSettings fSettings;
     56    const DecimalFormatSymbols *fSymbols;
     57    const MicroPropsGenerator *fParent;
     58 
     59    friend class ScientificModifier;
     60 };
     61 
     62 } // namespace number::impl
     63 U_NAMESPACE_END
     64 
     65 #endif //__NUMBER_SCIENTIFIC_H__
     66 
     67 #endif /* #if !UCONFIG_NO_FORMATTING */