1999-12-28 23:57:50 +00:00
|
|
|
/*
|
|
|
|
********************************************************************************
|
2005-06-22 22:39:36 +00:00
|
|
|
* Copyright (C) 1997-2005, International Business Machines
|
1999-12-28 23:57:50 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
********************************************************************************
|
|
|
|
*
|
|
|
|
* File CHOICFMT.H
|
|
|
|
*
|
|
|
|
* Modification History:
|
|
|
|
*
|
|
|
|
* Date Name Description
|
|
|
|
* 02/19/97 aliu Converted from java.
|
|
|
|
* 03/20/97 helena Finished first cut of implementation and got rid
|
|
|
|
* of nextDouble/previousDouble and replaced with
|
|
|
|
* boolean array.
|
|
|
|
* 4/10/97 aliu Clean up. Modified to work on AIX.
|
|
|
|
* 8/6/97 nos Removed overloaded constructor, member var 'buffer'.
|
2003-05-10 00:17:35 +00:00
|
|
|
* 07/22/98 stephen Removed operator!= (implemented in Format)
|
1999-12-28 23:57:50 +00:00
|
|
|
********************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CHOICFMT_H
|
|
|
|
#define CHOICFMT_H
|
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
2002-09-20 01:54:48 +00:00
|
|
|
|
2005-06-22 22:39:36 +00:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* \brief C++ API: Choice Format.
|
|
|
|
*/
|
|
|
|
|
2002-09-20 01:54:48 +00:00
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/unistr.h"
|
|
|
|
#include "unicode/numfmt.h"
|
|
|
|
#include "unicode/fieldpos.h"
|
|
|
|
#include "unicode/format.h"
|
2001-10-08 23:26:58 +00:00
|
|
|
|
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
class MessageFormat;
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
2002-12-12 01:23:05 +00:00
|
|
|
* ChoiceFormat converts between ranges of numeric values
|
2001-06-11 17:21:09 +00:00
|
|
|
* and string names for those ranges. A <code>ChoiceFormat</code> splits
|
|
|
|
* the real number line <code>-Inf</code> to <code>+Inf</code> into two
|
|
|
|
* or more contiguous ranges. Each range is mapped to a
|
|
|
|
* string. <code>ChoiceFormat</code> is generally used in a
|
|
|
|
* <code>MessageFormat</code> for displaying grammatically correct
|
|
|
|
* plurals such as "There are 2 files."</p>
|
|
|
|
*
|
|
|
|
* <p>There are two methods of defining a <code>ChoiceFormat</code>; both
|
|
|
|
* are equivalent. The first is by using a string pattern. This is the
|
|
|
|
* preferred method in most cases. The second method is through direct
|
|
|
|
* specification of the arrays that make up the
|
|
|
|
* <code>ChoiceFormat</code>.</p>
|
|
|
|
*
|
|
|
|
* <p><strong>Patterns</strong></p>
|
|
|
|
*
|
|
|
|
* <p>In most cases, the preferred way to define a
|
|
|
|
* <code>ChoiceFormat</code> is with a pattern. Here is an example of a
|
|
|
|
* <code>ChoiceFormat</code> pattern:</p>
|
2003-05-27 23:48:09 +00:00
|
|
|
*
|
|
|
|
* \htmlonly<pre> 0≤are no files|1≤is one file|1<are many files</pre>\endhtmlonly
|
|
|
|
*
|
|
|
|
* <p>or equivalently,</p>
|
2001-06-11 17:21:09 +00:00
|
|
|
*
|
2005-06-28 19:10:48 +00:00
|
|
|
* \htmlonly<pre> 0#are no files|1#is one file|1<are many files</pre>\endhtmlonly
|
2001-06-11 17:21:09 +00:00
|
|
|
*
|
|
|
|
* <p>The pattern consists of a number or <em>range specifiers</em>
|
2003-05-27 23:48:09 +00:00
|
|
|
* separated by vertical bars '|' (U+007C). There is no
|
2001-06-11 17:21:09 +00:00
|
|
|
* vertical bar after the last range. Each range specifier is of the
|
2003-05-27 23:48:09 +00:00
|
|
|
* form:</p>
|
|
|
|
*
|
|
|
|
* \htmlonly<blockquote><em>Number Separator String</em></blockquote>\endhtmlonly
|
2001-06-11 17:21:09 +00:00
|
|
|
*
|
|
|
|
* <p><em>Number</em> is a floating point number that can be parsed by a
|
|
|
|
* default <code>NumberFormat</code> for the US locale. It gives the
|
|
|
|
* lower limit of this range. The lower limit is either inclusive or
|
2003-05-27 23:48:09 +00:00
|
|
|
* exclusive, depending on the <em>separator</em>. The upper limit is
|
|
|
|
* given by the lower limit of the next range. The Unicode infinity
|
|
|
|
* sign \htmlonly∞ \endhtmlonly (U+221E) is recognized for positive infinity. It may be preceded by
|
|
|
|
* '-' (U+002D) to indicate negative infinity.</p>
|
2001-06-11 17:21:09 +00:00
|
|
|
*
|
|
|
|
* <p><em>String</em> is the format string for this range, with special
|
|
|
|
* characters enclosed in single quotes (<code>'The #
|
|
|
|
* sign'</code>). Single quotes themselves are indicated by two single
|
|
|
|
* quotes in a row (<code>'o''clock'</code>).</p>
|
|
|
|
*
|
|
|
|
* <p><em>Separator</em> is one of the following single characters:
|
|
|
|
*
|
|
|
|
* <ul>
|
2003-05-27 23:48:09 +00:00
|
|
|
* <li>\htmlonly'≤' \endhtmlonly (U+2264) or '#' (U+0023)
|
|
|
|
* indicates that the lower limit given by <em>Number</em> is
|
|
|
|
* inclusive. (The two characters are equivalent to ChoiceFormat.)
|
|
|
|
* This means that the limit value <em>Number</em> belongs to this
|
|
|
|
* range. Another way of saying this is that the corresponding
|
|
|
|
* closure is <code>FALSE</code>.</li>
|
|
|
|
*
|
|
|
|
* <li>'<' (U+003C) indicates that the lower limit given by
|
|
|
|
* <em>Number</em> is exclusive. This means that the value
|
|
|
|
* <em>Number</em> belongs to the prior range.</li> Another way of
|
|
|
|
* saying this is that the corresponding closure is
|
|
|
|
* <code>TRUE</code>.
|
2001-06-11 17:21:09 +00:00
|
|
|
* </ul>
|
|
|
|
*
|
|
|
|
* <p>See below for more information about closures.</p>
|
|
|
|
*
|
|
|
|
* <p><strong>Arrays</strong></p>
|
|
|
|
*
|
|
|
|
* <p>A <code>ChoiceFormat</code> defining <code>n</code> intervals
|
|
|
|
* (<code>n</code> >= 2) is specified by three arrays of
|
|
|
|
* <code>n</code> items:
|
|
|
|
*
|
|
|
|
* <ul>
|
|
|
|
* <li><code>double limits[]</code> gives the start of each
|
|
|
|
* interval. This must be a non-decreasing list of values, none of
|
|
|
|
* which may be <code>NaN</code>.</li>
|
|
|
|
* <li><code>UBool closures[]</code> determines whether each limit
|
|
|
|
* value is contained in the interval below it or in the interval
|
|
|
|
* above it. If <code>closures[i]</code> is <code>FALSE</code>, then
|
|
|
|
* <code>limits[i]</code> is a member of interval
|
|
|
|
* <code>i</code>. Otherwise it is a member of interval
|
|
|
|
* <code>i+1</code>. If no closures array is specified, this is
|
|
|
|
* equivalent to having all closures be <code>FALSE</code>. Closures
|
|
|
|
* allow one to specify half-open, open, or closed intervals.</li>
|
|
|
|
* <li><code>UnicodeString formats[]</code> gives the string label
|
|
|
|
* associated with each interval.</li>
|
|
|
|
* </ul>
|
|
|
|
*
|
|
|
|
* <p><strong>Formatting and Parsing</strong></p>
|
|
|
|
*
|
|
|
|
* <p>During formatting, a number is converted to a
|
|
|
|
* string. <code>ChoiceFormat</code> accomplishes this by mapping the
|
|
|
|
* number to an interval using the following rule. Given a number
|
|
|
|
* <code>X</code> and and index value <code>j</code> in the range
|
|
|
|
* <code>0..n-1</code>, where <code>n</code> is the number of ranges:</p>
|
|
|
|
*
|
2004-06-15 22:32:41 +00:00
|
|
|
* \htmlonly<blockquote>\endhtmlonly<code>X</code> matches <code>j</code> if and only if
|
2001-06-11 17:21:09 +00:00
|
|
|
* <code>limit[j] <= X < limit[j+1]</code>
|
2004-06-15 22:32:41 +00:00
|
|
|
* \htmlonly</blockquote>\endhtmlonly
|
2001-06-11 17:21:09 +00:00
|
|
|
*
|
|
|
|
* <p>(This assumes that all closures are <code>FALSE</code>. If some
|
|
|
|
* closures are <code>TRUE</code> then the relations must be changed to
|
|
|
|
* <code><=</code> or <code><</code> as appropriate.) If there is
|
|
|
|
* no match, then either the first or last index is used, depending on
|
|
|
|
* whether the number is too low or too high. Once a number is mapped to
|
|
|
|
* an interval <code>j</code>, the string <code>formats[j]</code> is
|
|
|
|
* output.</p>
|
|
|
|
*
|
|
|
|
* <p>During parsing, a string is converted to a
|
|
|
|
* number. <code>ChoiceFormat</code> finds the element
|
|
|
|
* <code>formats[j]</code> equal to the string, and returns
|
|
|
|
* <code>limits[j]</code> as the parsed value.</p>
|
|
|
|
*
|
|
|
|
* <p><strong>Notes</strong></p>
|
|
|
|
*
|
|
|
|
* <p>The first limit value does not define a range boundary. For
|
2005-06-28 19:10:48 +00:00
|
|
|
* example, in the pattern \htmlonly"<code>1.0#a|2.0#b</code>"\endhtmlonly, the
|
2001-06-11 17:21:09 +00:00
|
|
|
* intervals are [-Inf, 2.0) and [2.0, +Inf]. It appears that the first
|
|
|
|
* interval should be [1.0, 2.0). However, since all values that are too
|
|
|
|
* small are mapped to range zero, the first interval is effectively
|
|
|
|
* [-Inf, 2.0). However, the first limit value <em>is</em> used during
|
|
|
|
* formatting. In this example, <code>parse("a")</code> returns
|
|
|
|
* 1.0.</p>
|
|
|
|
*
|
|
|
|
* <p>There are no gaps between intervals and the entire number line is
|
|
|
|
* covered. A <code>ChoiceFormat</code> maps <em>all</em> possible
|
|
|
|
* double values to a finite set of intervals.</p>
|
|
|
|
*
|
|
|
|
* <p>The non-number <code>NaN</code> is mapped to interval zero during
|
|
|
|
* formatting.</p>
|
|
|
|
*
|
|
|
|
* <p><strong>Examples</strong></p>
|
|
|
|
*
|
|
|
|
* <p>Here is an example of two arrays that map the number
|
|
|
|
* <code>1..7</code> to the English day of the week abbreviations
|
|
|
|
* <code>Sun..Sat</code>. No closures array is given; this is the same as
|
|
|
|
* specifying all closures to be <code>FALSE</code>.</p>
|
|
|
|
*
|
|
|
|
* <pre> {1,2,3,4,5,6,7},
|
|
|
|
* {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"}</pre>
|
|
|
|
*
|
|
|
|
* <p>Here is an example that maps the ranges [-Inf, 1), [1, 1], and (1,
|
|
|
|
* +Inf] to three strings. That is, the number line is split into three
|
|
|
|
* ranges: x < 1.0, x = 1.0, and x > 1.0.</p>
|
|
|
|
*
|
|
|
|
* <pre> {0, 1, 1},
|
|
|
|
* {FALSE, FALSE, TRUE},
|
|
|
|
* {"no files", "one file", "many files"}</pre>
|
|
|
|
*
|
|
|
|
* <p>Here is a simple example that shows formatting and parsing: </p>
|
|
|
|
*
|
2000-12-08 18:46:55 +00:00
|
|
|
* \code
|
2003-05-27 23:48:09 +00:00
|
|
|
* #include <unicode/choicfmt.h>
|
|
|
|
* #include <unicode/unistr.h>
|
|
|
|
* #include <iostream.h>
|
2001-06-11 17:21:09 +00:00
|
|
|
*
|
|
|
|
* int main(int argc, char *argv[]) {
|
2000-12-08 18:46:55 +00:00
|
|
|
* double limits[] = {1,2,3,4,5,6,7};
|
2001-06-11 17:21:09 +00:00
|
|
|
* UnicodeString monthNames[] = {
|
2003-05-27 23:48:09 +00:00
|
|
|
* "Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
|
2001-06-11 17:21:09 +00:00
|
|
|
* ChoiceFormat fmt(limits, monthNames, 7);
|
2000-12-08 18:46:55 +00:00
|
|
|
* UnicodeString str;
|
2001-06-11 17:21:09 +00:00
|
|
|
* char buf[256];
|
2003-05-27 23:48:09 +00:00
|
|
|
* for (double x = 1.0; x <= 8.0; x += 1.0) {
|
2001-06-11 17:21:09 +00:00
|
|
|
* fmt.format(x, str);
|
2003-05-27 23:48:09 +00:00
|
|
|
* str.extract(0, str.length(), buf, 256, "");
|
2001-06-11 17:21:09 +00:00
|
|
|
* str.truncate(0);
|
2003-05-27 23:48:09 +00:00
|
|
|
* cout << x << " -> "
|
|
|
|
* << buf << endl;
|
2000-12-08 18:46:55 +00:00
|
|
|
* }
|
2003-05-27 23:48:09 +00:00
|
|
|
* cout << endl;
|
2001-06-11 17:21:09 +00:00
|
|
|
* return 0;
|
2000-12-08 18:46:55 +00:00
|
|
|
* }
|
|
|
|
* \endcode
|
2001-06-11 17:21:09 +00:00
|
|
|
*
|
|
|
|
* <p>Here is a more complex example using a <code>ChoiceFormat</code>
|
|
|
|
* constructed from a pattern together with a
|
|
|
|
* <code>MessageFormat</code>.</p>
|
|
|
|
*
|
2000-12-08 18:46:55 +00:00
|
|
|
* \code
|
2003-05-27 23:48:09 +00:00
|
|
|
* #include <unicode/choicfmt.h>
|
|
|
|
* #include <unicode/msgfmt.h>
|
|
|
|
* #include <unicode/unistr.h>
|
|
|
|
* #include <iostream.h>
|
2001-06-11 17:21:09 +00:00
|
|
|
*
|
|
|
|
* int main(int argc, char *argv[]) {
|
|
|
|
* UErrorCode status = U_ZERO_ERROR;
|
2000-12-08 18:46:55 +00:00
|
|
|
* double filelimits[] = {0,1,2};
|
2001-06-11 17:21:09 +00:00
|
|
|
* UnicodeString filepart[] =
|
2003-05-27 23:48:09 +00:00
|
|
|
* {"are no files","is one file","are {0} files"};
|
2000-12-08 18:46:55 +00:00
|
|
|
* ChoiceFormat* fileform = new ChoiceFormat(filelimits, filepart, 3 );
|
2001-06-11 17:21:09 +00:00
|
|
|
* Format* testFormats[] =
|
|
|
|
* {fileform, NULL, NumberFormat::createInstance(status)};
|
2003-05-27 23:48:09 +00:00
|
|
|
* MessageFormat pattform("There {0} on {1}", status );
|
2001-06-11 17:21:09 +00:00
|
|
|
* pattform.adoptFormats(testFormats, 3);
|
2003-05-27 23:48:09 +00:00
|
|
|
* Formattable testArgs[] = {0L, "Disk A"};
|
2000-12-08 18:46:55 +00:00
|
|
|
* FieldPosition fp(0);
|
|
|
|
* UnicodeString str;
|
2001-06-11 17:21:09 +00:00
|
|
|
* char buf[256];
|
2003-05-27 23:48:09 +00:00
|
|
|
* for (int32_t i = 0; i < 4; ++i) {
|
2000-12-08 18:46:55 +00:00
|
|
|
* Formattable fInt(i);
|
|
|
|
* testArgs[0] = fInt;
|
2001-06-11 17:21:09 +00:00
|
|
|
* pattform.format(testArgs, 2, str, fp, status );
|
2003-05-27 23:48:09 +00:00
|
|
|
* str.extract(0, str.length(), buf, "");
|
2001-06-11 17:21:09 +00:00
|
|
|
* str.truncate(0);
|
2003-05-27 23:48:09 +00:00
|
|
|
* cout << "Output for i=" << i << " : " << buf << endl;
|
2000-12-08 18:46:55 +00:00
|
|
|
* }
|
2003-05-27 23:48:09 +00:00
|
|
|
* cout << endl;
|
2001-06-11 17:21:09 +00:00
|
|
|
* return 0;
|
2000-12-08 18:46:55 +00:00
|
|
|
* }
|
|
|
|
* \endcode
|
2004-04-01 19:05:57 +00:00
|
|
|
*
|
|
|
|
* <p><em>User subclasses are not supported.</em> While clients may write
|
|
|
|
* subclasses, such code will not necessarily work and will not be
|
|
|
|
* guaranteed to work stably from release to release.
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
class U_I18N_API ChoiceFormat: public NumberFormat {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Construct a new ChoiceFormat with the limits and the corresponding formats
|
|
|
|
* based on the pattern.
|
|
|
|
*
|
|
|
|
* @param pattern Pattern used to construct object.
|
|
|
|
* @param status Output param to receive success code. If the
|
|
|
|
* pattern cannot be parsed, set to failure code.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
2003-05-10 00:17:35 +00:00
|
|
|
ChoiceFormat(const UnicodeString& pattern,
|
1999-12-28 23:57:50 +00:00
|
|
|
UErrorCode& status);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new ChoiceFormat with the given limits and formats. Copy
|
|
|
|
* the limits and formats instead of adopting them.
|
|
|
|
*
|
|
|
|
* @param limits Array of limit values.
|
|
|
|
* @param formats Array of formats.
|
|
|
|
* @param count Size of 'limits' and 'formats' arrays.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
ChoiceFormat(const double* limits,
|
|
|
|
const UnicodeString* formats,
|
|
|
|
int32_t count );
|
|
|
|
|
2001-06-11 17:21:09 +00:00
|
|
|
/**
|
|
|
|
* Construct a new ChoiceFormat with the given limits and formats.
|
|
|
|
* Copy the limits and formats (instead of adopting them). By
|
|
|
|
* default, each limit in the array specifies the inclusive lower
|
|
|
|
* bound of its range, and the exclusive upper bound of the previous
|
|
|
|
* range. However, if the isLimitOpen element corresponding to a
|
|
|
|
* limit is TRUE, then the limit is the exclusive lower bound of its
|
|
|
|
* range, and the inclusive upper bound of the previous range.
|
|
|
|
* @param limits Array of limit values
|
|
|
|
* @param closures Array of booleans specifying whether each
|
|
|
|
* element of 'limits' is open or closed. If FALSE, then the
|
|
|
|
* corresponding limit is a member of the range above it. If TRUE,
|
|
|
|
* then the limit belongs to the range below it.
|
|
|
|
* @param formats Array of formats
|
|
|
|
* @param count Size of 'limits', 'closures', and 'formats' arrays
|
2004-03-26 19:42:04 +00:00
|
|
|
* @stable ICU 2.4
|
2001-06-11 17:21:09 +00:00
|
|
|
*/
|
|
|
|
ChoiceFormat(const double* limits,
|
|
|
|
const UBool* closures,
|
|
|
|
const UnicodeString* formats,
|
|
|
|
int32_t count);
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
|
|
|
* Copy constructor.
|
2002-07-01 11:04:45 +00:00
|
|
|
*
|
2003-05-10 00:17:35 +00:00
|
|
|
* @param that ChoiceFormat object to be copied from
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
2003-05-10 00:17:35 +00:00
|
|
|
ChoiceFormat(const ChoiceFormat& that);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Assignment operator.
|
2002-07-01 11:04:45 +00:00
|
|
|
*
|
2003-05-10 00:17:35 +00:00
|
|
|
* @param that ChoiceFormat object to be copied
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
2003-05-10 00:17:35 +00:00
|
|
|
const ChoiceFormat& operator=(const ChoiceFormat& that);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
virtual ~ChoiceFormat();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clone this Format object polymorphically. The caller owns the
|
|
|
|
* result and should delete it when done.
|
2002-07-01 11:04:45 +00:00
|
|
|
*
|
|
|
|
* @return a copy of this object
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
virtual Format* clone(void) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the given Format objects are semantically equal.
|
|
|
|
* Objects of different subclasses are considered unequal.
|
2002-07-01 11:04:45 +00:00
|
|
|
*
|
|
|
|
* @param other ChoiceFormat object to be compared
|
|
|
|
* @return true if other is the same as this.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
2000-05-18 22:08:39 +00:00
|
|
|
virtual UBool operator==(const Format& other) const;
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the pattern.
|
|
|
|
* @param pattern The pattern to be applied.
|
|
|
|
* @param status Output param set to success/failure code on
|
|
|
|
* exit. If the pattern is invalid, this will be
|
|
|
|
* set to a failure result.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
virtual void applyPattern(const UnicodeString& pattern,
|
|
|
|
UErrorCode& status);
|
|
|
|
|
2001-08-16 00:55:51 +00:00
|
|
|
/**
|
|
|
|
* Sets the pattern.
|
|
|
|
* @param pattern The pattern to be applied.
|
|
|
|
* @param parseError Struct to recieve information on position
|
|
|
|
* of error if an error is encountered
|
|
|
|
* @param status Output param set to success/failure code on
|
|
|
|
* exit. If the pattern is invalid, this will be
|
|
|
|
* set to a failure result.
|
2003-06-04 00:04:35 +00:00
|
|
|
* @stable ICU 2.0
|
2001-08-16 00:55:51 +00:00
|
|
|
*/
|
|
|
|
virtual void applyPattern(const UnicodeString& pattern,
|
|
|
|
UParseError& parseError,
|
|
|
|
UErrorCode& status);
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
|
|
|
* Gets the pattern.
|
2002-07-01 11:04:45 +00:00
|
|
|
*
|
|
|
|
* @param pattern Output param which will recieve the pattern
|
2002-11-23 01:11:50 +00:00
|
|
|
* Previous contents are deleted.
|
2002-07-01 11:04:45 +00:00
|
|
|
* @return A reference to 'pattern'
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
virtual UnicodeString& toPattern(UnicodeString &pattern) const;
|
|
|
|
|
2003-05-01 01:31:28 +00:00
|
|
|
#ifdef U_USE_CHOICE_FORMAT_DEPRECATES
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
|
|
|
* Set the choices to be used in formatting. The arrays are adopted and
|
|
|
|
* should not be deleted by the caller.
|
|
|
|
*
|
|
|
|
* @param limitsToAdopt Contains the top value that you want
|
|
|
|
* parsed with that format,and should be in
|
|
|
|
* ascending sorted order. When formatting X,
|
|
|
|
* the choice will be the i, where limit[i]
|
|
|
|
* <= X < limit[i+1].
|
|
|
|
* @param formatsToAdopt The format strings you want to use for each limit.
|
|
|
|
* @param count The size of the above arrays.
|
2002-12-09 17:22:54 +00:00
|
|
|
* @obsolete ICU 2.6. Use setChoices instead since this API will be removed in that release.
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
virtual void adoptChoices(double* limitsToAdopt,
|
|
|
|
UnicodeString* formatsToAdopt,
|
|
|
|
int32_t count );
|
|
|
|
|
2001-06-11 17:21:09 +00:00
|
|
|
/**
|
|
|
|
* Set the choices to be used in formatting. The arrays are adopted
|
|
|
|
* and should not be deleted by the caller. See class description
|
|
|
|
* for documenatation of the limits, closures, and formats arrays.
|
|
|
|
* @param limitsToAdopt Array of limits to adopt
|
|
|
|
* @param closuresToAdopt Array of limit booleans to adopt
|
|
|
|
* @param formatsToAdopt Array of format string to adopt
|
|
|
|
* @param count The size of the above arrays
|
2002-12-09 17:22:54 +00:00
|
|
|
* @obsolete ICU 2.6. Use setChoices instead since this API will be removed in that release.
|
2001-06-11 17:21:09 +00:00
|
|
|
*/
|
|
|
|
virtual void adoptChoices(double* limitsToAdopt,
|
|
|
|
UBool* closuresToAdopt,
|
|
|
|
UnicodeString* formatsToAdopt,
|
|
|
|
int32_t count);
|
2003-05-01 01:31:28 +00:00
|
|
|
#endif
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
|
|
|
* Set the choices to be used in formatting.
|
|
|
|
*
|
|
|
|
* @param limitsToCopy Contains the top value that you want
|
|
|
|
* parsed with that format,and should be in
|
|
|
|
* ascending sorted order. When formatting X,
|
|
|
|
* the choice will be the i, where limit[i]
|
|
|
|
* <= X < limit[i+1].
|
|
|
|
* @param formatsToCopy The format strings you want to use for each limit.
|
|
|
|
* @param count The size of the above arrays.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
virtual void setChoices(const double* limitsToCopy,
|
|
|
|
const UnicodeString* formatsToCopy,
|
|
|
|
int32_t count );
|
2001-06-11 17:21:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the choices to be used in formatting. See class description
|
|
|
|
* for documenatation of the limits, closures, and formats arrays.
|
|
|
|
* @param limits Array of limits
|
|
|
|
* @param closures Array of limit booleans
|
|
|
|
* @param formats Array of format string
|
|
|
|
* @param count The size of the above arrays
|
2004-03-26 19:42:04 +00:00
|
|
|
* @stable ICU 2.4
|
2001-06-11 17:21:09 +00:00
|
|
|
*/
|
|
|
|
virtual void setChoices(const double* limits,
|
|
|
|
const UBool* closures,
|
|
|
|
const UnicodeString* formats,
|
|
|
|
int32_t count);
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
/**
|
|
|
|
* Get the limits passed in the constructor.
|
2002-07-01 11:04:45 +00:00
|
|
|
*
|
|
|
|
* @param count The size of the limits arrays
|
1999-12-28 23:57:50 +00:00
|
|
|
* @return the limits.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
virtual const double* getLimits(int32_t& count) const;
|
2001-06-11 17:21:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the limit booleans passed in the constructor. The caller
|
|
|
|
* must not delete the result.
|
2002-07-01 11:04:45 +00:00
|
|
|
*
|
|
|
|
* @param count The size of the arrays
|
2001-06-11 17:21:09 +00:00
|
|
|
* @return the closures
|
2004-03-26 19:42:04 +00:00
|
|
|
* @stable ICU 2.4
|
2001-06-11 17:21:09 +00:00
|
|
|
*/
|
|
|
|
virtual const UBool* getClosures(int32_t& count) const;
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the formats passed in the constructor.
|
2002-07-01 11:04:45 +00:00
|
|
|
*
|
|
|
|
* @param count The size of the arrays
|
1999-12-28 23:57:50 +00:00
|
|
|
* @return the formats.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
virtual const UnicodeString* getFormats(int32_t& count) const;
|
|
|
|
|
2002-11-23 01:11:50 +00:00
|
|
|
/**
|
|
|
|
* Format a double or long number using this object's choices.
|
|
|
|
*
|
|
|
|
* @param number The value to be formatted.
|
|
|
|
* @param appendTo Output parameter to receive result.
|
|
|
|
* Result is appended to existing contents.
|
|
|
|
* @param pos On input: an alignment field, if desired.
|
|
|
|
* On output: the offsets of the alignment field.
|
|
|
|
* @return Reference to 'appendTo' parameter.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
2002-11-23 01:11:50 +00:00
|
|
|
*/
|
1999-12-28 23:57:50 +00:00
|
|
|
virtual UnicodeString& format(double number,
|
2002-11-23 01:11:50 +00:00
|
|
|
UnicodeString& appendTo,
|
1999-12-28 23:57:50 +00:00
|
|
|
FieldPosition& pos) const;
|
2002-11-23 01:11:50 +00:00
|
|
|
/**
|
|
|
|
* Format a int_32t number using this object's choices.
|
|
|
|
*
|
|
|
|
* @param number The value to be formatted.
|
|
|
|
* @param appendTo Output parameter to receive result.
|
|
|
|
* Result is appended to existing contents.
|
|
|
|
* @param pos On input: an alignment field, if desired.
|
|
|
|
* On output: the offsets of the alignment field.
|
|
|
|
* @return Reference to 'appendTo' parameter.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
2002-11-23 01:11:50 +00:00
|
|
|
*/
|
1999-12-28 23:57:50 +00:00
|
|
|
virtual UnicodeString& format(int32_t number,
|
2002-11-23 01:11:50 +00:00
|
|
|
UnicodeString& appendTo,
|
1999-12-28 23:57:50 +00:00
|
|
|
FieldPosition& pos) const;
|
2003-10-31 22:47:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Format an int64_t number using this object's choices.
|
|
|
|
*
|
|
|
|
* @param number The value to be formatted.
|
|
|
|
* @param appendTo Output parameter to receive result.
|
|
|
|
* Result is appended to existing contents.
|
|
|
|
* @param pos On input: an alignment field, if desired.
|
|
|
|
* On output: the offsets of the alignment field.
|
|
|
|
* @return Reference to 'appendTo' parameter.
|
2005-06-22 23:38:06 +00:00
|
|
|
* @stable ICU 2.8
|
2003-10-31 22:47:25 +00:00
|
|
|
*/
|
|
|
|
virtual UnicodeString& format(int64_t number,
|
|
|
|
UnicodeString& appendTo,
|
|
|
|
FieldPosition& pos) const;
|
|
|
|
|
2002-11-23 01:11:50 +00:00
|
|
|
/**
|
|
|
|
* Format an array of objects using this object's choices.
|
|
|
|
*
|
|
|
|
* @param objs The array of objects to be formatted.
|
|
|
|
* @param cnt The size of objs.
|
|
|
|
* @param appendTo Output parameter to receive result.
|
|
|
|
* Result is appended to existing contents.
|
|
|
|
* @param pos On input: an alignment field, if desired.
|
|
|
|
* On output: the offsets of the alignment field.
|
|
|
|
* @param success Output param set to success/failure code on
|
|
|
|
* exit.
|
|
|
|
* @return Reference to 'appendTo' parameter.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
2002-11-23 01:11:50 +00:00
|
|
|
*/
|
1999-12-28 23:57:50 +00:00
|
|
|
virtual UnicodeString& format(const Formattable* objs,
|
|
|
|
int32_t cnt,
|
2002-11-23 01:11:50 +00:00
|
|
|
UnicodeString& appendTo,
|
1999-12-28 23:57:50 +00:00
|
|
|
FieldPosition& pos,
|
|
|
|
UErrorCode& success) const;
|
2002-11-23 01:11:50 +00:00
|
|
|
/**
|
|
|
|
* Format an object using this object's choices.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param obj The object to be formatted.
|
|
|
|
* @param appendTo Output parameter to receive result.
|
|
|
|
* Result is appended to existing contents.
|
|
|
|
* @param pos On input: an alignment field, if desired.
|
|
|
|
* On output: the offsets of the alignment field.
|
|
|
|
* @param status Output param set to success/failure code on
|
|
|
|
* exit.
|
|
|
|
* @return Reference to 'appendTo' parameter.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
2002-11-23 01:11:50 +00:00
|
|
|
*/
|
1999-12-28 23:57:50 +00:00
|
|
|
virtual UnicodeString& format(const Formattable& obj,
|
2002-11-23 01:11:50 +00:00
|
|
|
UnicodeString& appendTo,
|
1999-12-28 23:57:50 +00:00
|
|
|
FieldPosition& pos,
|
|
|
|
UErrorCode& status) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Redeclared NumberFormat method.
|
2002-07-01 11:04:45 +00:00
|
|
|
*
|
2002-11-23 01:11:50 +00:00
|
|
|
* @param obj The object to be formatted.
|
|
|
|
* @param appendTo Output parameter to receive result.
|
|
|
|
* Result is appended to existing contents.
|
|
|
|
* @param status Output param set to success/failure code on
|
|
|
|
* exit.
|
|
|
|
* @return Reference to 'appendTo' parameter.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
UnicodeString& format(const Formattable& obj,
|
2002-11-23 01:11:50 +00:00
|
|
|
UnicodeString& appendTo,
|
1999-12-28 23:57:50 +00:00
|
|
|
UErrorCode& status) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Redeclared NumberFormat method.
|
2002-07-01 11:04:45 +00:00
|
|
|
* Format a double number. These methods call the NumberFormat
|
|
|
|
* pure virtual format() methods with the default FieldPosition.
|
|
|
|
*
|
|
|
|
* @param number The value to be formatted.
|
2002-11-23 01:11:50 +00:00
|
|
|
* @param appendTo Output parameter to receive result.
|
|
|
|
* Result is appended to existing contents.
|
|
|
|
* @return Reference to 'appendTo' parameter.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
UnicodeString& format( double number,
|
2002-11-23 01:11:50 +00:00
|
|
|
UnicodeString& appendTo) const;
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Redeclared NumberFormat method.
|
2002-07-01 11:04:45 +00:00
|
|
|
* Format a long number. These methods call the NumberFormat
|
|
|
|
* pure virtual format() methods with the default FieldPosition.
|
|
|
|
*
|
|
|
|
* @param number The value to be formatted.
|
2002-11-23 01:11:50 +00:00
|
|
|
* @param appendTo Output parameter to receive result.
|
|
|
|
* Result is appended to existing contents.
|
|
|
|
* @return Reference to 'appendTo' parameter.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
UnicodeString& format( int32_t number,
|
2002-11-23 01:11:50 +00:00
|
|
|
UnicodeString& appendTo) const;
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a long if possible (e.g. within range LONG_MAX,
|
|
|
|
* LONG_MAX], and with no decimals), otherwise a double. If
|
|
|
|
* IntegerOnly is set, will stop at a decimal point (or equivalent;
|
|
|
|
* e.g. for rational numbers "1 2/3", will stop after the 1).
|
|
|
|
* <P>
|
|
|
|
* If no object can be parsed, parsePosition is unchanged, and NULL is
|
|
|
|
* returned.
|
|
|
|
*
|
|
|
|
* @param text The text to be parsed.
|
|
|
|
* @param result Formattable to be set to the parse result.
|
|
|
|
* If parse fails, return contents are undefined.
|
|
|
|
* @param parsePosition The position to start parsing at on input.
|
|
|
|
* On output, moved to after the last successfully
|
|
|
|
* parse character. On parse failure, does not change.
|
|
|
|
* @see NumberFormat::isParseIntegerOnly
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
virtual void parse(const UnicodeString& text,
|
|
|
|
Formattable& result,
|
|
|
|
ParsePosition& parsePosition) const;
|
2002-07-01 11:04:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a long if possible (e.g. within range LONG_MAX,
|
|
|
|
* LONG_MAX], and with no decimals), otherwise a double. If
|
|
|
|
* IntegerOnly is set, will stop at a decimal point (or equivalent;
|
|
|
|
* e.g. for rational numbers "1 2/3", will stop after the 1).
|
|
|
|
* <P>
|
|
|
|
* If no object can be parsed, parsePosition is unchanged, and NULL is
|
|
|
|
* returned.
|
|
|
|
*
|
|
|
|
* @param text The text to be parsed.
|
|
|
|
* @param result Formattable to be set to the parse result.
|
|
|
|
* If parse fails, return contents are undefined.
|
|
|
|
* @param status Output param with the formatted string.
|
|
|
|
* @see NumberFormat::isParseIntegerOnly
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
2002-07-01 11:04:45 +00:00
|
|
|
*/
|
1999-12-28 23:57:50 +00:00
|
|
|
virtual void parse(const UnicodeString& text,
|
|
|
|
Formattable& result,
|
|
|
|
UErrorCode& status) const;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Returns a unique class ID POLYMORPHICALLY. Pure virtual override.
|
|
|
|
* This method is to implement a simple version of RTTI, since not all
|
|
|
|
* C++ compilers support genuine RTTI. Polymorphic operator==() and
|
|
|
|
* clone() methods call this method.
|
|
|
|
*
|
|
|
|
* @return The class ID for this object. All objects of a
|
|
|
|
* given class have the same class ID. Objects of
|
|
|
|
* other classes have different class IDs.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
|
|
|
virtual UClassID getDynamicClassID(void) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the class ID for this class. This is useful only for
|
|
|
|
* comparing to a return value from getDynamicClassID(). For example:
|
|
|
|
* <pre>
|
|
|
|
* . Base* polymorphic_pointer = createPolymorphicObject();
|
|
|
|
* . if (polymorphic_pointer->getDynamicClassID() ==
|
|
|
|
* . Derived::getStaticClassID()) ...
|
|
|
|
* </pre>
|
|
|
|
* @return The class ID for all objects of this class.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
2004-08-24 17:38:33 +00:00
|
|
|
static UClassID U_EXPORT2 getStaticClassID(void);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// static cache management (thread-safe)
|
2001-08-16 00:55:51 +00:00
|
|
|
// static NumberFormat* getNumberFormat(UErrorCode &status); // call this function to 'check out' a numberformat from the cache.
|
|
|
|
// static void releaseNumberFormat(NumberFormat *adopt); // call this function to 'return' the number format to the cache.
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts a string to a double value using a default NumberFormat object
|
|
|
|
* which is static (shared by all ChoiceFormat instances).
|
|
|
|
* @param string the string to be converted with.
|
|
|
|
* @return the converted double number.
|
|
|
|
*/
|
2001-08-17 21:50:48 +00:00
|
|
|
static double stod(const UnicodeString& string);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts a double value to a string using a default NumberFormat object
|
|
|
|
* which is static (shared by all ChoiceFormat instances).
|
2002-07-01 11:04:45 +00:00
|
|
|
* @param value the double number to be converted with.
|
|
|
|
* @param string the result string.
|
|
|
|
* @return the converted string.
|
1999-12-28 23:57:50 +00:00
|
|
|
*/
|
2001-08-17 21:50:48 +00:00
|
|
|
static UnicodeString& dtos(double value, UnicodeString& string);
|
1999-12-28 23:57:50 +00:00
|
|
|
|
2003-05-04 01:40:40 +00:00
|
|
|
ChoiceFormat(); // default constructor not implemented
|
|
|
|
|
2001-08-16 00:55:51 +00:00
|
|
|
/**
|
|
|
|
* Construct a new ChoiceFormat with the limits and the corresponding formats
|
|
|
|
* based on the pattern.
|
|
|
|
*
|
2002-07-01 11:04:45 +00:00
|
|
|
* @param newPattern Pattern used to construct object.
|
|
|
|
* @param parseError Struct to recieve information on position
|
|
|
|
* of error if an error is encountered.
|
|
|
|
* @param status Output param to receive success code. If the
|
|
|
|
* pattern cannot be parsed, set to failure code.
|
2002-12-04 23:46:16 +00:00
|
|
|
* @stable ICU 2.0
|
2001-08-16 00:55:51 +00:00
|
|
|
*/
|
|
|
|
ChoiceFormat(const UnicodeString& newPattern,
|
|
|
|
UParseError& parseError,
|
|
|
|
UErrorCode& status);
|
2001-06-11 17:21:09 +00:00
|
|
|
|
2001-08-16 00:55:51 +00:00
|
|
|
friend class MessageFormat;
|
2001-06-11 17:21:09 +00:00
|
|
|
/**
|
|
|
|
* Each ChoiceFormat divides the range -Inf..+Inf into fCount
|
|
|
|
* intervals. The intervals are:
|
|
|
|
*
|
|
|
|
* 0: fChoiceLimits[0]..fChoiceLimits[1]
|
|
|
|
* 1: fChoiceLimits[1]..fChoiceLimits[2]
|
|
|
|
* ...
|
|
|
|
* fCount-2: fChoiceLimits[fCount-2]..fChoiceLimits[fCount-1]
|
|
|
|
* fCount-1: fChoiceLimits[fCount-1]..+Inf
|
|
|
|
*
|
|
|
|
* Interval 0 is special; during formatting (mapping numbers to
|
|
|
|
* strings), it also contains all numbers less than
|
|
|
|
* fChoiceLimits[0], as well as NaN values.
|
|
|
|
*
|
|
|
|
* Interval i maps to and from string fChoiceFormats[i]. When
|
|
|
|
* parsing (mapping strings to numbers), then intervals map to
|
|
|
|
* their lower limit, that is, interval i maps to fChoiceLimit[i].
|
|
|
|
*
|
|
|
|
* The intervals may be closed, half open, or open. This affects
|
|
|
|
* formatting but does not affect parsing. Interval i is affected
|
|
|
|
* by fClosures[i] and fClosures[i+1]. If fClosures[i]
|
|
|
|
* is FALSE, then the value fChoiceLimits[i] is in interval i.
|
|
|
|
* That is, intervals i and i are:
|
|
|
|
*
|
|
|
|
* i-1: ... x < fChoiceLimits[i]
|
|
|
|
* i: fChoiceLimits[i] <= x ...
|
|
|
|
*
|
|
|
|
* If fClosures[i] is TRUE, then the value fChoiceLimits[i] is
|
|
|
|
* in interval i-1. That is, intervals i-1 and i are:
|
|
|
|
*
|
|
|
|
* i-1: ... x <= fChoiceLimits[i]
|
|
|
|
* i: fChoiceLimits[i] < x ...
|
|
|
|
*
|
|
|
|
* Because of the nature of interval 0, fClosures[0] has no
|
|
|
|
* effect.
|
|
|
|
|
|
|
|
*/
|
1999-12-28 23:57:50 +00:00
|
|
|
double* fChoiceLimits;
|
2001-06-11 17:21:09 +00:00
|
|
|
UBool* fClosures;
|
1999-12-28 23:57:50 +00:00
|
|
|
UnicodeString* fChoiceFormats;
|
|
|
|
int32_t fCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline UnicodeString&
|
|
|
|
ChoiceFormat::format(const Formattable& obj,
|
2002-11-23 01:11:50 +00:00
|
|
|
UnicodeString& appendTo,
|
1999-12-28 23:57:50 +00:00
|
|
|
UErrorCode& status) const {
|
|
|
|
// Don't use Format:: - use immediate base class only,
|
|
|
|
// in case immediate base modifies behavior later.
|
2002-11-23 01:11:50 +00:00
|
|
|
return NumberFormat::format(obj, appendTo, status);
|
1999-12-28 23:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline UnicodeString&
|
|
|
|
ChoiceFormat::format(double number,
|
2002-11-23 01:11:50 +00:00
|
|
|
UnicodeString& appendTo) const {
|
|
|
|
return NumberFormat::format(number, appendTo);
|
1999-12-28 23:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline UnicodeString&
|
|
|
|
ChoiceFormat::format(int32_t number,
|
2002-11-23 01:11:50 +00:00
|
|
|
UnicodeString& appendTo) const {
|
|
|
|
return NumberFormat::format(number, appendTo);
|
1999-12-28 23:57:50 +00:00
|
|
|
}
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_END
|
1999-12-28 23:57:50 +00:00
|
|
|
|
2002-09-20 01:54:48 +00:00
|
|
|
#endif /* #if !UCONFIG_NO_FORMATTING */
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#endif // _CHOICFMT
|
|
|
|
//eof
|