intl/icu/source/i18n/winnmfmt.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 ********************************************************************************
michael@0 3 * Copyright (C) 2005-2013, International Business Machines
michael@0 4 * Corporation and others. All Rights Reserved.
michael@0 5 ********************************************************************************
michael@0 6 *
michael@0 7 * File WINNMFMT.H
michael@0 8 *
michael@0 9 ********************************************************************************
michael@0 10 */
michael@0 11
michael@0 12 #ifndef __WINNMFMT
michael@0 13 #define __WINNMFMT
michael@0 14
michael@0 15 #include "unicode/utypes.h"
michael@0 16
michael@0 17 #if U_PLATFORM_USES_ONLY_WIN32_API
michael@0 18
michael@0 19 #include "unicode/format.h"
michael@0 20 #include "unicode/datefmt.h"
michael@0 21 #include "unicode/calendar.h"
michael@0 22 #include "unicode/ustring.h"
michael@0 23 #include "unicode/locid.h"
michael@0 24
michael@0 25 #if !UCONFIG_NO_FORMATTING
michael@0 26
michael@0 27 /**
michael@0 28 * \file
michael@0 29 * \brief C++ API: Format numbers using Windows API.
michael@0 30 */
michael@0 31
michael@0 32 U_NAMESPACE_BEGIN
michael@0 33
michael@0 34 union FormatInfo;
michael@0 35
michael@0 36 class Win32NumberFormat : public NumberFormat
michael@0 37 {
michael@0 38 public:
michael@0 39 Win32NumberFormat(const Locale &locale, UBool currency, UErrorCode &status);
michael@0 40
michael@0 41 Win32NumberFormat(const Win32NumberFormat &other);
michael@0 42
michael@0 43 virtual ~Win32NumberFormat();
michael@0 44
michael@0 45 virtual Format *clone(void) const;
michael@0 46
michael@0 47 Win32NumberFormat &operator=(const Win32NumberFormat &other);
michael@0 48
michael@0 49 /**
michael@0 50 * Format a double number. Concrete subclasses must implement
michael@0 51 * these pure virtual methods.
michael@0 52 *
michael@0 53 * @param number The value to be formatted.
michael@0 54 * @param appendTo Output parameter to receive result.
michael@0 55 * Result is appended to existing contents.
michael@0 56 * @param pos On input: an alignment field, if desired.
michael@0 57 * On output: the offsets of the alignment field.
michael@0 58 * @return Reference to 'appendTo' parameter.
michael@0 59 */
michael@0 60 virtual UnicodeString& format(double number,
michael@0 61 UnicodeString& appendTo,
michael@0 62 FieldPosition& pos) const;
michael@0 63 /**
michael@0 64 * Format a long number. Concrete subclasses must implement
michael@0 65 * these pure virtual methods.
michael@0 66 *
michael@0 67 * @param number The value to be formatted.
michael@0 68 * @param appendTo Output parameter to receive result.
michael@0 69 * Result is appended to existing contents.
michael@0 70 * @param pos On input: an alignment field, if desired.
michael@0 71 * On output: the offsets of the alignment field.
michael@0 72 * @return Reference to 'appendTo' parameter.
michael@0 73 */
michael@0 74 virtual UnicodeString& format(int32_t number,
michael@0 75 UnicodeString& appendTo,
michael@0 76 FieldPosition& pos) const;
michael@0 77
michael@0 78 /**
michael@0 79 * Format an int64 number.
michael@0 80 *
michael@0 81 * @param number The value to be formatted.
michael@0 82 * @param appendTo Output parameter to receive result.
michael@0 83 * Result is appended to existing contents.
michael@0 84 * @param pos On input: an alignment field, if desired.
michael@0 85 * On output: the offsets of the alignment field.
michael@0 86 * @return Reference to 'appendTo' parameter.
michael@0 87 */
michael@0 88 virtual UnicodeString& format(int64_t number,
michael@0 89 UnicodeString& appendTo,
michael@0 90 FieldPosition& pos) const;
michael@0 91
michael@0 92 // Use the default behavior for the following.
michael@0 93 // virtual UnicodeString &format(double number, UnicodeString &appendTo) const;
michael@0 94 // virtual UnicodeString &format(int32_t number, UnicodeString &appendTo) const;
michael@0 95 // virtual UnicodeString &format(int64_t number, UnicodeString &appendTo) const;
michael@0 96
michael@0 97 virtual void parse(const UnicodeString& text, Formattable& result, ParsePosition& parsePosition) const;
michael@0 98
michael@0 99 /**
michael@0 100 * Sets the maximum number of digits allowed in the fraction portion of a
michael@0 101 * number. maximumFractionDigits must be >= minimumFractionDigits. If the
michael@0 102 * new value for maximumFractionDigits is less than the current value
michael@0 103 * of minimumFractionDigits, then minimumFractionDigits will also be set to
michael@0 104 * the new value.
michael@0 105 * @param newValue the new value to be set.
michael@0 106 * @see getMaximumFractionDigits
michael@0 107 */
michael@0 108 virtual void setMaximumFractionDigits(int32_t newValue);
michael@0 109
michael@0 110 /**
michael@0 111 * Sets the minimum number of digits allowed in the fraction portion of a
michael@0 112 * number. minimumFractionDigits must be &lt;= maximumFractionDigits. If the
michael@0 113 * new value for minimumFractionDigits exceeds the current value
michael@0 114 * of maximumFractionDigits, then maximumIntegerDigits will also be set to
michael@0 115 * the new value
michael@0 116 * @param newValue the new value to be set.
michael@0 117 * @see getMinimumFractionDigits
michael@0 118 */
michael@0 119 virtual void setMinimumFractionDigits(int32_t newValue);
michael@0 120
michael@0 121 /**
michael@0 122 * Return the class ID for this class. This is useful only for comparing to
michael@0 123 * a return value from getDynamicClassID(). For example:
michael@0 124 * <pre>
michael@0 125 * . Base* polymorphic_pointer = createPolymorphicObject();
michael@0 126 * . if (polymorphic_pointer->getDynamicClassID() ==
michael@0 127 * . erived::getStaticClassID()) ...
michael@0 128 * </pre>
michael@0 129 * @return The class ID for all objects of this class.
michael@0 130 */
michael@0 131 U_I18N_API static UClassID U_EXPORT2 getStaticClassID(void);
michael@0 132
michael@0 133 /**
michael@0 134 * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
michael@0 135 * method is to implement a simple version of RTTI, since not all C++
michael@0 136 * compilers support genuine RTTI. Polymorphic operator==() and clone()
michael@0 137 * methods call this method.
michael@0 138 *
michael@0 139 * @return The class ID for this object. All objects of a
michael@0 140 * given class have the same class ID. Objects of
michael@0 141 * other classes have different class IDs.
michael@0 142 */
michael@0 143 virtual UClassID getDynamicClassID(void) const;
michael@0 144
michael@0 145 private:
michael@0 146 UnicodeString &format(int32_t numDigits, UnicodeString &appendTo, wchar_t *format, ...) const;
michael@0 147
michael@0 148 UBool fCurrency;
michael@0 149 Locale fLocale;
michael@0 150 int32_t fLCID;
michael@0 151 FormatInfo *fFormatInfo;
michael@0 152 UBool fFractionDigitsSet;
michael@0 153
michael@0 154 };
michael@0 155
michael@0 156 U_NAMESPACE_END
michael@0 157
michael@0 158 #endif /* #if !UCONFIG_NO_FORMATTING */
michael@0 159
michael@0 160 #endif // U_PLATFORM_USES_ONLY_WIN32_API
michael@0 161
michael@0 162 #endif // __WINNMFMT

mercurial