| choicfmt.h | | choicfmt.h | |
| /* | | /* | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
|
| * Copyright (C) 1997-2010, International Business Machines | | * Copyright (C) 1997-2011, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| * | | * | |
| * File CHOICFMT.H | | * File CHOICFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/19/97 aliu Converted from java. | | * 02/19/97 aliu Converted from java. | |
| * 03/20/97 helena Finished first cut of implementation and got ri
d | | * 03/20/97 helena Finished first cut of implementation and got ri
d | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 34 | |
| | | | |
| #include "unicode/utypes.h" | | #include "unicode/utypes.h" | |
| | | | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: Choice Format. | | * \brief C++ API: Choice Format. | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
|
| #include "unicode/unistr.h" | | | |
| #include "unicode/numfmt.h" | | | |
| #include "unicode/fieldpos.h" | | #include "unicode/fieldpos.h" | |
| #include "unicode/format.h" | | #include "unicode/format.h" | |
|
| | | #include "unicode/messagepattern.h" | |
| | | #include "unicode/numfmt.h" | |
| | | #include "unicode/unistr.h" | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| class MessageFormat; | | class MessageFormat; | |
| | | | |
| /** | | /** | |
|
| * ChoiceFormat converts between ranges of numeric values | | * ChoiceFormat converts between ranges of numeric values and strings for t | |
| * and string names for those ranges. A <code>ChoiceFormat</code> splits | | hose ranges. | |
| * the real number line <code>-Inf</code> to <code>+Inf</code> into two | | * The strings must conform to the MessageFormat pattern syntax. | |
| | | * | |
| | | * <p><em><code>ChoiceFormat</code> is probably not what you need. | |
| | | * Please use <code>MessageFormat</code> | |
| | | * with <code>plural</code> arguments for proper plural selection, | |
| | | * and <code>select</code> arguments for simple selection among a fixed set | |
| | | of choices!</em></p> | |
| | | * | |
| | | * <p>A <code>ChoiceFormat</code> splits | |
| | | * the real number line \htmlonly<code>-∞</code> to | |
| | | * <code>+∞</code>\endhtmlonly into two | |
| * or more contiguous ranges. Each range is mapped to a | | * or more contiguous ranges. Each range is mapped to a | |
|
| * string. <code>ChoiceFormat</code> is generally used in a | | * string.</p> | |
| * <code>MessageFormat</code> for displaying grammatically correct | | * | |
| * plurals such as "There are 2 files."</p> | | * <p><code>ChoiceFormat</code> was originally intended | |
| | | * for displaying grammatically correct | |
| | | * plurals such as "There is one file." vs. "There are 2 fil | |
| | | es." | |
| | | * <em>However,</em> plural rules for many languages | |
| | | * are too complex for the capabilities of ChoiceFormat, | |
| | | * and its requirement of specifying the precise rules for each message | |
| | | * is unmanageable for translators.</p> | |
| * | | * | |
| * <p>There are two methods of defining a <code>ChoiceFormat</code>; both | | * <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 | | * are equivalent. The first is by using a string pattern. This is the | |
| * preferred method in most cases. The second method is through direct | | * preferred method in most cases. The second method is through direct | |
|
| * specification of the arrays that make up the | | * specification of the arrays that logically make up the | |
| * <code>ChoiceFormat</code>.</p> | | * <code>ChoiceFormat</code>.</p> | |
| * | | * | |
|
| * <p><strong>Patterns</strong></p> | | * <p>Note: Typically, choice formatting is done (if done at all) via <code | |
| * | | >MessageFormat</code> | |
| * <p>In most cases, the preferred way to define a | | * with a <code>choice</code> argument type, | |
| * <code>ChoiceFormat</code> is with a pattern. Here is an example of a | | * rather than using a stand-alone <code>ChoiceFormat</code>.</p> | |
| * <code>ChoiceFormat</code> pattern:</p> | | | |
| * | | | |
| * \htmlonly<pre> 0≤are no files|1≤is one file|1<are ma | | | |
| ny files</pre>\endhtmlonly | | | |
| * | | | |
| * <p>or equivalently,</p> | | | |
| * | | | |
| * \htmlonly<pre> 0#are no files|1#is one file|1<are many files</pre> | | | |
| \endhtmlonly | | | |
| * | | | |
| * <p>The pattern consists of a number or <em>range specifiers</em> | | | |
| * separated by vertical bars '|' (U+007C). There is no | | | |
| * vertical bar after the last range. Each range specifier is of the | | | |
| * form:</p> | | | |
| * | | | |
| * \htmlonly<blockquote><em>Number Separator String</em></blockquote>\endht | | | |
| mlonly | | | |
| * | | | |
| * <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 | | | |
| * 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 i | | | |
| nfinity. It may be preceded by | | | |
| * '-' (U+002D) to indicate negative infinity.</p> | | | |
| * | | | |
| * <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> | | | |
| * <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>. | | | |
| * </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> | | | |
| * | | * | |
|
| * \htmlonly<blockquote>\endhtmlonly<code>X</code> matches <code>j</code> i | | * <h5>Patterns and Their Interpretation</h5> | |
| f and only if | | | |
| * <code>limit[j] <= X < limit[j+1]</code> | | | |
| * \htmlonly</blockquote>\endhtmlonly | | | |
| * | | * | |
|
| * <p>(This assumes that all closures are <code>FALSE</code>. If some | | * <p>The pattern string defines the range boundaries and the strings for e | |
| * closures are <code>TRUE</code> then the relations must be changed to | | ach number range. | |
| * <code><=</code> or <code><</code> as appropriate.) If there is | | * Syntax: | |
| * no match, then either the first or last index is used, depending on | | * <pre> | |
| * whether the number is too low or too high. Once a number is mapped to | | * choiceStyle = number separator message ('|' number separator message)* | |
| * an interval <code>j</code>, the string <code>formats[j]</code> is | | * number = normal_number | ['-'] \htmlonly∞\endhtmlonly (U+221E, in | |
| * output.</p> | | finity) | |
| | | * normal_number = double value (unlocalized ASCII string) | |
| | | * separator = less_than | less_than_or_equal | |
| | | * less_than = '<' | |
| | | * less_than_or_equal = '#' | \htmlonly≤\endhtmlonly (U+2264) | |
| | | * message: see {@link MessageFormat} | |
| | | * </pre> | |
| | | * Pattern_White_Space between syntax elements is ignored, except | |
| | | * around each range's sub-message.</p> | |
| * | | * | |
|
| * <p>During parsing, a string is converted to a | | * <p>Each numeric sub-range extends from the current range's number | |
| * number. <code>ChoiceFormat</code> finds the element | | * to the next range's number. | |
| * <code>formats[j]</code> equal to the string, and returns | | * The number itself is included in its range if a <code>less_than_or_equal | |
| * <code>limits[j]</code> as the parsed value.</p> | | </code> sign is used, | |
| | | * and excluded from its range (and instead included in the previous range) | |
| | | * if a <code>less_than</code> sign is used.</p> | |
| * | | * | |
|
| * <p><strong>Notes</strong></p> | | * <p>When a <code>ChoiceFormat</code> is constructed from | |
| | | * arrays of numbers, closure flags and strings, | |
| | | * they are interpreted just like | |
| | | * the sequence of <code>(number separator string)</code> in an equivalent | |
| | | pattern string. | |
| | | * <code>closure[i]==TRUE</code> corresponds to a <code>less_than</code> se | |
| | | parator sign. | |
| | | * The equivalent pattern string will be constructed automatically.</p> | |
| * | | * | |
|
| * <p>The first limit value does not define a range boundary. For | | * <p>During formatting, a number is mapped to the first range | |
| * example, in the pattern \htmlonly"<code>1.0#a|2.0#b</code>"\en | | * where the number is not greater than the range's upper limit. | |
| dhtmlonly, the | | * That range's message string is returned. A NaN maps to the very first ra | |
| * intervals are [-Inf, 2.0) and [2.0, +Inf]. It appears that the first | | nge.</p> | |
| * 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 | | * <p>During parsing, a range is selected for the longest match of | |
| * covered. A <code>ChoiceFormat</code> maps <em>all</em> possible | | * any range's message. That range's number is returned, ignoring the separ | |
| * double values to a finite set of intervals.</p> | | ator/closure. | |
| | | * Only a simple string match is performed, without parsing of arguments th | |
| | | at | |
| | | * might be specified in the message strings.</p> | |
| * | | * | |
|
| * <p>The non-number <code>NaN</code> is mapped to interval zero during | | * <p>Note that the first range's number is ignored in formatting | |
| * formatting.</p> | | * but may be returned from parsing.</p> | |
| * | | * | |
|
| * <p><strong>Examples</strong></p> | | * <h5>Examples</h5> | |
| * | | * | |
| * <p>Here is an example of two arrays that map the number | | * <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>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 | | * <code>Sun..Sat</code>. No closures array is given; this is the same as | |
| * specifying all closures to be <code>FALSE</code>.</p> | | * specifying all closures to be <code>FALSE</code>.</p> | |
| * | | * | |
| * <pre> {1,2,3,4,5,6,7}, | | * <pre> {1,2,3,4,5,6,7}, | |
| * {"Sun","Mon","Tue","Wed",&qu
ot;Thur","Fri","Sat"}</pre> | | * {"Sun","Mon","Tue","Wed",&qu
ot;Thur","Fri","Sat"}</pre> | |
| * | | * | |
| * <p>Here is an example that maps the ranges [-Inf, 1), [1, 1], and (1, | | * <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 | | * +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> | | * ranges: x < 1.0, x = 1.0, and x > 1.0. | |
| | | * (The round parentheses in the notation above indicate an exclusive bound | |
| | | ary, | |
| | | * like the turned bracket in European notation: [-Inf, 1) == [-Inf, 1[ )< | |
| | | /p> | |
| * | | * | |
| * <pre> {0, 1, 1}, | | * <pre> {0, 1, 1}, | |
| * {FALSE, FALSE, TRUE}, | | * {FALSE, FALSE, TRUE}, | |
| * {"no files", "one file", "many files"}
</pre> | | * {"no files", "one file", "many files"}
</pre> | |
| * | | * | |
|
| * <p>Here is a simple example that shows formatting and parsing: </p> | | * <p>Here is an example that shows formatting and parsing: </p> | |
| * | | * | |
| * \code | | * \code | |
| * #include <unicode/choicfmt.h> | | * #include <unicode/choicfmt.h> | |
| * #include <unicode/unistr.h> | | * #include <unicode/unistr.h> | |
| * #include <iostream.h> | | * #include <iostream.h> | |
| * | | * | |
| * int main(int argc, char *argv[]) { | | * int main(int argc, char *argv[]) { | |
| * double limits[] = {1,2,3,4,5,6,7}; | | * double limits[] = {1,2,3,4,5,6,7}; | |
| * UnicodeString monthNames[] = { | | * UnicodeString monthNames[] = { | |
| * "Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; | | * "Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; | |
| | | | |
| skipping to change at line 218 | | skipping to change at line 164 | |
| * str.extract(0, str.length(), buf, 256, ""); | | * str.extract(0, str.length(), buf, 256, ""); | |
| * str.truncate(0); | | * str.truncate(0); | |
| * cout << x << " -> " | | * cout << x << " -> " | |
| * << buf << endl; | | * << buf << endl; | |
| * } | | * } | |
| * cout << endl; | | * cout << endl; | |
| * return 0; | | * return 0; | |
| * } | | * } | |
| * \endcode | | * \endcode | |
| * | | * | |
|
| * <p>Here is a more complex example using a <code>ChoiceFormat</code> | | | |
| * constructed from a pattern together with a | | | |
| * <code>MessageFormat</code>.</p> | | | |
| * | | | |
| * \code | | | |
| * #include <unicode/choicfmt.h> | | | |
| * #include <unicode/msgfmt.h> | | | |
| * #include <unicode/unistr.h> | | | |
| * #include <iostream.h> | | | |
| * | | | |
| * int main(int argc, char *argv[]) { | | | |
| * UErrorCode status = U_ZERO_ERROR; | | | |
| * double filelimits[] = {0,1,2}; | | | |
| * UnicodeString filepart[] = | | | |
| * {"are no files","is one file","are {0} files"}; | | | |
| * ChoiceFormat* fileform = new ChoiceFormat(filelimits, filepart, 3 | | | |
| ); | | | |
| * Format* testFormats[] = | | | |
| * {fileform, NULL, NumberFormat::createInstance(status)}; | | | |
| * MessageFormat pattform("There {0} on {1}", status ); | | | |
| * pattform.adoptFormats(testFormats, 3); | | | |
| * Formattable testArgs[] = {0L, "Disk A"}; | | | |
| * FieldPosition fp(0); | | | |
| * UnicodeString str; | | | |
| * char buf[256]; | | | |
| * for (int32_t i = 0; i < 4; ++i) { | | | |
| * Formattable fInt(i); | | | |
| * testArgs[0] = fInt; | | | |
| * pattform.format(testArgs, 2, str, fp, status ); | | | |
| * str.extract(0, str.length(), buf, ""); | | | |
| * str.truncate(0); | | | |
| * cout << "Output for i=" << i << " : " << buf << endl; | | | |
| * } | | | |
| * cout << endl; | | | |
| * return 0; | | | |
| * } | | | |
| * \endcode | | | |
| * | | | |
| * <p><em>User subclasses are not supported.</em> While clients may write | | * <p><em>User subclasses are not supported.</em> While clients may write | |
| * subclasses, such code will not necessarily work and will not be | | * subclasses, such code will not necessarily work and will not be | |
| * guaranteed to work stably from release to release. | | * guaranteed to work stably from release to release. | |
| */ | | */ | |
| class U_I18N_API ChoiceFormat: public NumberFormat { | | class U_I18N_API ChoiceFormat: public NumberFormat { | |
| public: | | public: | |
| /** | | /** | |
|
| * Construct a new ChoiceFormat with the limits and the corresponding f | | * Constructs a new ChoiceFormat from the pattern string. | |
| ormats | | | |
| * based on the pattern. | | | |
| * | | * | |
| * @param pattern Pattern used to construct object. | | * @param pattern Pattern used to construct object. | |
| * @param status Output param to receive success code. If the | | * @param status Output param to receive success code. If the | |
| * pattern cannot be parsed, set to failure code. | | * pattern cannot be parsed, set to failure code. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| ChoiceFormat(const UnicodeString& pattern, | | ChoiceFormat(const UnicodeString& pattern, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
|
| * Construct a new ChoiceFormat with the given limits and formats. Cop | | * Constructs a new ChoiceFormat with the given limits and message stri | |
| y | | ngs. | |
| * the limits and formats instead of adopting them. | | * All closure flags default to <code>FALSE</code>, | |
| | | * equivalent to <code>less_than_or_equal</code> separators. | |
| | | * | |
| | | * Copies the limits and formats instead of adopting them. | |
| * | | * | |
| * @param limits Array of limit values. | | * @param limits Array of limit values. | |
| * @param formats Array of formats. | | * @param formats Array of formats. | |
| * @param count Size of 'limits' and 'formats' arrays. | | * @param count Size of 'limits' and 'formats' arrays. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
|
| | | | |
| ChoiceFormat(const double* limits, | | ChoiceFormat(const double* limits, | |
| const UnicodeString* formats, | | const UnicodeString* formats, | |
| int32_t count ); | | int32_t count ); | |
| | | | |
| /** | | /** | |
|
| * Construct a new ChoiceFormat with the given limits and formats. | | * Constructs a new ChoiceFormat with the given limits, closure flags a | |
| * Copy the limits and formats (instead of adopting them). By | | nd message strings. | |
| * default, each limit in the array specifies the inclusive lower | | * | |
| * bound of its range, and the exclusive upper bound of the previous | | * Copies the limits and formats instead of adopting them. | |
| * 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 limits Array of limit values | |
| * @param closures Array of booleans specifying whether each | | * @param closures Array of booleans specifying whether each | |
| * element of 'limits' is open or closed. If FALSE, then the | | * element of 'limits' is open or closed. If FALSE, then the | |
|
| * corresponding limit is a member of the range above it. If TRUE, | | * corresponding limit number is a member of its range. | |
| * then the limit belongs to the range below it. | | * If TRUE, then the limit number belongs to the previous range it. | |
| * @param formats Array of formats | | * @param formats Array of formats | |
| * @param count Size of 'limits', 'closures', and 'formats' arrays | | * @param count Size of 'limits', 'closures', and 'formats' arrays | |
| * @stable ICU 2.4 | | * @stable ICU 2.4 | |
| */ | | */ | |
| ChoiceFormat(const double* limits, | | ChoiceFormat(const double* limits, | |
| const UBool* closures, | | const UBool* closures, | |
| const UnicodeString* formats, | | const UnicodeString* formats, | |
| int32_t count); | | int32_t count); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 332 | | skipping to change at line 239 | |
| */ | | */ | |
| const ChoiceFormat& operator=(const ChoiceFormat& that); | | const ChoiceFormat& operator=(const ChoiceFormat& that); | |
| | | | |
| /** | | /** | |
| * Destructor. | | * Destructor. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual ~ChoiceFormat(); | | virtual ~ChoiceFormat(); | |
| | | | |
| /** | | /** | |
|
| * Clone this Format object polymorphically. The caller owns the | | * Clones this Format object. The caller owns the | |
| * result and should delete it when done. | | * result and must delete it when done. | |
| * | | * | |
| * @return a copy of this object | | * @return a copy of this object | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual Format* clone(void) const; | | virtual Format* clone(void) const; | |
| | | | |
| /** | | /** | |
|
| * Return true if the given Format objects are semantically equal. | | * Returns true if the given Format objects are semantically equal. | |
| * Objects of different subclasses are considered unequal. | | * Objects of different subclasses are considered unequal. | |
| * | | * | |
| * @param other ChoiceFormat object to be compared | | * @param other ChoiceFormat object to be compared | |
| * @return true if other is the same as this. | | * @return true if other is the same as this. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UBool operator==(const Format& other) const; | | virtual UBool operator==(const Format& other) const; | |
| | | | |
| /** | | /** | |
| * Sets the pattern. | | * Sets the pattern. | |
| | | | |
| skipping to change at line 364 | | skipping to change at line 271 | |
| * exit. If the pattern is invalid, this will be | | * exit. If the pattern is invalid, this will be | |
| * set to a failure result. | | * set to a failure result. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual void applyPattern(const UnicodeString& pattern, | | virtual void applyPattern(const UnicodeString& pattern, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Sets the pattern. | | * Sets the pattern. | |
| * @param pattern The pattern to be applied. | | * @param pattern The pattern to be applied. | |
|
| * @param parseError Struct to recieve information on position | | * @param parseError Struct to receive information on position | |
| * of error if an error is encountered | | * of error if an error is encountered | |
| * @param status Output param set to success/failure code on | | * @param status Output param set to success/failure code on | |
| * exit. If the pattern is invalid, this will be | | * exit. If the pattern is invalid, this will be | |
| * set to a failure result. | | * set to a failure result. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual void applyPattern(const UnicodeString& pattern, | | virtual void applyPattern(const UnicodeString& pattern, | |
| UParseError& parseError, | | UParseError& parseError, | |
| UErrorCode& status); | | UErrorCode& status); | |
| /** | | /** | |
| * Gets the pattern. | | * Gets the pattern. | |
| * | | * | |
|
| * @param pattern Output param which will recieve the pattern | | * @param pattern Output param which will receive the pattern | |
| * Previous contents are deleted. | | * Previous contents are deleted. | |
| * @return A reference to 'pattern' | | * @return A reference to 'pattern' | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& toPattern(UnicodeString &pattern) const; | | virtual UnicodeString& toPattern(UnicodeString &pattern) const; | |
| | | | |
| /** | | /** | |
|
| * Set the choices to be used in formatting. | | * Sets the choices to be used in formatting. | |
| | | * For details see the constructor with the same parameter list. | |
| * | | * | |
| * @param limitsToCopy Contains the top value that you want | | * @param limitsToCopy Contains the top value that you want | |
| * parsed with that format,and should be in | | * parsed with that format,and should be in | |
| * ascending sorted order. When formatting X, | | * ascending sorted order. When formatting X, | |
| * the choice will be the i, where limit[i] | | * the choice will be the i, where limit[i] | |
| * <= X < limit[i+1]. | | * <= X < limit[i+1]. | |
| * @param formatsToCopy The format strings you want to use for each
limit. | | * @param formatsToCopy The format strings you want to use for each
limit. | |
| * @param count The size of the above arrays. | | * @param count The size of the above arrays. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual void setChoices(const double* limitsToCopy, | | virtual void setChoices(const double* limitsToCopy, | |
| const UnicodeString* formatsToCopy, | | const UnicodeString* formatsToCopy, | |
| int32_t count ); | | int32_t count ); | |
| | | | |
| /** | | /** | |
|
| * Set the choices to be used in formatting. See class description | | * Sets the choices to be used in formatting. | |
| * for documenatation of the limits, closures, and formats arrays. | | * For details see the constructor with the same parameter list. | |
| | | * | |
| * @param limits Array of limits | | * @param limits Array of limits | |
| * @param closures Array of limit booleans | | * @param closures Array of limit booleans | |
| * @param formats Array of format string | | * @param formats Array of format string | |
| * @param count The size of the above arrays | | * @param count The size of the above arrays | |
| * @stable ICU 2.4 | | * @stable ICU 2.4 | |
| */ | | */ | |
| virtual void setChoices(const double* limits, | | virtual void setChoices(const double* limits, | |
| const UBool* closures, | | const UBool* closures, | |
| const UnicodeString* formats, | | const UnicodeString* formats, | |
| int32_t count); | | int32_t count); | |
| | | | |
| /** | | /** | |
|
| * Get the limits passed in the constructor. | | * Returns NULL and 0. | |
| | | * Before ICU 4.8, this used to return the choice limits array. | |
| * | | * | |
|
| * @param count The size of the limits arrays | | * @param count Will be set to 0. | |
| * @return the limits. | | * @return NULL | |
| * @stable ICU 2.0 | | * @deprecated ICU 4.8 Use the MessagePattern class to analyze a Choice | |
| | | Format pattern. | |
| */ | | */ | |
| virtual const double* getLimits(int32_t& count) const; | | virtual const double* getLimits(int32_t& count) const; | |
| | | | |
| /** | | /** | |
|
| * Get the limit booleans passed in the constructor. The caller | | * Returns NULL and 0. | |
| * must not delete the result. | | * Before ICU 4.8, this used to return the limit booleans array. | |
| * | | * | |
|
| * @param count The size of the arrays | | * @param count Will be set to 0. | |
| * @return the closures | | * @return NULL | |
| * @stable ICU 2.4 | | * @deprecated ICU 4.8 Use the MessagePattern class to analyze a Choice | |
| | | Format pattern. | |
| */ | | */ | |
| virtual const UBool* getClosures(int32_t& count) const; | | virtual const UBool* getClosures(int32_t& count) const; | |
| | | | |
| /** | | /** | |
|
| * Get the formats passed in the constructor. | | * Returns NULL and 0. | |
| | | * Before ICU 4.8, this used to return the array of choice strings. | |
| * | | * | |
|
| * @param count The size of the arrays | | * @param count Will be set to 0. | |
| * @return the formats. | | * @return NULL | |
| * @stable ICU 2.0 | | * @deprecated ICU 4.8 Use the MessagePattern class to analyze a Choice | |
| | | Format pattern. | |
| */ | | */ | |
| virtual const UnicodeString* getFormats(int32_t& count) const; | | virtual const UnicodeString* getFormats(int32_t& count) const; | |
| | | | |
| using NumberFormat::format; | | using NumberFormat::format; | |
| | | | |
| /** | | /** | |
|
| * Format a double or long number using this object's choices. | | * Formats a double number using this object's choices. | |
| * | | * | |
| * @param number The value to be formatted. | | * @param number The value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& format(double number, | | virtual UnicodeString& format(double number, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos) const; | | FieldPosition& pos) const; | |
| /** | | /** | |
|
| * Format a int_32t number using this object's choices. | | * Formats an int32_t number using this object's choices. | |
| * | | * | |
| * @param number The value to be formatted. | | * @param number The value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& format(int32_t number, | | virtual UnicodeString& format(int32_t number, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos) const; | | FieldPosition& pos) const; | |
| | | | |
| /** | | /** | |
|
| * Format an int64_t number using this object's choices. | | * Formats an int64_t number using this object's choices. | |
| * | | * | |
| * @param number The value to be formatted. | | * @param number The value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.8 | | * @stable ICU 2.8 | |
| */ | | */ | |
| virtual UnicodeString& format(int64_t number, | | virtual UnicodeString& format(int64_t number, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos) const; | | FieldPosition& pos) const; | |
| | | | |
| /** | | /** | |
|
| * Format an array of objects using this object's choices. | | * Formats an array of objects using this object's choices. | |
| * | | * | |
| * @param objs The array of objects to be formatted. | | * @param objs The array of objects to be formatted. | |
| * @param cnt The size of objs. | | * @param cnt The size of objs. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @param success Output param set to success/failure code on | | * @param success Output param set to success/failure code on | |
| * exit. | | * exit. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& format(const Formattable* objs, | | virtual UnicodeString& format(const Formattable* objs, | |
| int32_t cnt, | | int32_t cnt, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| FieldPosition& pos, | | FieldPosition& pos, | |
| UErrorCode& success) const; | | UErrorCode& success) const; | |
| /** | | /** | |
|
| * Format an object using this object's choices. | | * Formats an object using this object's choices. | |
| * | | * | |
| * | | * | |
| * @param obj The object to be formatted. | | * @param obj The object to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param pos On input: an alignment field, if desired. | | * @param pos On input: an alignment field, if desired. | |
| * On output: the offsets of the alignment field. | | * On output: the offsets of the alignment field. | |
| * @param status Output param set to success/failure code on | | * @param status Output param set to success/failure code on | |
| * exit. | | * exit. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| | | | |
| skipping to change at line 543 | | skipping to change at line 454 | |
| * exit. | | * exit. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| UnicodeString& format(const Formattable& obj, | | UnicodeString& format(const Formattable& obj, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| UErrorCode& status) const; | | UErrorCode& status) const; | |
| | | | |
| /** | | /** | |
| * Redeclared NumberFormat method. | | * Redeclared NumberFormat method. | |
|
| * Format a double number. These methods call the NumberFormat | | * Formats a double number. These methods call the NumberFormat | |
| * pure virtual format() methods with the default FieldPosition. | | * pure virtual format() methods with the default FieldPosition. | |
| * | | * | |
| * @param number The value to be formatted. | | * @param number The value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| UnicodeString& format( double number, | | UnicodeString& format( double number, | |
| UnicodeString& appendTo) const; | | UnicodeString& appendTo) const; | |
| | | | |
| /** | | /** | |
| * Redeclared NumberFormat method. | | * Redeclared NumberFormat method. | |
|
| * Format a long number. These methods call the NumberFormat | | * Formats an int32_t number. These methods call the NumberFormat | |
| * pure virtual format() methods with the default FieldPosition. | | * pure virtual format() methods with the default FieldPosition. | |
| * | | * | |
| * @param number The value to be formatted. | | * @param number The value to be formatted. | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| UnicodeString& format( int32_t number, | | UnicodeString& format( int32_t number, | |
| UnicodeString& appendTo) const; | | UnicodeString& appendTo) const; | |
| | | | |
| /** | | /** | |
|
| * Return a long if possible (e.g. within range LONG_MAX, | | * Looks for the longest match of any message string on the input text a | |
| * LONG_MAX], and with no decimals), otherwise a double. If | | nd, | |
| * IntegerOnly is set, will stop at a decimal point (or equivalent; | | * if there is a match, sets the result object to the corresponding rang | |
| * e.g. for rational numbers "1 2/3", will stop after the 1). | | e's number. | |
| * <P> | | * | |
| * If no object can be parsed, parsePosition is unchanged, and NULL is | | * If no string matches, then the parsePosition is unchanged. | |
| * returned. | | | |
| * | | * | |
| * @param text The text to be parsed. | | * @param text The text to be parsed. | |
| * @param result Formattable to be set to the parse result. | | * @param result Formattable to be set to the parse result. | |
| * If parse fails, return contents are undefined. | | * If parse fails, return contents are undefined. | |
| * @param parsePosition The position to start parsing at on input. | | * @param parsePosition The position to start parsing at on input. | |
| * On output, moved to after the last successfully | | * On output, moved to after the last successfully | |
| * parse character. On parse failure, does not cha
nge. | | * parse character. On parse failure, does not cha
nge. | |
|
| * @see NumberFormat::isParseIntegerOnly | | | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual void parse(const UnicodeString& text, | | virtual void parse(const UnicodeString& text, | |
| Formattable& result, | | Formattable& result, | |
| ParsePosition& parsePosition) const; | | ParsePosition& parsePosition) const; | |
| | | | |
| /** | | /** | |
|
| * Return a long if possible (e.g. within range LONG_MAX, | | * Looks for the longest match of any message string on the input text | |
| * LONG_MAX], and with no decimals), otherwise a double. If | | and, | |
| * IntegerOnly is set, will stop at a decimal point (or equivalent; | | * if there is a match, sets the result object to the corresponding ran | |
| * e.g. for rational numbers "1 2/3", will stop after the 1). | | ge's number. | |
| * <P> | | * | |
| * If no object can be parsed, parsePosition is unchanged, and NULL is | | * If no string matches, then the UErrorCode is set to U_INVALID_FORMAT | |
| * returned. | | _ERROR. | |
| * | | * | |
| * @param text The text to be parsed. | | * @param text The text to be parsed. | |
| * @param result Formattable to be set to the parse result. | | * @param result Formattable to be set to the parse result. | |
| * If parse fails, return contents are undefined. | | * If parse fails, return contents are undefined. | |
| * @param status Output param with the formatted string. | | * @param status Output param with the formatted string. | |
| * @see NumberFormat::isParseIntegerOnly | | * @stable ICU 2.0 | |
| * @stable ICU 2.0 | | */ | |
| */ | | | |
| virtual void parse(const UnicodeString& text, | | virtual void parse(const UnicodeString& text, | |
| Formattable& result, | | Formattable& result, | |
| UErrorCode& status) const; | | UErrorCode& status) const; | |
| | | | |
|
| public: | | | |
| /** | | /** | |
|
| * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. | | * Returns a unique class ID POLYMORPHICALLY. Part of ICU's "poor man's | |
| * This method is to implement a simple version of RTTI, since not all | | RTTI". | |
| * C++ compilers support genuine RTTI. Polymorphic operator==() and | | | |
| * clone() methods call this method. | | | |
| * | | * | |
| * @return The class ID for this object. All objects of a | | * @return The class ID for this object. All objects of a | |
| * given class have the same class ID. Objects of | | * given class have the same class ID. Objects of | |
| * other classes have different class IDs. | | * other classes have different class IDs. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UClassID getDynamicClassID(void) const; | | virtual UClassID getDynamicClassID(void) const; | |
| | | | |
| /** | | /** | |
|
| * Return the class ID for this class. This is useful only for | | * Returns the class ID for this class. This is useful only for | |
| * comparing to a return value from getDynamicClassID(). For example: | | * comparing to a return value from getDynamicClassID(). For example: | |
| * <pre> | | * <pre> | |
| * . Base* polymorphic_pointer = createPolymorphicObject(); | | * . Base* polymorphic_pointer = createPolymorphicObject(); | |
| * . if (polymorphic_pointer->getDynamicClassID() == | | * . if (polymorphic_pointer->getDynamicClassID() == | |
| * . Derived::getStaticClassID()) ... | | * . Derived::getStaticClassID()) ... | |
| * </pre> | | * </pre> | |
| * @return The class ID for all objects of this class. | | * @return The class ID for all objects of this class. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| static UClassID U_EXPORT2 getStaticClassID(void); | | static UClassID U_EXPORT2 getStaticClassID(void); | |
| | | | |
| private: | | private: | |
|
| // static cache management (thread-safe) | | | |
| // static NumberFormat* getNumberFormat(UErrorCode &status); // call thi | | | |
| s function to 'check out' a numberformat from the cache. | | | |
| // static void releaseNumberFormat(NumberFormat *adopt); // cal | | | |
| l this function to 'return' the number format to the cache. | | | |
| | | | |
| /** | | | |
| * Converts a string to a double value using a default NumberFormat obj | | | |
| ect | | | |
| * which is static (shared by all ChoiceFormat instances). | | | |
| * @param string the string to be converted with. | | | |
| * @return the converted double number. | | | |
| */ | | | |
| static double stod(const UnicodeString& string); | | | |
| | | | |
| /** | | /** | |
|
| * Converts a double value to a string using a default NumberFormat obj | | * Converts a double value to a string. | |
| ect | | * @param value the double number to be converted. | |
| * which is static (shared by all ChoiceFormat instances). | | | |
| * @param value the double number to be converted with. | | | |
| * @param string the result string. | | * @param string the result string. | |
| * @return the converted string. | | * @return the converted string. | |
| */ | | */ | |
| static UnicodeString& dtos(double value, UnicodeString& string); | | static UnicodeString& dtos(double value, UnicodeString& string); | |
| | | | |
| ChoiceFormat(); // default constructor not implemented | | ChoiceFormat(); // default constructor not implemented | |
| | | | |
| /** | | /** | |
| * Construct a new ChoiceFormat with the limits and the corresponding f
ormats | | * Construct a new ChoiceFormat with the limits and the corresponding f
ormats | |
| * based on the pattern. | | * based on the pattern. | |
| * | | * | |
| * @param newPattern Pattern used to construct object. | | * @param newPattern Pattern used to construct object. | |
|
| * @param parseError Struct to recieve information on position | | * @param parseError Struct to receive information on position | |
| * of error if an error is encountered. | | * of error if an error is encountered. | |
| * @param status Output param to receive success code. If the | | * @param status Output param to receive success code. If the | |
| * pattern cannot be parsed, set to failure code. | | * pattern cannot be parsed, set to failure code. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| ChoiceFormat(const UnicodeString& newPattern, | | ChoiceFormat(const UnicodeString& newPattern, | |
| UParseError& parseError, | | UParseError& parseError, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| friend class MessageFormat; | | friend class MessageFormat; | |
|
| | | | |
| | | virtual void setChoices(const double* limits, | |
| | | const UBool* closures, | |
| | | const UnicodeString* formats, | |
| | | int32_t count, | |
| | | UErrorCode &errorCode); | |
| | | | |
| /** | | /** | |
|
| | | * Finds the ChoiceFormat sub-message for the given number. | |
| | | * @param pattern A MessagePattern. | |
| | | * @param partIndex the index of the first ChoiceFormat argument style | |
| | | part. | |
| | | * @param number a number to be mapped to one of the ChoiceFormat argum | |
| | | ent's intervals | |
| | | * @return the sub-message start part index. | |
| | | */ | |
| | | static int32_t findSubMessage(const MessagePattern &pattern, int32_t pa | |
| | | rtIndex, double number); | |
| | | | |
| | | static double parseArgument( | |
| | | const MessagePattern &pattern, int32_t partIndex, | |
| | | const UnicodeString &source, ParsePosition &pos); | |
| | | | |
| | | /** | |
| | | * Matches the pattern string from the end of the partIndex to | |
| | | * the beginning of the limitPartIndex, | |
| | | * including all syntax except SKIP_SYNTAX, | |
| | | * against the source string starting at sourceOffset. | |
| | | * If they match, returns the length of the source string match. | |
| | | * Otherwise returns -1. | |
| | | */ | |
| | | static int32_t matchStringUntilLimitPart( | |
| | | const MessagePattern &pattern, int32_t partIndex, int32_t limit | |
| | | PartIndex, | |
| | | const UnicodeString &source, int32_t sourceOffset); | |
| | | | |
| | | /** | |
| | | * Some of the ChoiceFormat constructors do not have a UErrorCode param | |
| | | ater. | |
| | | * We need _some_ way to provide one for the MessagePattern constructor | |
| | | . | |
| | | * Alternatively, the MessagePattern could be a pointer field, but that | |
| | | is | |
| | | * not nice either. | |
| | | */ | |
| | | UErrorCode constructorErrorCode; | |
| | | | |
| | | /** | |
| | | * The MessagePattern which contains the parsed structure of the patter | |
| | | n string. | |
| | | * | |
| | | * Starting with ICU 4.8, the MessagePattern contains a sequence of | |
| | | * numeric/selector/message parts corresponding to the parsed pattern. | |
| | | * For details see the MessagePattern class API docs. | |
| | | */ | |
| | | MessagePattern msgPattern; | |
| | | | |
| | | /** | |
| | | * Docs & fields from before ICU 4.8, before MessagePattern was used. | |
| | | * Commented out, and left only for explanation of semantics. | |
| | | * -------- | |
| * Each ChoiceFormat divides the range -Inf..+Inf into fCount | | * Each ChoiceFormat divides the range -Inf..+Inf into fCount | |
| * intervals. The intervals are: | | * intervals. The intervals are: | |
| * | | * | |
| * 0: fChoiceLimits[0]..fChoiceLimits[1] | | * 0: fChoiceLimits[0]..fChoiceLimits[1] | |
| * 1: fChoiceLimits[1]..fChoiceLimits[2] | | * 1: fChoiceLimits[1]..fChoiceLimits[2] | |
| * ... | | * ... | |
| * fCount-2: fChoiceLimits[fCount-2]..fChoiceLimits[fCount-1] | | * fCount-2: fChoiceLimits[fCount-2]..fChoiceLimits[fCount-1] | |
| * fCount-1: fChoiceLimits[fCount-1]..+Inf | | * fCount-1: fChoiceLimits[fCount-1]..+Inf | |
| * | | * | |
| * Interval 0 is special; during formatting (mapping numbers to | | * Interval 0 is special; during formatting (mapping numbers to | |
| | | | |
| skipping to change at line 713 | | skipping to change at line 651 | |
| * i: fChoiceLimits[i] <= x ... | | * i: fChoiceLimits[i] <= x ... | |
| * | | * | |
| * If fClosures[i] is TRUE, then the value fChoiceLimits[i] is | | * If fClosures[i] is TRUE, then the value fChoiceLimits[i] is | |
| * in interval i-1. That is, intervals i-1 and i are: | | * in interval i-1. That is, intervals i-1 and i are: | |
| * | | * | |
| * i-1: ... x <= fChoiceLimits[i] | | * i-1: ... x <= fChoiceLimits[i] | |
| * i: fChoiceLimits[i] < x ... | | * i: fChoiceLimits[i] < x ... | |
| * | | * | |
| * Because of the nature of interval 0, fClosures[0] has no | | * Because of the nature of interval 0, fClosures[0] has no | |
| * effect. | | * effect. | |
|
| | | | |
| */ | | */ | |
|
| double* fChoiceLimits; | | // double* fChoiceLimits; | |
| UBool* fClosures; | | // UBool* fClosures; | |
| UnicodeString* fChoiceFormats; | | // UnicodeString* fChoiceFormats; | |
| int32_t fCount; | | // int32_t fCount; | |
| }; | | }; | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| ChoiceFormat::format(const Formattable& obj, | | ChoiceFormat::format(const Formattable& obj, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| UErrorCode& status) const { | | UErrorCode& status) const { | |
| // Don't use Format:: - use immediate base class only, | | // Don't use Format:: - use immediate base class only, | |
| // in case immediate base modifies behavior later. | | // in case immediate base modifies behavior later. | |
| return NumberFormat::format(obj, appendTo, status); | | return NumberFormat::format(obj, appendTo, status); | |
| } | | } | |
| | | | |
End of changes. 55 change blocks. |
| 263 lines changed or deleted | | 220 lines changed or added | |
|
| decimfmt.h | | decimfmt.h | |
| /* | | /* | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
|
| * Copyright (C) 1997-2010, International Business Machines | | * Copyright (C) 1997-2011, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| * | | * | |
| * File DECIMFMT.H | | * File DECIMFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/19/97 aliu Converted from java. | | * 02/19/97 aliu Converted from java. | |
| * 03/20/97 clhuang Updated per C++ implementation. | | * 03/20/97 clhuang Updated per C++ implementation. | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| #include "unicode/stringpiece.h" | | #include "unicode/stringpiece.h" | |
| | | | |
| union UHashTok; | | union UHashTok; | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| class DigitList; | | class DigitList; | |
| class ChoiceFormat; | | class ChoiceFormat; | |
| class CurrencyPluralInfo; | | class CurrencyPluralInfo; | |
| class Hashtable; | | class Hashtable; | |
|
| | | class UnicodeSet; | |
| class FieldPositionHandler; | | class FieldPositionHandler; | |
| | | | |
| /** | | /** | |
| * DecimalFormat is a concrete subclass of NumberFormat that formats decima
l | | * DecimalFormat is a concrete subclass of NumberFormat that formats decima
l | |
| * numbers. It has a variety of features designed to make it possible to pa
rse | | * numbers. It has a variety of features designed to make it possible to pa
rse | |
| * and format numbers in any locale, including support for Western, Arabic,
or | | * and format numbers in any locale, including support for Western, Arabic,
or | |
| * Indic digits. It also supports different flavors of numbers, including | | * Indic digits. It also supports different flavors of numbers, including | |
| * integers ("123"), fixed-point numbers ("123.4"), scientific notation | | * integers ("123"), fixed-point numbers ("123.4"), scientific notation | |
| * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123", | | * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123", | |
| * "123 US dollars"). All of these flavors can be easily localized. | | * "123 US dollars"). All of these flavors can be easily localized. | |
| | | | |
| skipping to change at line 353 | | skipping to change at line 354 | |
| * | | * | |
| * <p><strong>Parsing</strong> | | * <p><strong>Parsing</strong> | |
| * | | * | |
| * <p>DecimalFormat parses all Unicode characters that represent | | * <p>DecimalFormat parses all Unicode characters that represent | |
| * decimal digits, as defined by u_charDigitValue(). In addition, | | * decimal digits, as defined by u_charDigitValue(). In addition, | |
| * DecimalFormat also recognizes as digits the ten consecutive | | * DecimalFormat also recognizes as digits the ten consecutive | |
| * characters starting with the localized zero digit defined in the | | * characters starting with the localized zero digit defined in the | |
| * DecimalFormatSymbols object. During formatting, the | | * DecimalFormatSymbols object. During formatting, the | |
| * DecimalFormatSymbols-based digits are output. | | * DecimalFormatSymbols-based digits are output. | |
| * | | * | |
|
| * <p>During parsing, grouping separators are ignored. | | * <p>During parsing, grouping separators are ignored if in lenient mode; | |
| | | * otherwise, if present, they must be in appropriate positions. | |
| * | | * | |
| * <p>For currency parsing, the formatter is able to parse every currency | | * <p>For currency parsing, the formatter is able to parse every currency | |
| * style formats no matter which style the formatter is constructed with. | | * style formats no matter which style the formatter is constructed with. | |
| * For example, a formatter instance gotten from | | * For example, a formatter instance gotten from | |
| * NumberFormat.getInstance(ULocale, NumberFormat.CURRENCYSTYLE) can parse | | * NumberFormat.getInstance(ULocale, NumberFormat.CURRENCYSTYLE) can parse | |
| * formats such as "USD1.00" and "3.00 US dollars". | | * formats such as "USD1.00" and "3.00 US dollars". | |
| * | | * | |
| * <p>If parse(UnicodeString&,Formattable&,ParsePosition&) | | * <p>If parse(UnicodeString&,Formattable&,ParsePosition&) | |
| * fails to parse a string, it leaves the parse position unchanged. | | * fails to parse a string, it leaves the parse position unchanged. | |
| * The convenience method parse(UnicodeString&,Formattable&,UErrorCode&) | | * The convenience method parse(UnicodeString&,Formattable&,UErrorCode&) | |
| | | | |
| skipping to change at line 658 | | skipping to change at line 660 | |
| */ | | */ | |
| enum ERoundingMode { | | enum ERoundingMode { | |
| kRoundCeiling, /**< Round towards positive infinity */ | | kRoundCeiling, /**< Round towards positive infinity */ | |
| kRoundFloor, /**< Round towards negative infinity */ | | kRoundFloor, /**< Round towards negative infinity */ | |
| kRoundDown, /**< Round towards zero */ | | kRoundDown, /**< Round towards zero */ | |
| kRoundUp, /**< Round away from zero */ | | kRoundUp, /**< Round away from zero */ | |
| kRoundHalfEven, /**< Round towards the nearest integer, or | | kRoundHalfEven, /**< Round towards the nearest integer, or | |
| towards the nearest even integer if equidistan
t */ | | towards the nearest even integer if equidistan
t */ | |
| kRoundHalfDown, /**< Round towards the nearest integer, or | | kRoundHalfDown, /**< Round towards the nearest integer, or | |
| towards zero if equidistant */ | | towards zero if equidistant */ | |
|
| kRoundHalfUp /**< Round towards the nearest integer, or | | kRoundHalfUp, /**< Round towards the nearest integer, or | |
| away from zero if equidistant */ | | away from zero if equidistant */ | |
|
| // We don't support ROUND_UNNECESSARY | | /** | |
| | | * Return U_FORMAT_INEXACT_ERROR if number does not format exactl | |
| | | y. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | kRoundUnnecessary | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Pad position. | | * Pad position. | |
| * @stable ICU 2.4 | | * @stable ICU 2.4 | |
| */ | | */ | |
| enum EPadPosition { | | enum EPadPosition { | |
| kPadBeforePrefix, | | kPadBeforePrefix, | |
| kPadAfterPrefix, | | kPadAfterPrefix, | |
| kPadBeforeSuffix, | | kPadBeforeSuffix, | |
| | | | |
| skipping to change at line 735 | | skipping to change at line 741 | |
| DecimalFormatSymbols* symbolsToAdopt, | | DecimalFormatSymbols* symbolsToAdopt, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * This API is for ICU use only. | | * This API is for ICU use only. | |
| * Create a DecimalFormat from the given pattern, symbols, and style. | | * Create a DecimalFormat from the given pattern, symbols, and style. | |
| * | | * | |
| * @param pattern a non-localized pattern string | | * @param pattern a non-localized pattern string | |
| * @param symbolsToAdopt the set of symbols to be used. The caller
should not | | * @param symbolsToAdopt the set of symbols to be used. The caller
should not | |
| * delete this object after making this call. | | * delete this object after making this call. | |
|
| * @param style style of decimal format, kNumberStyle etc. | | * @param style style of decimal format | |
| * @param status Output param set to success/failure code. I
f the | | * @param status Output param set to success/failure code. I
f the | |
| * pattern is invalid this will be set to a fa
ilure code. | | * pattern is invalid this will be set to a fa
ilure code. | |
| * @internal ICU 4.2 | | * @internal ICU 4.2 | |
| */ | | */ | |
| DecimalFormat( const UnicodeString& pattern, | | DecimalFormat( const UnicodeString& pattern, | |
| DecimalFormatSymbols* symbolsToAdopt, | | DecimalFormatSymbols* symbolsToAdopt, | |
|
| NumberFormat::EStyles style, | | UNumberFormatStyle style, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Create a DecimalFormat from the given pattern and symbols. | | * Create a DecimalFormat from the given pattern and symbols. | |
| * Use this constructor when you need to completely customize the | | * Use this constructor when you need to completely customize the | |
| * behavior of the format. | | * behavior of the format. | |
| * <P> | | * <P> | |
| * To obtain standard formats for a given | | * To obtain standard formats for a given | |
| * locale, use the factory methods on NumberFormat such as | | * locale, use the factory methods on NumberFormat such as | |
| * createInstance or createCurrencyInstance. If you need only minor adj
ustments | | * createInstance or createCurrencyInstance. If you need only minor adj
ustments | |
| | | | |
| skipping to change at line 1972 | | skipping to change at line 1978 | |
| int32_t pos, | | int32_t pos, | |
| UBool isNegative, | | UBool isNegative, | |
| UBool isPrefix, | | UBool isPrefix, | |
| const UnicodeString* affixPat, | | const UnicodeString* affixPat, | |
| UBool currencyParsing, | | UBool currencyParsing, | |
| int8_t type, | | int8_t type, | |
| UChar* currency) const; | | UChar* currency) const; | |
| | | | |
| static int32_t compareSimpleAffix(const UnicodeString& affix, | | static int32_t compareSimpleAffix(const UnicodeString& affix, | |
| const UnicodeString& input, | | const UnicodeString& input, | |
|
| int32_t pos); | | int32_t pos, | |
| | | UBool lenient); | |
| | | | |
|
| static int32_t skipRuleWhiteSpace(const UnicodeString& text, int32_t po
s); | | static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t
pos); | |
| | | | |
| static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos); | | static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos); | |
| | | | |
| int32_t compareComplexAffix(const UnicodeString& affixPat, | | int32_t compareComplexAffix(const UnicodeString& affixPat, | |
| const UnicodeString& input, | | const UnicodeString& input, | |
| int32_t pos, | | int32_t pos, | |
| int8_t type, | | int8_t type, | |
| UChar* currency) const; | | UChar* currency) const; | |
| | | | |
| static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch
); | | static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch
); | |
| | | | |
| static int32_t match(const UnicodeString& text, int32_t pos, const Unic
odeString& str); | | static int32_t match(const UnicodeString& text, int32_t pos, const Unic
odeString& str); | |
| | | | |
|
| | | static UBool matchSymbol(const UnicodeString &text, int32_t position, i | |
| | | nt32_t length, const UnicodeString &symbol, | |
| | | UnicodeSet *sset, UChar32 schar); | |
| | | | |
| /** | | /** | |
| * Get a decimal format symbol. | | * Get a decimal format symbol. | |
| * Returns a const reference to the symbol string. | | * Returns a const reference to the symbol string. | |
| * @internal | | * @internal | |
| */ | | */ | |
| inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumbe
rFormatSymbol symbol) const; | | inline const UnicodeString &getConstSymbol(DecimalFormatSymbols::ENumbe
rFormatSymbol symbol) const; | |
| | | | |
| int32_t appendAffix(UnicodeString& buf, | | int32_t appendAffix(UnicodeString& buf, | |
| double number, | | double number, | |
| FieldPositionHandler& handler, | | FieldPositionHandler& handler, | |
| | | | |
End of changes. 10 change blocks. |
| 8 lines changed or deleted | | 20 lines changed or added | |
|
| dtitvfmt.h | | dtitvfmt.h | |
| /**************************************************************************
****** | | /**************************************************************************
****** | |
|
| * Copyright (C) 2008-2010, International Business Machines Corporation and | | * Copyright (C) 2008-2011, International Business Machines Corporation and | |
| * others. All Rights Reserved. | | * others. All Rights Reserved. | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| * | | * | |
| * File DTITVFMT.H | | * File DTITVFMT.H | |
| * | | * | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| */ | | */ | |
| | | | |
| #ifndef __DTITVFMT_H__ | | #ifndef __DTITVFMT_H__ | |
| #define __DTITVFMT_H__ | | #define __DTITVFMT_H__ | |
| | | | |
| skipping to change at line 257 | | skipping to change at line 257 | |
| * For example: | | * For example: | |
| * DateIntervalFormat::createInstance(UDAT_MONTH_DAY, status) | | * DateIntervalFormat::createInstance(UDAT_MONTH_DAY, status) | |
| * | | * | |
| * The given Locale provides the interval patterns. | | * The given Locale provides the interval patterns. | |
| * For example, for en_GB, if skeleton is UDAT_YEAR_ABBR_MONTH_WEEKDAY_
DAY, | | * For example, for en_GB, if skeleton is UDAT_YEAR_ABBR_MONTH_WEEKDAY_
DAY, | |
| * which is "yMMMEEEd", | | * which is "yMMMEEEd", | |
| * the interval patterns defined in resource file to above skeleton are
: | | * the interval patterns defined in resource file to above skeleton are
: | |
| * "EEE, d MMM, yyyy - EEE, d MMM, yyyy" for year differs, | | * "EEE, d MMM, yyyy - EEE, d MMM, yyyy" for year differs, | |
| * "EEE, d MMM - EEE, d MMM, yyyy" for month differs, | | * "EEE, d MMM - EEE, d MMM, yyyy" for month differs, | |
| * "EEE, d - EEE, d MMM, yyyy" for day differs, | | * "EEE, d - EEE, d MMM, yyyy" for day differs, | |
|
| * @param skeleton the skeleton on which interval format based. | | * @param skeleton the skeleton on which the interval format is based. | |
| * @param locale the given locale | | * @param locale the given locale | |
| * @param status output param set to success/failure code on exit | | * @param status output param set to success/failure code on exit | |
| * @return a date time interval formatter which the caller own
s. | | * @return a date time interval formatter which the caller own
s. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| | | | |
| static DateIntervalFormat* U_EXPORT2 createInstance( | | static DateIntervalFormat* U_EXPORT2 createInstance( | |
| const UnicodeString& skeleto
n, | | const UnicodeString& skeleto
n, | |
| const Locale& locale, | | const Locale& locale, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| skipping to change at line 483 | | skipping to change at line 483 | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Gets the date formatter | | * Gets the date formatter | |
| * @return the date formatter associated with this date interval format
ter. | | * @return the date formatter associated with this date interval format
ter. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| const DateFormat* getDateFormat(void) const; | | const DateFormat* getDateFormat(void) const; | |
| | | | |
| /** | | /** | |
|
| | | * Returns a reference to the TimeZone used by this DateIntervalFormat' | |
| | | s calendar. | |
| | | * @return the time zone associated with the calendar of DateIntervalFo | |
| | | rmat. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | virtual const TimeZone& getTimeZone(void) const; | |
| | | | |
| | | /** | |
| | | * Sets the time zone for the calendar used by this DateIntervalFormat | |
| | | object. The | |
| | | * caller no longer owns the TimeZone object and should not delete it a | |
| | | fter this call. | |
| | | * @param zoneToAdopt the TimeZone to be adopted. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | virtual void adoptTimeZone(TimeZone* zoneToAdopt); | |
| | | | |
| | | /** | |
| | | * Sets the time zone for the calendar used by this DateIntervalFormat | |
| | | object. | |
| | | * @param zone the new time zone. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | virtual void setTimeZone(const TimeZone& zone); | |
| | | | |
| | | /** | |
| * Return the class ID for this class. This is useful only for comparin
g to | | * Return the class ID for this class. This is useful only for comparin
g to | |
| * a return value from getDynamicClassID(). For example: | | * a return value from getDynamicClassID(). For example: | |
| * <pre> | | * <pre> | |
| * . Base* polymorphic_pointer = createPolymorphicObject(); | | * . Base* polymorphic_pointer = createPolymorphicObject(); | |
| * . if (polymorphic_pointer->getDynamicClassID() == | | * . if (polymorphic_pointer->getDynamicClassID() == | |
| * . erived::getStaticClassID()) ... | | * . erived::getStaticClassID()) ... | |
| * </pre> | | * </pre> | |
| * @return The class ID for all objects of this class. | | * @return The class ID for all objects of this class. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| | | | |
| skipping to change at line 577 | | skipping to change at line 599 | |
| * full pattern, and date format symbols information. | | * full pattern, and date format symbols information. | |
| * It should be a SimpleDateFormat object which | | * It should be a SimpleDateFormat object which | |
| * has a pattern in it. | | * has a pattern in it. | |
| * the DateIntervalInfo provides the interval patterns. | | * the DateIntervalInfo provides the interval patterns. | |
| * | | * | |
| * Note: the DateIntervalFormat takes ownership of both | | * Note: the DateIntervalFormat takes ownership of both | |
| * DateFormat and DateIntervalInfo objects. | | * DateFormat and DateIntervalInfo objects. | |
| * Caller should not delete them. | | * Caller should not delete them. | |
| * | | * | |
| * @param locale the locale of this date interval formatter. | | * @param locale the locale of this date interval formatter. | |
|
| * @param dtitvinf the DateIntervalInfo object to be adopted. | | * @param dtItvInfo the DateIntervalInfo object to be adopted. | |
| * @param skeleton the skeleton of the date formatter | | * @param skeleton the skeleton of the date formatter | |
| * @param status output param set to success/failure code on exit | | * @param status output param set to success/failure code on exit | |
| * @internal ICU 4.0 | | * @internal ICU 4.0 | |
| */ | | */ | |
| DateIntervalFormat(const Locale& locale, DateIntervalInfo* dtItvInfo, | | DateIntervalFormat(const Locale& locale, DateIntervalInfo* dtItvInfo, | |
| const UnicodeString* skeleton, UErrorCode& status); | | const UnicodeString* skeleton, UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Construct a DateIntervalFormat from DateFormat | | * Construct a DateIntervalFormat from DateFormat | |
| * and a DateIntervalInfo. | | * and a DateIntervalInfo. | |
| | | | |
| skipping to change at line 810 | | skipping to change at line 832 | |
| * 3.4 do not adjust 'd', 'h', or 'm' if h presents | | * 3.4 do not adjust 'd', 'h', or 'm' if h presents | |
| * 3.5 do not adjust 'M' if it is numeric(?) | | * 3.5 do not adjust 'M' if it is numeric(?) | |
| * | | * | |
| * Since date interval format is well-formed format, | | * Since date interval format is well-formed format, | |
| * date and time skeletons are normalized previously, | | * date and time skeletons are normalized previously, | |
| * till this stage, the adjust here is only "adjust strings, such as MM
M | | * till this stage, the adjust here is only "adjust strings, such as MM
M | |
| * and MMMM, EEE and EEEE. | | * and MMMM, EEE and EEEE. | |
| * | | * | |
| * @param inputSkeleton the input skeleton | | * @param inputSkeleton the input skeleton | |
| * @param bestMatchSkeleton the best match skeleton | | * @param bestMatchSkeleton the best match skeleton | |
|
| * @param bestMatchIntervalpattern the best match interval pattern | | * @param bestMatchIntervalPattern the best match interval pattern | |
| * @param differenceInfo the difference between 2 skeletons | | * @param differenceInfo the difference between 2 skeletons | |
| * 1 means only field width differs | | * 1 means only field width differs | |
| * 2 means v/z exchange | | * 2 means v/z exchange | |
| * @param adjustedIntervalPattern adjusted interval pattern | | * @param adjustedIntervalPattern adjusted interval pattern | |
| * @internal ICU 4.0 | | * @internal ICU 4.0 | |
| */ | | */ | |
| static void U_EXPORT2 adjustFieldWidth( | | static void U_EXPORT2 adjustFieldWidth( | |
| const UnicodeString& inputSkeleton, | | const UnicodeString& inputSkeleton, | |
| const UnicodeString& bestMatchSkeleton, | | const UnicodeString& bestMatchSkeleton, | |
| const UnicodeString& bestMatchIntervalPattern, | | const UnicodeString& bestMatchIntervalPattern, | |
| | | | |
| skipping to change at line 893 | | skipping to change at line 915 | |
| * | | * | |
| * @param field calendar field | | * @param field calendar field | |
| * @param firstPart the first part in interval pattern | | * @param firstPart the first part in interval pattern | |
| * @param secondPart the second part in interval pattern | | * @param secondPart the second part in interval pattern | |
| * @param laterDateFirst whether the first date in intervalPattern | | * @param laterDateFirst whether the first date in intervalPattern | |
| * is earlier date or later date | | * is earlier date or later date | |
| * @internal ICU 4.0 | | * @internal ICU 4.0 | |
| */ | | */ | |
| void setPatternInfo(UCalendarDateFields field, | | void setPatternInfo(UCalendarDateFields field, | |
| const UnicodeString* firstPart, | | const UnicodeString* firstPart, | |
|
| const UnicodeString* secondpart, | | const UnicodeString* secondPart, | |
| UBool laterDateFirst); | | UBool laterDateFirst); | |
| | | | |
| // from calendar field to pattern letter | | // from calendar field to pattern letter | |
| static const UChar fgCalendarFieldToPatternLetter[]; | | static const UChar fgCalendarFieldToPatternLetter[]; | |
| | | | |
| /** | | /** | |
| * The interval patterns for this locale. | | * The interval patterns for this locale. | |
| */ | | */ | |
| DateIntervalInfo* fInfo; | | DateIntervalInfo* fInfo; | |
| | | | |
| | | | |
End of changes. 6 change blocks. |
| 5 lines changed or deleted | | 32 lines changed or added | |
|
| msgfmt.h | | msgfmt.h | |
| /* | | /* | |
|
| * Copyright (C) 2007-2010, International Business Machines Corporation and | | * Copyright (C) 2007-2011, International Business Machines Corporation and | |
| * others. All Rights Reserved. | | * others. All Rights Reserved. | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| * | | * | |
| * File MSGFMT.H | | * File MSGFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/19/97 aliu Converted from java. | | * 02/19/97 aliu Converted from java. | |
| * 03/20/97 helena Finished first cut of implementation. | | * 03/20/97 helena Finished first cut of implementation. | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| | | | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: Formats messages in a language-neutral way. | | * \brief C++ API: Formats messages in a language-neutral way. | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| #include "unicode/format.h" | | #include "unicode/format.h" | |
| #include "unicode/locid.h" | | #include "unicode/locid.h" | |
|
| | | #include "unicode/messagepattern.h" | |
| #include "unicode/parseerr.h" | | #include "unicode/parseerr.h" | |
|
| #include "unicode/uchar.h" | | #include "unicode/plurfmt.h" | |
| | | #include "unicode/plurrule.h" | |
| | | | |
| | | U_CDECL_BEGIN | |
| | | // Forward declaration. | |
| | | struct UHashtable; | |
| | | typedef struct UHashtable UHashtable; | |
| | | U_CDECL_END | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
|
| class NumberFormat; | | class AppendableWrapper; | |
| class DateFormat; | | class DateFormat; | |
|
| | | class NumberFormat; | |
| | | | |
| /** | | /** | |
|
| | | * <p>MessageFormat prepares strings for display to users, | |
| | | * with optional arguments (variables/placeholders). | |
| | | * The arguments can occur in any order, which is necessary for translation | |
| | | * into languages with different grammars. | |
| * | | * | |
|
| * MessageFormat produces concatenated messages in a language-neutral | | * <p>A MessageFormat is constructed from a <em>pattern</em> string | |
| * way. Use this whenever concatenating strings that are displayed to | | * with arguments in {curly braces} which will be replaced by formatted val | |
| * end users. | | ues. | |
| * | | * | |
|
| * <P>A MessageFormat contains an array of <EM>subformats</EM> arranged | | * <p><code>MessageFormat</code> differs from the other <code>Format</code> | |
| * within a <EM>template string</EM>. Together, the subformats and | | * classes in that you create a <code>MessageFormat</code> object with one | |
| * template string determine how the MessageFormat will operate during | | * of its constructors (not with a <code>createInstance</code> style factor | |
| * formatting and parsing. | | y | |
| | | * method). Factory methods aren't necessary because <code>MessageFormat</c | |
| | | ode> | |
| | | * itself doesn't implement locale-specific behavior. Any locale-specific | |
| | | * behavior is defined by the pattern that you provide and the | |
| | | * subformats used for inserted arguments. | |
| * | | * | |
|
| * <P>Typically, both the subformats and the template string are | | * <p>Arguments can be named (using identifiers) or numbered (using small A | |
| * specified at once in a <EM>pattern</EM>. By using different | | SCII-digit integers). | |
| * patterns for different locales, messages may be localized. | | * Some of the API methods work only with argument numbers and throw an exc | |
| | | eption | |
| | | * if the pattern has named arguments (see {@link #usesNamedArguments()}). | |
| * | | * | |
|
| * <P>When formatting, MessageFormat takes an array of arguments | | * <p>An argument might not specify any format type. In this case, | |
| * and produces a user-readable string. Each argument is a | | * a Number value is formatted with a default (for the locale) NumberFormat | |
| * Formattable object; they may be passed in in an array, or as a | | , | |
| * single Formattable object which itself contains an array. Each | | * a Date value is formatted with a default (for the locale) DateFormat, | |
| * argument is matched up with its corresponding subformat, which then | | * and for any other value its toString() value is used. | |
| * formats it into a string. The resulting strings are then assembled | | | |
| * within the string template of the MessageFormat to produce the | | | |
| * final output string. | | | |
| * | | * | |
|
| * <p><strong>Note:</strong> | | * <p>An argument might specify a "simple" type for which the specified | |
| * In ICU 4.0 MessageFormat supports named arguments. If a named argument | | * Format object is created, cached and used. | |
| * is used, all arguments must be named. Names start with a character in | | | |
| * <code>UCHAR_ID_START</code> and continue with characters in | | | |
| * <code>UCHARID_CONTINUE</code>, in particular they do not start with a di | | | |
| git. | | | |
| * If named arguments are used, {@link #usesNamedArguments()} will return t | | | |
| rue. | | | |
| * | | * | |
|
| * <p>The other new methods supporting named arguments are | | * <p>An argument might have a "complex" type with nested MessageFormat sub | |
| * {@link #getFormatNames(UErrorCode& status)}, | | -patterns. | |
| * {@link #getFormat(const UnicodeString& formatName, UErrorCode& status)} | | * During formatting, one of these sub-messages is selected according to th | |
| * {@link #setFormat(const UnicodeString& formatName, const Format& format, | | e argument value | |
| UErrorCode& status)}, | | * and recursively formatted. | |
| * {@link #adoptFormat(const UnicodeString& formatName, Format* formatToAdo | | | |
| pt, UErrorCode& status)}, | | | |
| * {@link #format(const UnicodeString* argumentNames, const Formattable* ar | | | |
| guments, | | | |
| * int32_t count, UnicodeString& appendTo,UErrorCode& status)}. | | | |
| * These methods are all compatible with patterns that do not used named ar | | | |
| guments-- | | | |
| * in these cases the keys in the input or output use <code>UnicodeString</ | | | |
| code>s | | | |
| * that name the argument indices, e.g. "0", "1", "2"... etc. | | | |
| * | | * | |
|
| * <p>If this format uses named arguments, certain methods that take or | | * <p>After construction, a custom Format object can be set for | |
| * return arrays do not perform any action, since it is not possible to | | * a top-level argument, overriding the default formatting and parsing beha | |
| * identify positions in an array using a name. Of these methods, | | vior | |
| * UErrorCode is set to U_ILLEGAL_ARGUMENT_ERROR by format, and to | | * for that argument. | |
| * U_ARGUMENT_TYPE_MISMATCH by parse. | | * However, custom formatting can be achieved more simply by writing | |
| * These methods are | | * a typeless argument in the pattern string | |
| * {@link #adoptFormats(Format** formatsToAdopt, int32_t count)}, | | * and supplying it with a preformatted string value. | |
| * {@link #setFormats(const Format** newFormats,int32_t count)}, | | | |
| * {@link #adoptFormat(int32_t n, Format *newFormat)}, | | | |
| * {@link #setFormat(int32_t n, Format& newFormat)}, | | | |
| * {@link #format(const Formattable* source, int32_t count, UnicodeString& | | | |
| appendTo, FieldPosition& ignore, UErrorCode& success)}, | | | |
| * {@link #format(const UnicodeString& pattern,const Formattable* arguments | | | |
| ,int32_t cnt,UnicodeString& appendTo,UErrorCode& success)}, | | | |
| * {@link #format(const Formattable& source, UnicodeString& appendTo, Field | | | |
| Position& ignore, UErrorCode& success)}, | | | |
| * {@link #format(const Formattable* arguments, int32_t cnt, UnicodeString& | | | |
| appendTo, FieldPosition& status, int32_t recursionProtection,UErrorCode& s | | | |
| uccess)}, | | | |
| * {@link #parse(const UnicodeString& source, ParsePosition& pos, int32_t& | | | |
| count)}, | | | |
| * {@link #parse(const UnicodeString& source, int32_t& cnt, UErrorCode& sta | | | |
| tus)} | | | |
| * | | * | |
|
| * <P> | | * <p>When formatting, MessageFormat takes a collection of argument values | |
| * During parsing, an input string is matched against the string | | * and writes an output string. | |
| * template of the MessageFormat to produce an array of Formattable | | * The argument values may be passed as an array | |
| * objects. Plain text of the template string is matched directly | | * (when the pattern contains only numbered arguments) | |
| * against input text. At each position in the template string where | | * or as an array of names and and an array of arguments (which works for b | |
| * a subformat is located, the subformat is called to parse the | | oth named | |
| * corresponding segment of input text to produce an output argument. | | * and numbered arguments). | |
| * In this way, an array of arguments is created which together | | * | |
| * constitute the parse result. | | * <p>Each argument is matched with one of the input values by array index | |
| * <P> | | or argument name | |
| * Parsing may fail or produce unexpected results in a number of | | * and formatted according to its pattern specification | |
| * circumstances. | | * (or using a custom Format object if one was set). | |
| * <UL> | | * A numbered pattern argument is matched with an argument name that contai | |
| * <LI>If one of the arguments does not occur in the pattern, it | | ns that number | |
| * will be returned as a default Formattable. | | * as an ASCII-decimal-digit string (without leading zero). | |
| * <LI>If the format of an argument loses information, such as with | | * | |
| * a choice format where a large number formats to "many", then the | | * <h4><a name="patterns">Patterns and Their Interpretation</a></h4> | |
| * parse may not correspond to the originally formatted argument. | | * | |
| * <LI>MessageFormat does not handle ChoiceFormat recursion during | | * <code>MessageFormat</code> uses patterns of the following form: | |
| * parsing; such parses will fail. | | * <pre> | |
| * <LI>Parsing will not always find a match (or the correct match) if | | * message = messageText (argument messageText)* | |
| * some part of the parse is ambiguous. For example, if the pattern | | * argument = noneArg | simpleArg | complexArg | |
| * "{1},{2}" is used with the string arguments {"a,b", "c"}, it will | | * complexArg = choiceArg | pluralArg | selectArg | |
| * format as "a,b,c". When the result is parsed, it will return {"a", | | * | |
| * "b,c"}. | | * noneArg = '{' argNameOrNumber '}' | |
| * <LI>If a single argument is formatted more than once in the string, | | * simpleArg = '{' argNameOrNumber ',' argType [',' argStyle] '}' | |
| * then the rightmost subformat in the pattern string will produce the | | * choiceArg = '{' argNameOrNumber ',' "choice" ',' choiceStyle '}' | |
| * parse result; prior subformats with the same argument index will | | * pluralArg = '{' argNameOrNumber ',' "plural" ',' pluralStyle '}' | |
| * have no effect. | | * selectArg = '{' argNameOrNumber ',' "select" ',' selectStyle '}' | |
| * </UL> | | * | |
| * Here are some examples of usage: | | * choiceStyle: see {@link ChoiceFormat} | |
| * <P> | | * pluralStyle: see {@link PluralFormat} | |
| | | * selectStyle: see {@link SelectFormat} | |
| | | * | |
| | | * argNameOrNumber = argName | argNumber | |
| | | * argName = [^[[:Pattern_Syntax:][:Pattern_White_Space:]]]+ | |
| | | * argNumber = '0' | ('1'..'9' ('0'..'9')*) | |
| | | * | |
| | | * argType = "number" | "date" | "time" | "spellout" | "ordinal" | "duratio | |
| | | n" | |
| | | * argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | |
| | | | "percent" | argStyleText | |
| | | * </pre> | |
| | | * | |
| | | * <ul> | |
| | | * <li>messageText can contain quoted literal strings including syntax ch | |
| | | aracters. | |
| | | * A quoted literal string begins with an ASCII apostrophe and a synt | |
| | | ax character | |
| | | * (usually a {curly brace}) and continues until the next single apos | |
| | | trophe. | |
| | | * A double ASCII apostrohpe inside or outside of a quoted string rep | |
| | | resents | |
| | | * one literal apostrophe. | |
| | | * <li>Quotable syntax characters are the {curly braces} in all messageTe | |
| | | xt parts, | |
| | | * plus the '#' sign in a messageText immediately inside a pluralStyl | |
| | | e, | |
| | | * and the '|' symbol in a messageText immediately inside a choiceSty | |
| | | le. | |
| | | * <li>See also {@link #UMessagePatternApostropheMode} | |
| | | * <li>In argStyleText, every single ASCII apostrophe begins and ends quo | |
| | | ted literal text, | |
| | | * and unquoted {curly braces} must occur in matched pairs. | |
| | | * </ul> | |
| | | * | |
| | | * <p>Recommendation: Use the real apostrophe (single quote) character | |
| | | * \htmlonly’\endhtmlonly (U+2019) for | |
| | | * human-readable text, and use the ASCII apostrophe ' (U+0027) | |
| | | * only in program syntax, like quoting in MessageFormat. | |
| | | * See the annotations for U+0027 Apostrophe in The Unicode Standard. | |
| | | * | |
| | | * <p>The <code>argType</code> and <code>argStyle</code> values are used to | |
| | | create | |
| | | * a <code>Format</code> instance for the format element. The following | |
| | | * table shows how the values map to Format instances. Combinations not | |
| | | * shown in the table are illegal. Any <code>argStyleText</code> must | |
| | | * be a valid pattern string for the Format subclass used. | |
| | | * | |
| | | * <p><table border=1> | |
| | | * <tr> | |
| | | * <th>argType | |
| | | * <th>argStyle | |
| | | * <th>resulting Format object | |
| | | * <tr> | |
| | | * <td colspan=2><i>(none)</i> | |
| | | * <td><code>null</code> | |
| | | * <tr> | |
| | | * <td rowspan=5><code>number</code> | |
| | | * <td><i>(none)</i> | |
| | | * <td><code>NumberFormat.createInstance(getLocale(), status)</code> | |
| | | * <tr> | |
| | | * <td><code>integer</code> | |
| | | * <td><code>NumberFormat.createInstance(getLocale(), kNumberStyle, s | |
| | | tatus)</code> | |
| | | * <tr> | |
| | | * <td><code>currency</code> | |
| | | * <td><code>NumberFormat.createCurrencyInstance(getLocale(), status) | |
| | | </code> | |
| | | * <tr> | |
| | | * <td><code>percent</code> | |
| | | * <td><code>NumberFormat.createPercentInstance(getLocale(), status)< | |
| | | /code> | |
| | | * <tr> | |
| | | * <td><i>argStyleText</i> | |
| | | * <td><code>new DecimalFormat(argStyleText, new DecimalFormatSymbols | |
| | | (getLocale(), status), status)</code> | |
| | | * <tr> | |
| | | * <td rowspan=6><code>date</code> | |
| | | * <td><i>(none)</i> | |
| | | * <td><code>DateFormat.createDateInstance(kDefault, getLocale(), sta | |
| | | tus)</code> | |
| | | * <tr> | |
| | | * <td><code>short</code> | |
| | | * <td><code>DateFormat.createDateInstance(kShort, getLocale(), statu | |
| | | s)</code> | |
| | | * <tr> | |
| | | * <td><code>medium</code> | |
| | | * <td><code>DateFormat.createDateInstance(kDefault, getLocale(), sta | |
| | | tus)</code> | |
| | | * <tr> | |
| | | * <td><code>long</code> | |
| | | * <td><code>DateFormat.createDateInstance(kLong, getLocale(), status | |
| | | )</code> | |
| | | * <tr> | |
| | | * <td><code>full</code> | |
| | | * <td><code>DateFormat.createDateInstance(kFull, getLocale(), status | |
| | | )</code> | |
| | | * <tr> | |
| | | * <td><i>argStyleText</i> | |
| | | * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status) | |
| | | * <tr> | |
| | | * <td rowspan=6><code>time</code> | |
| | | * <td><i>(none)</i> | |
| | | * <td><code>DateFormat.createTimeInstance(kDefault, getLocale(), sta | |
| | | tus)</code> | |
| | | * <tr> | |
| | | * <td><code>short</code> | |
| | | * <td><code>DateFormat.createTimeInstance(kShort, getLocale(), statu | |
| | | s)</code> | |
| | | * <tr> | |
| | | * <td><code>medium</code> | |
| | | * <td><code>DateFormat.createTimeInstance(kDefault, getLocale(), sta | |
| | | tus)</code> | |
| | | * <tr> | |
| | | * <td><code>long</code> | |
| | | * <td><code>DateFormat.createTimeInstance(kLong, getLocale(), status | |
| | | )</code> | |
| | | * <tr> | |
| | | * <td><code>full</code> | |
| | | * <td><code>DateFormat.createTimeInstance(kFull, getLocale(), status | |
| | | )</code> | |
| | | * <tr> | |
| | | * <td><i>argStyleText</i> | |
| | | * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status) | |
| | | * <tr> | |
| | | * <td><code>spellout</code> | |
| | | * <td><i>argStyleText (optional)</i> | |
| | | * <td><code>new RuleBasedNumberFormat(URBNF_SPELLOUT, getLocale(), s | |
| | | tatus) | |
| | | * <br/> .setDefaultRuleset(argStyleText, | |
| | | status);</code> | |
| | | * <tr> | |
| | | * <td><code>ordinal</code> | |
| | | * <td><i>argStyleText (optional)</i> | |
| | | * <td><code>new RuleBasedNumberFormat(URBNF_ORDINAL, getLocale(), st | |
| | | atus) | |
| | | * <br/> .setDefaultRuleset(argStyleText, | |
| | | status);</code> | |
| | | * <tr> | |
| | | * <td><code>duration</code> | |
| | | * <td><i>argStyleText (optional)</i> | |
| | | * <td><code>new RuleBasedNumberFormat(URBNF_DURATION, getLocale(), s | |
| | | tatus) | |
| | | * <br/> .setDefaultRuleset(argStyleText, | |
| | | status);</code> | |
| | | * </table> | |
| | | * <p> | |
| | | * | |
| | | * <h4>Usage Information</h4> | |
| | | * | |
| | | * <p>Here are some examples of usage: | |
| * Example 1: | | * Example 1: | |
|
| | | * | |
| * <pre> | | * <pre> | |
| * \code | | * \code | |
| * UErrorCode success = U_ZERO_ERROR; | | * UErrorCode success = U_ZERO_ERROR; | |
| * GregorianCalendar cal(success); | | * GregorianCalendar cal(success); | |
| * Formattable arguments[] = { | | * Formattable arguments[] = { | |
| * 7L, | | * 7L, | |
| * Formattable( (Date) cal.getTime(success), Formattable::kIsDate), | | * Formattable( (Date) cal.getTime(success), Formattable::kIsDate), | |
| * "a disturbance in the Force" | | * "a disturbance in the Force" | |
| * }; | | * }; | |
| * | | * | |
| * UnicodeString result; | | * UnicodeString result; | |
| * MessageFormat::format( | | * MessageFormat::format( | |
| * "At {1,time} on {1,date}, there was {2} on planet {0,number}.", | | * "At {1,time} on {1,date}, there was {2} on planet {0,number}.", | |
| * arguments, 3, result, success ); | | * arguments, 3, result, success ); | |
| * | | * | |
| * cout << "result: " << result << endl; | | * cout << "result: " << result << endl; | |
| * //<output>: At 4:34:20 PM on 23-Mar-98, there was a disturbance | | * //<output>: At 4:34:20 PM on 23-Mar-98, there was a disturbance | |
| * // in the Force on planet 7. | | * // in the Force on planet 7. | |
| * \endcode | | * \endcode | |
| * </pre> | | * </pre> | |
|
| | | * | |
| * Typically, the message format will come from resources, and the | | * Typically, the message format will come from resources, and the | |
| * arguments will be dynamically set at runtime. | | * arguments will be dynamically set at runtime. | |
|
| * <P> | | * | |
| * Example 2: | | * <p>Example 2: | |
| | | * | |
| * <pre> | | * <pre> | |
| * \code | | * \code | |
| * success = U_ZERO_ERROR; | | * success = U_ZERO_ERROR; | |
| * Formattable testArgs[] = {3L, "MyDisk"}; | | * Formattable testArgs[] = {3L, "MyDisk"}; | |
| * | | * | |
| * MessageFormat form( | | * MessageFormat form( | |
| * "The disk \"{1}\" contains {0} file(s).", success ); | | * "The disk \"{1}\" contains {0} file(s).", success ); | |
| * | | * | |
| * UnicodeString string; | | * UnicodeString string; | |
| * FieldPosition fpos = 0; | | * FieldPosition fpos = 0; | |
| * cout << "format: " << form.format(testArgs, 2, string, fpos, success
) << endl; | | * cout << "format: " << form.format(testArgs, 2, string, fpos, success
) << endl; | |
| * | | * | |
| * // output, with different testArgs: | | * // output, with different testArgs: | |
| * // output: The disk "MyDisk" contains 0 file(s). | | * // output: The disk "MyDisk" contains 0 file(s). | |
| * // output: The disk "MyDisk" contains 1 file(s). | | * // output: The disk "MyDisk" contains 1 file(s). | |
| * // output: The disk "MyDisk" contains 1,273 file(s). | | * // output: The disk "MyDisk" contains 1,273 file(s). | |
| * \endcode | | * \endcode | |
| * </pre> | | * </pre> | |
| * | | * | |
|
| * The pattern is of the following form. Legend: | | | |
| * <pre> | | | |
| * \code | | | |
| * {optional item} | | | |
| * (group that may be repeated)* | | | |
| * \endcode | | | |
| * </pre> | | | |
| * Do not confuse optional items with items inside quoted braces, such | | | |
| * as this: "{". Quoted braces are literals. | | | |
| * <pre> | | | |
| * \code | | | |
| * messageFormatPattern := string ( "{" messageFormatElement "}" stri | | | |
| ng )* | | | |
| * | | | |
| * messageFormatElement := argumentIndex | argumentName { "," element | | | |
| Format } | | | |
| * | | | |
| * elementFormat := "time" { "," datetimeStyle } | | | |
| * | "date" { "," datetimeStyle } | | | |
| * | "number" { "," numberStyle } | | | |
| * | "choice" "," choiceStyle | | | |
| * | "spellout" { "," spelloutStyle } | | | |
| * | "ordinal" { "," spelloutStyle } | | | |
| * | "duration" { "," spelloutStyle } | | | |
| * | "plural" "," pluralStyle | | | |
| * | "select" "," selectStyle | | | |
| * | | | |
| * datetimeStyle := "short" | | | |
| * | "medium" | | | |
| * | "long" | | | |
| * | "full" | | | |
| * | dateFormatPattern | | | |
| * | | | |
| * numberStyle := "currency" | | | |
| * | "percent" | | | |
| * | "integer" | | | |
| * | numberFormatPattern | | | |
| * | | | |
| * choiceStyle := choiceFormatPattern | | | |
| * | | * | |
|
| * pluralStyle := pluralFormatPattern | | * <p>For messages that include plural forms, you can use a plural argument | |
| * | | : | |
| * selectStyle := selectFormatPattern | | | |
| * | | | |
| * spelloutStyle := ruleSetName | | | |
| * \endcode | | | |
| * </pre> | | | |
| * If there is no elementFormat, then the argument must be a string, | | | |
| * which is substituted. If there is no dateTimeStyle or numberStyle, | | | |
| * then the default format is used (e.g. NumberFormat::createInstance(), | | | |
| * DateFormat::createTimeInstance(DateFormat::kDefault, ...) or | | | |
| * DateFormat::createDateInstance(DateFormat::kDefault, ...). For | | | |
| * a RuleBasedNumberFormat, if there is no ruleSetName, the default | | | |
| * rule set is used. For a ChoiceFormat or PluralFormat or SelectFormat, th | | | |
| e pattern | | | |
| * must always be specified, since there is no default. | | | |
| * <P> | | | |
| * In strings, single quotes can be used to quote syntax characters. | | | |
| * A literal single quote is represented by '', both within and outside | | | |
| * of single-quoted segments. Inside a | | | |
| * messageFormatElement, quotes are <EM>not</EM> removed. For example, | | | |
| * {1,number,$'#',##} will produce a number format with the pound-sign | | | |
| * quoted, with a result such as: "$#31,45". | | | |
| * <P> | | | |
| * If a pattern is used, then unquoted braces in the pattern, if any, | | | |
| * must match: that is, "ab {0} de" and "ab '}' de" are ok, but "ab | | | |
| * {0'}' de" and "ab } de" are not. | | | |
| * <p> | | | |
| * <dl><dt><b>Warning:</b><dd>The rules for using quotes within message | | | |
| * format patterns unfortunately have shown to be somewhat confusing. | | | |
| * In particular, it isn't always obvious to localizers whether single | | | |
| * quotes need to be doubled or not. Make sure to inform localizers about | | | |
| * the rules, and tell them (for example, by using comments in resource | | | |
| * bundle source files) which strings will be processed by MessageFormat. | | | |
| * Note that localizers may need to use single quotes in translated | | | |
| * strings where the original version doesn't have them. | | | |
| * <br>Note also that the simplest way to avoid the problem is to | | | |
| * use the real apostrophe (single quote) character U+2019 (') for | | | |
| * human-readable text, and to use the ASCII apostrophe (U+0027 ' ) | | | |
| * only in program syntax, like quoting in MessageFormat. | | | |
| * See the annotations for U+0027 Apostrophe in The Unicode Standard.</p> | | | |
| * </dl> | | | |
| * <P> | | | |
| * The argumentIndex is a non-negative integer, which corresponds to the | | | |
| * index of the arguments presented in an array to be formatted. The | | | |
| * first argument has argumentIndex 0. | | | |
| * <P> | | | |
| * It is acceptable to have unused arguments in the array. With missing | | | |
| * arguments, or arguments that are not of the right class for the | | | |
| * specified format, a failing UErrorCode result is set. | | | |
| * <P> | | | |
| * <strong>Creating internationalized messages that include plural forms, y | | | |
| ou | | | |
| * can use a PluralFormat:</strong> | | | |
| * <pre> | | * <pre> | |
| * \code | | * \code | |
|
| * UErrorCode err = U_ZERO_ERROR; | | * success = U_ZERO_ERROR; | |
| * UnicodeString t1("{0, plural, one{C''est # fichier} other{Ce sont # fic | | * MessageFormat msgFmt( | |
| hiers}} dans la liste."); | | * "{num_files, plural, " | |
| * MessageFormat* msgFmt = new MessageFormat(t1, Locale("fr"), err); | | * "=0{There are no files on disk \"{disk_name}\".}" | |
| * if (U_FAILURE(err)) { | | * "=1{There is one file on disk \"{disk_name}\".}" | |
| * return err; | | * "other{There are # files on disk \"{disk_name}\".}}", | |
| * } | | * Locale("en"), | |
| * | | * success); | |
| * Formattable args1[] = {(int32_t)0}; | | * FieldPosition fpos = 0; | |
| * Formattable args2[] = {(int32_t)3}; | | * Formattable testArgs[] = {0L, "MyDisk"}; | |
| * FieldPosition ignore(FieldPosition::DONT_CARE); | | * UnicodeString testArgsNames[] = {"num_files", "disk_name"}; | |
| * UnicodeString result; | | * UnicodeString result; | |
|
| * msgFmt->format(args1, 1, result, ignore, status); | | * cout << msgFmt.format(testArgs, testArgsNames, 2, result, fpos, 0, succ | |
| * cout << result << endl; | | ess); | |
| * result.remove(); | | * testArgs[0] = 3L; | |
| * msgFmt->format(args2, 1, result, ignore, status); | | * cout << msgFmt.format(testArgs, testArgsNames, 2, result, fpos, 0, succ | |
| * cout << result << endl; | | ess); | |
| * | | | |
| * // output, with different args | | | |
| * // output: C'est 0,0 fichier dans la liste. | | | |
| * // output: Ce sont 3 fichiers dans la liste." | | | |
| * \endcode | | * \endcode | |
|
| | | * <em>output</em>: | |
| | | * There are no files on disk "MyDisk". | |
| | | * There are 3 files on "MyDisk". | |
| * </pre> | | * </pre> | |
|
| * Please check PluralFormat and PluralRules for details. | | * See {@link PluralFormat} and {@link PluralRules} for details. | |
| * </P> | | * | |
| | | * <h4><a name="synchronization">Synchronization</a></h4> | |
| | | * | |
| | | * <p>MessageFormats are not synchronized. | |
| | | * It is recommended to create separate format instances for each thread. | |
| | | * If multiple threads access a format concurrently, it must be synchronize | |
| | | d | |
| | | * externally. | |
| | | * | |
| | | * @stable ICU 2.0 | |
| */ | | */ | |
| class U_I18N_API MessageFormat : public Format { | | class U_I18N_API MessageFormat : public Format { | |
| public: | | public: | |
| /** | | /** | |
| * Enum type for kMaxFormat. | | * Enum type for kMaxFormat. | |
| * @obsolete ICU 3.0. The 10-argument limit was removed as of ICU 2.6, | | * @obsolete ICU 3.0. The 10-argument limit was removed as of ICU 2.6, | |
| * rendering this enum type obsolete. | | * rendering this enum type obsolete. | |
| */ | | */ | |
| enum EFormatNumber { | | enum EFormatNumber { | |
| /** | | /** | |
| | | | |
| skipping to change at line 334 | | skipping to change at line 361 | |
| * pattern cannot be parsed, set to failure code. | | * pattern cannot be parsed, set to failure code. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| MessageFormat(const UnicodeString& pattern, | | MessageFormat(const UnicodeString& pattern, | |
| const Locale& newLocale, | | const Locale& newLocale, | |
| UErrorCode& status); | | UErrorCode& status); | |
| /** | | /** | |
| * Constructs a new MessageFormat using the given pattern and locale. | | * Constructs a new MessageFormat using the given pattern and locale. | |
| * @param pattern Pattern used to construct object. | | * @param pattern Pattern used to construct object. | |
| * @param newLocale The locale to use for formatting dates and numbers. | | * @param newLocale The locale to use for formatting dates and numbers. | |
|
| * @param parseError Struct to recieve information on position | | * @param parseError Struct to receive information on the position | |
| * of error within the pattern. | | * of an error within the pattern. | |
| * @param status Input/output error code. If the | | * @param status Input/output error code. If the | |
| * pattern cannot be parsed, set to failure code. | | * pattern cannot be parsed, set to failure code. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| MessageFormat(const UnicodeString& pattern, | | MessageFormat(const UnicodeString& pattern, | |
| const Locale& newLocale, | | const Locale& newLocale, | |
| UParseError& parseError, | | UParseError& parseError, | |
| UErrorCode& status); | | UErrorCode& status); | |
| /** | | /** | |
| * Constructs a new MessageFormat from an existing one. | | * Constructs a new MessageFormat from an existing one. | |
| | | | |
| skipping to change at line 379 | | skipping to change at line 406 | |
| /** | | /** | |
| * Returns true if the given Format objects are semantically equal. | | * Returns true if the given Format objects are semantically equal. | |
| * Objects of different subclasses are considered unequal. | | * Objects of different subclasses are considered unequal. | |
| * @param other the object to be compared with. | | * @param other the object to be compared with. | |
| * @return true if the given Format objects are semantically equa
l. | | * @return true if the given Format objects are semantically equa
l. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UBool operator==(const Format& other) const; | | virtual UBool operator==(const Format& other) const; | |
| | | | |
| /** | | /** | |
|
| * Sets the locale. This locale is used for fetching default number or | | * Sets the locale to be used for creating argument Format objects. | |
| date | | | |
| * format information. | | | |
| * @param theLocale the new locale value to be set. | | * @param theLocale the new locale value to be set. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual void setLocale(const Locale& theLocale); | | virtual void setLocale(const Locale& theLocale); | |
| | | | |
| /** | | /** | |
|
| * Gets the locale. This locale is used for fetching default number or
date | | * Gets the locale used for creating argument Format objects. | |
| * format information. | | * format information. | |
| * @return the locale of the object. | | * @return the locale of the object. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual const Locale& getLocale(void) const; | | virtual const Locale& getLocale(void) const; | |
| | | | |
| /** | | /** | |
| * Applies the given pattern string to this message format. | | * Applies the given pattern string to this message format. | |
| * | | * | |
| * @param pattern The pattern to be applied. | | * @param pattern The pattern to be applied. | |
| * @param status Input/output error code. If the | | * @param status Input/output error code. If the | |
| * pattern cannot be parsed, set to failure code. | | * pattern cannot be parsed, set to failure code. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual void applyPattern(const UnicodeString& pattern, | | virtual void applyPattern(const UnicodeString& pattern, | |
| UErrorCode& status); | | UErrorCode& status); | |
| /** | | /** | |
| * Applies the given pattern string to this message format. | | * Applies the given pattern string to this message format. | |
| * | | * | |
| * @param pattern The pattern to be applied. | | * @param pattern The pattern to be applied. | |
|
| * @param parseError Struct to recieve information on position | | * @param parseError Struct to receive information on the position | |
| * of error within pattern. | | * of an error within the pattern. | |
| * @param status Input/output error code. If the | | * @param status Input/output error code. If the | |
| * pattern cannot be parsed, set to failure code. | | * pattern cannot be parsed, set to failure code. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual void applyPattern(const UnicodeString& pattern, | | virtual void applyPattern(const UnicodeString& pattern, | |
| UParseError& parseError, | | UParseError& parseError, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
|
| | | * Sets the UMessagePatternApostropheMode and the pattern used by this | |
| | | message format. | |
| | | * Parses the pattern and caches Format objects for simple argument typ | |
| | | es. | |
| | | * Patterns and their interpretation are specified in the | |
| | | * <a href="#patterns">class description</a>. | |
| | | * <p> | |
| | | * This method is best used only once on a given object to avoid confus | |
| | | ion about the mode, | |
| | | * and after constructing the object with an empty pattern string to mi | |
| | | nimize overhead. | |
| | | * | |
| | | * @param pattern The pattern to be applied. | |
| | | * @param aposMode The new apostrophe mode. | |
| | | * @param parseError Struct to receive information on the position | |
| | | * of an error within the pattern. | |
| | | * Can be NULL. | |
| | | * @param status Input/output error code. If the | |
| | | * pattern cannot be parsed, set to failure code. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | virtual void applyPattern(const UnicodeString& pattern, | |
| | | UMessagePatternApostropheMode aposMode, | |
| | | UParseError* parseError, | |
| | | UErrorCode& status); | |
| | | | |
| | | /** | |
| | | * @return this instance's UMessagePatternApostropheMode. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | UMessagePatternApostropheMode getApostropheMode() const { | |
| | | return msgPattern.getApostropheMode(); | |
| | | } | |
| | | | |
| | | /** | |
| * Returns a pattern that can be used to recreate this object. | | * Returns a pattern that can be used to recreate this object. | |
| * | | * | |
| * @param appendTo Output parameter to receive the pattern. | | * @param appendTo Output parameter to receive the pattern. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @return Reference to 'appendTo' parameter. | | * @return Reference to 'appendTo' parameter. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UnicodeString& toPattern(UnicodeString& appendTo) const; | | virtual UnicodeString& toPattern(UnicodeString& appendTo) const; | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 492 | | skipping to change at line 549 | |
| * the item will be ignored. | | * the item will be ignored. | |
| * @param formatNumber index of the subformat. | | * @param formatNumber index of the subformat. | |
| * @param format the format to be set. | | * @param format the format to be set. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual void setFormat(int32_t formatNumber, const Format& format); | | virtual void setFormat(int32_t formatNumber, const Format& format); | |
| | | | |
| /** | | /** | |
| * Gets format names. This function returns formatNames in StringEnumer
ations | | * Gets format names. This function returns formatNames in StringEnumer
ations | |
| * which can be used with getFormat() and setFormat() to export formatt
able | | * which can be used with getFormat() and setFormat() to export formatt
able | |
|
| * array from current MessageFormat to another. It is caller's resposi
bility | | * array from current MessageFormat to another. It is the caller's res
ponsibility | |
| * to delete the returned formatNames. | | * to delete the returned formatNames. | |
| * @param status output param set to success/failure code. | | * @param status output param set to success/failure code. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| virtual StringEnumeration* getFormatNames(UErrorCode& status); | | virtual StringEnumeration* getFormatNames(UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Gets subformat pointer for given format name. | | * Gets subformat pointer for given format name. | |
| * This function supports both named and numbered | | * This function supports both named and numbered | |
|
| * arguments-- if numbered, the formatName is the | | * arguments. If numbered, the formatName is the | |
| * corresponding UnicodeStrings (e.g. "0", "1", "2"...). | | * corresponding UnicodeStrings (e.g. "0", "1", "2"...). | |
| * The returned Format object should not be deleted by the caller, | | * The returned Format object should not be deleted by the caller, | |
| * nor should the ponter of other object . The pointer and its | | * nor should the ponter of other object . The pointer and its | |
| * contents remain valid only until the next call to any method | | * contents remain valid only until the next call to any method | |
| * of this class is made with this object. | | * of this class is made with this object. | |
| * @param formatName the name or number specifying a format | | * @param formatName the name or number specifying a format | |
| * @param status output param set to success/failure code. | | * @param status output param set to success/failure code. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| virtual Format* getFormat(const UnicodeString& formatName, UErrorCode&
status); | | virtual Format* getFormat(const UnicodeString& formatName, UErrorCode&
status); | |
| | | | |
| skipping to change at line 794 | | skipping to change at line 851 | |
| * <pre> | | * <pre> | |
| * . Base* polymorphic_pointer = createPolymorphicObject(); | | * . Base* polymorphic_pointer = createPolymorphicObject(); | |
| * . if (polymorphic_pointer->getDynamicClassID() == | | * . if (polymorphic_pointer->getDynamicClassID() == | |
| * . Derived::getStaticClassID()) ... | | * . Derived::getStaticClassID()) ... | |
| * </pre> | | * </pre> | |
| * @return The class ID for all objects of this class. | | * @return The class ID for all objects of this class. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| static UClassID U_EXPORT2 getStaticClassID(void); | | static UClassID U_EXPORT2 getStaticClassID(void); | |
| | | | |
|
| | | /** | |
| | | * Compares two Format objects. This is used for constructing the hash | |
| | | * tables. | |
| | | * | |
| | | * @param left pointer to a Format object. Must not be NULL. | |
| | | * @param right pointer to a Format object. Must not be NULL. | |
| | | * | |
| | | * @return whether the two objects are the same | |
| | | * @internal | |
| | | */ | |
| | | static UBool equalFormats(const void* left, const void* right); | |
| | | | |
| private: | | private: | |
| | | | |
| Locale fLocale; | | Locale fLocale; | |
|
| UnicodeString fPattern; | | MessagePattern msgPattern; | |
| Format** formatAliases; // see getFormats | | Format** formatAliases; // see getFormats | |
| int32_t formatAliasesCapacity; | | int32_t formatAliasesCapacity; | |
|
| UProperty idStart; | | | |
| UProperty idContinue; | | | |
| | | | |
| MessageFormat(); // default constructor not implemented | | MessageFormat(); // default constructor not implemented | |
| | | | |
|
| /* | | /** | |
| * A structure representing one subformat of this MessageFormat. | | * This provider helps defer instantiation of a PluralRules object | |
| * Each subformat has a Format object, an offset into the plain | | * until we actually need to select a keyword. | |
| * pattern text fPattern, and an argument number. The argument | | * For example, if the number matches an explicit-value selector like | |
| * number corresponds to the array of arguments to be formatted. | | "=1" | |
| * @internal | | * we do not need any PluralRules. | |
| */ | | */ | |
| class Subformat; | | class U_I18N_API PluralSelectorProvider : public PluralFormat::PluralSe | |
| | | lector { | |
| | | public: | |
| | | PluralSelectorProvider(const Locale* loc); | |
| | | virtual ~PluralSelectorProvider(); | |
| | | virtual UnicodeString select(double number, UErrorCode& ec) const; | |
| | | | |
|
| /** | | void reset(const Locale* loc); | |
| * A MessageFormat contains an array of subformats. This array | | private: | |
| * needs to grow dynamically if the MessageFormat is modified. | | const Locale* locale; | |
| */ | | PluralRules* rules; | |
| Subformat* subformats; | | }; | |
| int32_t subformatCount; | | | |
| int32_t subformatCapacity; | | | |
| | | | |
| /** | | /** | |
| * A MessageFormat formats an array of arguments. Each argument | | * A MessageFormat formats an array of arguments. Each argument | |
| * has an expected type, based on the pattern. For example, if | | * has an expected type, based on the pattern. For example, if | |
| * the pattern contains the subformat "{3,number,integer}", then | | * the pattern contains the subformat "{3,number,integer}", then | |
| * we expect argument 3 to have type Formattable::kLong. This | | * we expect argument 3 to have type Formattable::kLong. This | |
| * array needs to grow dynamically if the MessageFormat is | | * array needs to grow dynamically if the MessageFormat is | |
| * modified. | | * modified. | |
| */ | | */ | |
| Formattable::Type* argTypes; | | Formattable::Type* argTypes; | |
| int32_t argTypeCount; | | int32_t argTypeCount; | |
| int32_t argTypeCapacity; | | int32_t argTypeCapacity; | |
| | | | |
| /** | | /** | |
|
| * Is true iff all argument names are non-negative numbers. | | * TRUE if there are different argTypes for the same argument. | |
| * | | * This only matters when the MessageFormat is used in the plain C (ums | |
| */ | | g_xxx) API | |
| UBool isArgNumeric; | | * where the pattern argTypes determine how the va_arg list is read. | |
| | | */ | |
| | | UBool hasArgTypeConflicts; | |
| | | | |
| // Variable-size array management | | // Variable-size array management | |
|
| UBool allocateSubformats(int32_t capacity); | | UBool allocateArgTypes(int32_t capacity, UErrorCode& status); | |
| UBool allocateArgTypes(int32_t capacity); | | | |
| | | | |
| /** | | /** | |
| * Default Format objects used when no format is specified and a | | * Default Format objects used when no format is specified and a | |
| * numeric or date argument is formatted. These are volatile | | * numeric or date argument is formatted. These are volatile | |
| * cache objects maintained only for performance. They do not | | * cache objects maintained only for performance. They do not | |
| * participate in operator=(), copy constructor(), nor | | * participate in operator=(), copy constructor(), nor | |
| * operator==(). | | * operator==(). | |
| */ | | */ | |
| NumberFormat* defaultNumberFormat; | | NumberFormat* defaultNumberFormat; | |
| DateFormat* defaultDateFormat; | | DateFormat* defaultDateFormat; | |
| | | | |
|
| | | UHashtable* cachedFormatters; | |
| | | UHashtable* customFormatArgStarts; | |
| | | | |
| | | PluralSelectorProvider pluralProvider; | |
| | | | |
| /** | | /** | |
| * Method to retrieve default formats (or NULL on failure). | | * Method to retrieve default formats (or NULL on failure). | |
| * These are semantically const, but may modify *this. | | * These are semantically const, but may modify *this. | |
| */ | | */ | |
| const NumberFormat* getDefaultNumberFormat(UErrorCode&) const; | | const NumberFormat* getDefaultNumberFormat(UErrorCode&) const; | |
| const DateFormat* getDefaultDateFormat(UErrorCode&) const; | | const DateFormat* getDefaultDateFormat(UErrorCode&) const; | |
| | | | |
| /** | | /** | |
| * Finds the word s, in the keyword list and returns the located index. | | * Finds the word s, in the keyword list and returns the located index. | |
| * @param s the keyword to be searched for. | | * @param s the keyword to be searched for. | |
| * @param list the list of keywords to be searched with. | | * @param list the list of keywords to be searched with. | |
| * @return the index of the list which matches the keyword s. | | * @return the index of the list which matches the keyword s. | |
| */ | | */ | |
| static int32_t findKeyword( const UnicodeString& s, | | static int32_t findKeyword( const UnicodeString& s, | |
| const UChar * const *list); | | const UChar * const *list); | |
| | | | |
| /** | | /** | |
|
| * Formats the array of arguments and copies the result into the | | * Thin wrapper around the format(... AppendableWrapper ...) variant. | |
| * result buffer, updates the field position. | | * Wraps the destination UnicodeString into an AppendableWrapper and | |
| | | * supplies default values for some other parameters. | |
| | | */ | |
| | | UnicodeString& format(const Formattable* arguments, | |
| | | const UnicodeString *argumentNames, | |
| | | int32_t cnt, | |
| | | UnicodeString& appendTo, | |
| | | FieldPosition* pos, | |
| | | UErrorCode& status) const; | |
| | | | |
| | | /** | |
| | | * Formats the arguments and writes the result into the | |
| | | * AppendableWrapper, updates the field position. | |
| * | | * | |
|
| * @param arguments The formattable objects array. | | * @param msgStart Index to msgPattern part to start formatting fr | |
| * @param cnt The array count. | | om. | |
| * @param appendTo Output parameter to receive result. | | * @param pluralNumber Zero except when formatting a plural argument s | |
| * Result is appended to existing contents. | | ub-message | |
| * @param status Field position status. | | * where a '#' is replaced by the format string fo | |
| * @param recursionProtection | | r this number. | |
| * Initially zero. Bits 0..9 are used to indicate | | * @param arguments The formattable objects array. (Must not be NUL | |
| * that a parameter has already been seen, to | | L.) | |
| * avoid recursion. Currently unused. | | * @param argumentNames NULL if numbered values are used. Otherwise the | |
| * @param success The error code status. | | same | |
| * @return Reference to 'appendTo' parameter. | | * length as "arguments", and each entry is the na | |
| | | me of the | |
| | | * corresponding argument in "arguments". | |
| | | * @param cnt The length of arguments (and of argumentNames i | |
| | | f that is not NULL). | |
| | | * @param appendTo Output parameter to receive the result. | |
| | | * The result string is appended to existing conte | |
| | | nts. | |
| | | * @param pos Field position status. | |
| | | * @param success The error code status. | |
| */ | | */ | |
|
| UnicodeString& format( const Formattable* arguments, | | void format(int32_t msgStart, | |
| int32_t cnt, | | double pluralNumber, | |
| UnicodeString& appendTo, | | const Formattable* arguments, | |
| FieldPosition& status, | | const UnicodeString *argumentNames, | |
| int32_t recursionProtection, | | int32_t cnt, | |
| UErrorCode& success) const; | | AppendableWrapper& appendTo, | |
| | | FieldPosition* pos, | |
| | | UErrorCode& success) const; | |
| | | | |
|
| UnicodeString& format( const Formattable* arguments, | | UnicodeString getArgName(int32_t partIndex); | |
| const UnicodeString *argumentNames, | | | |
| int32_t cnt, | | | |
| UnicodeString& appendTo, | | | |
| FieldPosition& status, | | | |
| int32_t recursionProtection, | | | |
| UErrorCode& success) const; | | | |
| | | | |
|
| void makeFormat(int32_t offsetNumber, | | void setArgStartFormat(int32_t argStart, Format* formatter, UErrorCode& | |
| UnicodeString* segments, | | status); | |
| UParseError& parseError, | | | |
| UErrorCode& success); | | void setCustomArgStartFormat(int32_t argStart, Format* formatter, UErro | |
| | | rCode& status); | |
| | | | |
| | | int32_t nextTopLevelArgStart(int32_t partIndex) const; | |
| | | | |
| | | bool argNameMatches(int32_t partIndex, const UnicodeString& argName, in | |
| | | t32_t argNumber); | |
| | | | |
| | | void cacheExplicitFormats(UErrorCode& status); | |
| | | | |
| | | Format* createAppropriateFormat(UnicodeString& type, | |
| | | UnicodeString& style, | |
| | | Formattable::Type& formattableType, | |
| | | UParseError& parseError, | |
| | | UErrorCode& ec); | |
| | | | |
| | | const Formattable* getArgFromListByName(const Formattable* arguments, | |
| | | const UnicodeString *argumentNa | |
| | | mes, | |
| | | int32_t cnt, UnicodeString& nam | |
| | | e) const; | |
| | | | |
| | | Formattable* parse(int32_t msgStart, | |
| | | const UnicodeString& source, | |
| | | ParsePosition& pos, | |
| | | int32_t& count, | |
| | | UErrorCode& ec) const; | |
| | | | |
| | | FieldPosition* updateMetaData(AppendableWrapper& dest, int32_t prevLeng | |
| | | th, | |
| | | FieldPosition* fp, const Formattable* arg | |
| | | Id) const; | |
| | | | |
| | | Format* getCachedFormatter(int32_t argumentNumber) const; | |
| | | | |
| | | UnicodeString getLiteralStringUntilNextArgument(int32_t from) const; | |
| | | | |
| | | void copyObjects(const MessageFormat& that, UErrorCode& ec); | |
| | | | |
| | | void formatComplexSubMessage(int32_t msgStart, | |
| | | double pluralNumber, | |
| | | const Formattable* arguments, | |
| | | const UnicodeString *argumentNames, | |
| | | int32_t cnt, | |
| | | AppendableWrapper& appendTo, | |
| | | UErrorCode& success) const; | |
| | | | |
| /** | | /** | |
| * Convenience method that ought to be in NumberFormat | | * Convenience method that ought to be in NumberFormat | |
| */ | | */ | |
| NumberFormat* createIntegerFormat(const Locale& locale, UErrorCode& sta
tus) const; | | NumberFormat* createIntegerFormat(const Locale& locale, UErrorCode& sta
tus) const; | |
| | | | |
| /** | | /** | |
|
| * Checks the range of the source text to quote the special | | | |
| * characters, { and ' and copy to target buffer. | | | |
| * @param source | | | |
| * @param start the text offset to start the process of in the source s | | | |
| tring | | | |
| * @param end the text offset to end the process of in the source strin | | | |
| g | | | |
| * @param appendTo Output parameter to receive result. | | | |
| * Result is appended to existing contents. | | | |
| */ | | | |
| static void copyAndFixQuotes(const UnicodeString& appendTo, int32_t sta | | | |
| rt, int32_t end, UnicodeString& target); | | | |
| | | | |
| /** | | | |
| * Returns array of argument types in the parsed pattern | | * Returns array of argument types in the parsed pattern | |
| * for use in C API. Only for the use of umsg_vformat(). Not | | * for use in C API. Only for the use of umsg_vformat(). Not | |
| * for public consumption. | | * for public consumption. | |
| * @param listCount Output parameter to receive the size of array | | * @param listCount Output parameter to receive the size of array | |
| * @return The array of formattable types in the pattern | | * @return The array of formattable types in the pattern | |
| * @internal | | * @internal | |
| */ | | */ | |
| const Formattable::Type* getArgTypeList(int32_t& listCount) const { | | const Formattable::Type* getArgTypeList(int32_t& listCount) const { | |
| listCount = argTypeCount; | | listCount = argTypeCount; | |
| return argTypes; | | return argTypes; | |
| } | | } | |
| | | | |
| /** | | /** | |
|
| * Returns FALSE if the argument name is not legal. | | * Resets the internal MessagePattern, and other associated caches. | |
| * @param argName argument name. | | | |
| * @return TRUE if the argument name is legal, otherwise return FALSE. | | | |
| */ | | */ | |
|
| UBool isLegalArgName(const UnicodeString& argName) const; | | void resetPattern(); | |
| | | | |
| | | /** | |
| | | * A DummyFormatter that we use solely to store a NULL value. UHash doe | |
| | | s | |
| | | * not support storing NULL values. | |
| | | * @internal | |
| | | */ | |
| | | class U_I18N_API DummyFormat : public Format { | |
| | | public: | |
| | | virtual UBool operator==(const Format&) const; | |
| | | virtual Format* clone() const; | |
| | | virtual UnicodeString& format(const Formattable&, | |
| | | UnicodeString& appendTo, | |
| | | FieldPosition&, | |
| | | UErrorCode& status) const; | |
| | | virtual void parseObject(const UnicodeString&, | |
| | | Formattable&, | |
| | | ParsePosition&) const; | |
| | | virtual UClassID getDynamicClassID() const; | |
| | | }; | |
| | | | |
| friend class MessageFormatAdapter; // getFormatTypeList() access | | friend class MessageFormatAdapter; // getFormatTypeList() access | |
| }; | | }; | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| MessageFormat::format(const Formattable& obj, | | MessageFormat::format(const Formattable& obj, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| UErrorCode& status) const { | | UErrorCode& status) const { | |
| return Format::format(obj, appendTo, status); | | return Format::format(obj, appendTo, status); | |
| } | | } | |
| | | | |
End of changes. 46 change blocks. |
| 298 lines changed or deleted | | 471 lines changed or added | |
|
| numfmt.h | | numfmt.h | |
| /* | | /* | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
|
| * Copyright (C) 1997-2010, International Business Machines Corporation and
others. | | * Copyright (C) 1997-2011, International Business Machines Corporation and
others. | |
| * All Rights Reserved. | | * All Rights Reserved. | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| * | | * | |
| * File NUMFMT.H | | * File NUMFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/19/97 aliu Converted from java. | | * 02/19/97 aliu Converted from java. | |
| * 03/18/97 clhuang Updated per C++ implementation. | | * 03/18/97 clhuang Updated per C++ implementation. | |
| | | | |
| skipping to change at line 39 | | skipping to change at line 39 | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| #include "unicode/unistr.h" | | #include "unicode/unistr.h" | |
| #include "unicode/format.h" | | #include "unicode/format.h" | |
| #include "unicode/unum.h" // UNumberFormatStyle | | #include "unicode/unum.h" // UNumberFormatStyle | |
| #include "unicode/locid.h" | | #include "unicode/locid.h" | |
| #include "unicode/stringpiece.h" | | #include "unicode/stringpiece.h" | |
| | | | |
|
| | | class NumberFormatTest; | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| #if !UCONFIG_NO_SERVICE | | #if !UCONFIG_NO_SERVICE | |
| class NumberFormatFactory; | | class NumberFormatFactory; | |
| class StringEnumeration; | | class StringEnumeration; | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * | | * | |
| * Abstract base class for all number formats. Provides interface for | | * Abstract base class for all number formats. Provides interface for | |
| | | | |
| skipping to change at line 164 | | skipping to change at line 166 | |
| * the end, e.g. with parentheses in negative numbers: "(12)" for -12. | | * the end, e.g. with parentheses in negative numbers: "(12)" for -12. | |
| * <p> | | * <p> | |
| * <em>User subclasses are not supported.</em> While clients may write | | * <em>User subclasses are not supported.</em> While clients may write | |
| * subclasses, such code will not necessarily work and will not be | | * subclasses, such code will not necessarily work and will not be | |
| * guaranteed to work stably from release to release. | | * guaranteed to work stably from release to release. | |
| * | | * | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| class U_I18N_API NumberFormat : public Format { | | class U_I18N_API NumberFormat : public Format { | |
| public: | | public: | |
|
| | | | |
| /** | | | |
| * Constants for various number format styles. | | | |
| * kNumberStyle specifies a normal number style of format. | | | |
| * kCurrencyStyle specifies a currency format using currency symbol nam | | | |
| e, | | | |
| * such as in "$1.00". | | | |
| * kPercentStyle specifies a style of format to display percent. | | | |
| * kScientificStyle specifies a style of format to display scientific n | | | |
| umber. | | | |
| * kISOCurrencyStyle specifies a currency format using ISO currency cod | | | |
| e, | | | |
| * such as in "USD1.00". | | | |
| * kPluralCurrencyStyle specifies a currency format using currency plur | | | |
| al | | | |
| * names, such as in "1.00 US dollar" and "3.00 US dollars". | | | |
| * @draft ICU 4.2 | | | |
| */ | | | |
| enum EStyles { | | | |
| kNumberStyle, | | | |
| kCurrencyStyle, | | | |
| kPercentStyle, | | | |
| kScientificStyle, | | | |
| kIsoCurrencyStyle, | | | |
| kPluralCurrencyStyle, | | | |
| kStyleCount // ALWAYS LAST ENUM: number of styles | | | |
| }; | | | |
| | | | |
| /** | | /** | |
| * Alignment Field constants used to construct a FieldPosition object. | | * Alignment Field constants used to construct a FieldPosition object. | |
| * Signifies that the position of the integer part or fraction part of | | * Signifies that the position of the integer part or fraction part of | |
| * a formatted number should be returned. | | * a formatted number should be returned. | |
| * | | * | |
| * Note: as of ICU 4.4, the values in this enum have been extended to | | * Note: as of ICU 4.4, the values in this enum have been extended to | |
| * support identification of all number format fields, not just those | | * support identification of all number format fields, not just those | |
| * pertaining to alignment. | | * pertaining to alignment. | |
| * | | * | |
| * @see FieldPosition | | * @see FieldPosition | |
| | | | |
| skipping to change at line 623 | | skipping to change at line 601 | |
| /** | | /** | |
| * Sets whether or not numbers should be parsed as integers only. | | * Sets whether or not numbers should be parsed as integers only. | |
| * @param value set True, this format will parse numbers as integers | | * @param value set True, this format will parse numbers as integers | |
| * only. | | * only. | |
| * @see isParseIntegerOnly | | * @see isParseIntegerOnly | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual void setParseIntegerOnly(UBool value); | | virtual void setParseIntegerOnly(UBool value); | |
| | | | |
| /** | | /** | |
|
| | | * Sets whether lenient parsing should be enabled (it is off by default | |
| | | ). | |
| | | * | |
| | | * @param enable <code>TRUE</code> if lenient parsing should be used, | |
| | | * <code>FALSE</code> otherwise. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | virtual void setLenient(UBool enable); | |
| | | | |
| | | /** | |
| | | * Returns whether lenient parsing is enabled (it is off by default). | |
| | | * | |
| | | * @return <code>TRUE</code> if lenient parsing is enabled, | |
| | | * <code>FALSE</code> otherwise. | |
| | | * @see #setLenient | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | virtual UBool isLenient(void) const; | |
| | | | |
| | | /** | |
| * Returns the default number format for the current default | | * Returns the default number format for the current default | |
| * locale. The default format is one of the styles provided by | | * locale. The default format is one of the styles provided by | |
| * the other factory methods: getNumberInstance, | | * the other factory methods: getNumberInstance, | |
| * getCurrencyInstance or getPercentInstance. Exactly which one | | * getCurrencyInstance or getPercentInstance. Exactly which one | |
| * is locale dependant. | | * is locale dependant. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| static NumberFormat* U_EXPORT2 createInstance(UErrorCode&); | | static NumberFormat* U_EXPORT2 createInstance(UErrorCode&); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 646 | | skipping to change at line 643 | |
| * getPercentInstance. Exactly which one is locale dependant. | | * getPercentInstance. Exactly which one is locale dependant. | |
| * @param inLocale the given locale. | | * @param inLocale the given locale. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| static NumberFormat* U_EXPORT2 createInstance(const Locale& inLocale, | | static NumberFormat* U_EXPORT2 createInstance(const Locale& inLocale, | |
| UErrorCode&); | | UErrorCode&); | |
| | | | |
| /** | | /** | |
| * Creates the specified decimal format style of the desired locale. | | * Creates the specified decimal format style of the desired locale. | |
| * @param desiredLocale the given locale. | | * @param desiredLocale the given locale. | |
|
| * @param choice the given style. | | * @param style the given style. | |
| * @param success Output param filled with success/failure sta | | * @param errorCode Output param filled with success/failure sta | |
| tus. | | tus. | |
| * @return A new NumberFormat instance. | | * @return A new NumberFormat instance. | |
|
| * @draft ICU 4.2 | | * @draft ICU 4.8 | |
| */ | | */ | |
|
| static NumberFormat* U_EXPORT2 createInstance(const Locale& desiredLoca | | static NumberFormat* U_EXPORT2 createInstance(const Locale& desiredLoca | |
| le, EStyles choice, UErrorCode& success); | | le, | |
| | | UNumberFormatStyle style, | |
| | | UErrorCode& errorCode); | |
| | | | |
| /** | | /** | |
| * Returns a currency format for the current default locale. | | * Returns a currency format for the current default locale. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| static NumberFormat* U_EXPORT2 createCurrencyInstance(UErrorCode&); | | static NumberFormat* U_EXPORT2 createCurrencyInstance(UErrorCode&); | |
| | | | |
| /** | | /** | |
| * Returns a currency format for the specified locale. | | * Returns a currency format for the specified locale. | |
| * @param inLocale the given locale. | | * @param inLocale the given locale. | |
| | | | |
| skipping to change at line 921 | | skipping to change at line 920 | |
| * should override this method as needed. Unlike getCurrency(), | | * should override this method as needed. Unlike getCurrency(), | |
| * this method should never return "". | | * this method should never return "". | |
| * @result output parameter for null-terminated result, which must | | * @result output parameter for null-terminated result, which must | |
| * have a capacity of at least 4 | | * have a capacity of at least 4 | |
| * @internal | | * @internal | |
| */ | | */ | |
| virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const; | | virtual void getEffectiveCurrency(UChar* result, UErrorCode& ec) const; | |
| | | | |
| private: | | private: | |
| | | | |
|
| | | static UBool isStyleSupported(UNumberFormatStyle style); | |
| | | | |
| /** | | /** | |
| * Creates the specified decimal format style of the desired locale. | | * Creates the specified decimal format style of the desired locale. | |
| * @param desiredLocale the given locale. | | * @param desiredLocale the given locale. | |
|
| * @param choice the given style. | | * @param style the given style. | |
| * @param success Output param filled with success/failure sta | | * @param errorCode Output param filled with success/failure sta | |
| tus. | | tus. | |
| * @return A new NumberFormat instance. | | * @return A new NumberFormat instance. | |
| */ | | */ | |
|
| static NumberFormat* makeInstance(const Locale& desiredLocale, EStyles | | static NumberFormat* makeInstance(const Locale& desiredLocale, | |
| choice, UErrorCode& success); | | UNumberFormatStyle style, | |
| | | UErrorCode& errorCode); | |
| | | | |
| UBool fGroupingUsed; | | UBool fGroupingUsed; | |
| int32_t fMaxIntegerDigits; | | int32_t fMaxIntegerDigits; | |
| int32_t fMinIntegerDigits; | | int32_t fMinIntegerDigits; | |
| int32_t fMaxFractionDigits; | | int32_t fMaxFractionDigits; | |
| int32_t fMinFractionDigits; | | int32_t fMinFractionDigits; | |
| UBool fParseIntegerOnly; | | UBool fParseIntegerOnly; | |
|
| | | UBool fLenient; // TRUE => lenient parse is enabled | |
| | | | |
| // ISO currency code | | // ISO currency code | |
| UChar fCurrency[4]; | | UChar fCurrency[4]; | |
| | | | |
|
| friend class ICUNumberFormatFactory; // access to makeInstance, EStyles | | friend class ICUNumberFormatFactory; // access to makeInstance | |
| friend class ICUNumberFormatService; | | friend class ICUNumberFormatService; | |
|
| | | friend class ::NumberFormatTest; // access to isStyleSupported() | |
| }; | | }; | |
| | | | |
| #if !UCONFIG_NO_SERVICE | | #if !UCONFIG_NO_SERVICE | |
| /** | | /** | |
| * A NumberFormatFactory is used to register new number formats. The facto
ry | | * A NumberFormatFactory is used to register new number formats. The facto
ry | |
| * should be able to create any of the predefined formats for each locale i
t | | * should be able to create any of the predefined formats for each locale i
t | |
| * supports. When registered, the locales it supports extend or override t
he | | * supports. When registered, the locales it supports extend or override t
he | |
| * locale already supported by ICU. | | * locale already supported by ICU. | |
| * | | * | |
| * @stable ICU 2.6 | | * @stable ICU 2.6 | |
| | | | |
| skipping to change at line 1036 | | skipping to change at line 1041 | |
| #endif /* #if !UCONFIG_NO_SERVICE */ | | #endif /* #if !UCONFIG_NO_SERVICE */ | |
| | | | |
| // ------------------------------------- | | // ------------------------------------- | |
| | | | |
| inline UBool | | inline UBool | |
| NumberFormat::isParseIntegerOnly() const | | NumberFormat::isParseIntegerOnly() const | |
| { | | { | |
| return fParseIntegerOnly; | | return fParseIntegerOnly; | |
| } | | } | |
| | | | |
|
| | | inline UBool | |
| | | NumberFormat::isLenient() const | |
| | | { | |
| | | return fLenient; | |
| | | } | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| NumberFormat::format(const Formattable& obj, | | NumberFormat::format(const Formattable& obj, | |
| UnicodeString& appendTo, | | UnicodeString& appendTo, | |
| UErrorCode& status) const { | | UErrorCode& status) const { | |
| return Format::format(obj, appendTo, status); | | return Format::format(obj, appendTo, status); | |
| } | | } | |
| | | | |
| U_NAMESPACE_END | | U_NAMESPACE_END | |
| | | | |
| #endif /* #if !UCONFIG_NO_FORMATTING */ | | #endif /* #if !UCONFIG_NO_FORMATTING */ | |
| | | | |
End of changes. 14 change blocks. |
| 41 lines changed or deleted | | 48 lines changed or added | |
|
| plurfmt.h | | plurfmt.h | |
| /* | | /* | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
|
| * Copyright (C) 2007-2010, International Business Machines Corporation and | | * Copyright (C) 2007-2011, International Business Machines Corporation and | |
| * others. All Rights Reserved. | | * others. All Rights Reserved. | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| * | | * | |
| | | | |
| * File PLURFMT.H | | * File PLURFMT.H | |
| * | | * | |
| * Modification History:* | | * Modification History:* | |
| * Date Name Description | | * Date Name Description | |
| * | | * | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| | | | |
| #include "unicode/utypes.h" | | #include "unicode/utypes.h" | |
| | | | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: PluralFormat object | | * \brief C++ API: PluralFormat object | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
|
| | | #include "unicode/messagepattern.h" | |
| #include "unicode/numfmt.h" | | #include "unicode/numfmt.h" | |
| #include "unicode/plurrule.h" | | #include "unicode/plurrule.h" | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| class Hashtable; | | class Hashtable; | |
| | | | |
| /** | | /** | |
| * <p> | | * <p> | |
| * <code>PluralFormat</code> supports the creation of internationalized | | * <code>PluralFormat</code> supports the creation of internationalized | |
| * messages with plural inflection. It is based on <i>plural | | * messages with plural inflection. It is based on <i>plural | |
| * selection</i>, i.e. the caller specifies messages for each | | * selection</i>, i.e. the caller specifies messages for each | |
|
| * plural case that can appear in the users language and the | | * plural case that can appear in the user's language and the | |
| * <code>PluralFormat</code> selects the appropriate message based on | | * <code>PluralFormat</code> selects the appropriate message based on | |
| * the number. | | * the number. | |
| * </p> | | * </p> | |
| * <h4>The Problem of Plural Forms in Internationalized Messages</h4> | | * <h4>The Problem of Plural Forms in Internationalized Messages</h4> | |
| * <p> | | * <p> | |
| * Different languages have different ways to inflect | | * Different languages have different ways to inflect | |
| * plurals. Creating internationalized messages that include plural | | * plurals. Creating internationalized messages that include plural | |
| * forms is only feasible when the framework is able to handle plural | | * forms is only feasible when the framework is able to handle plural | |
| * forms of <i>all</i> languages correctly. <code>ChoiceFormat</code> | | * forms of <i>all</i> languages correctly. <code>ChoiceFormat</code> | |
| * doesn't handle this well, because it attaches a number interval to | | * doesn't handle this well, because it attaches a number interval to | |
| * each message and selects the message whose interval contains a | | * each message and selects the message whose interval contains a | |
| * given number. This can only handle a finite number of | | * given number. This can only handle a finite number of | |
| * intervals. But in some languages, like Polish, one plural case | | * intervals. But in some languages, like Polish, one plural case | |
|
| * applies to infinitely many intervals (e.g., paucal applies to | | * applies to infinitely many intervals (e.g., the plural case applies to | |
| * numbers ending with 2, 3, or 4 except those ending with 12, 13, or | | * numbers ending with 2, 3, or 4 except those ending with 12, 13, or | |
| * 14). Thus <code>ChoiceFormat</code> is not adequate. | | * 14). Thus <code>ChoiceFormat</code> is not adequate. | |
| * </p><p> | | * </p><p> | |
| * <code>PluralFormat</code> deals with this by breaking the problem | | * <code>PluralFormat</code> deals with this by breaking the problem | |
| * into two parts: | | * into two parts: | |
| * <ul> | | * <ul> | |
| * <li>It uses <code>PluralRules</code> that can define more complex | | * <li>It uses <code>PluralRules</code> that can define more complex | |
| * conditions for a plural case than just a single interval. These plur
al | | * conditions for a plural case than just a single interval. These plur
al | |
| * rules define both what plural cases exist in a language, and to | | * rules define both what plural cases exist in a language, and to | |
| * which numbers these cases apply. | | * which numbers these cases apply. | |
|
| * <li>It provides predefined plural rules for many locales. Thus, the prog | | * <li>It provides predefined plural rules for many languages. Thus, the pr | |
| rammer | | ogrammer | |
| * need not worry about the plural cases of a language. On the flip sid | | * need not worry about the plural cases of a language and | |
| e, | | * does not have to define the plural cases; they can simply | |
| * the localizer does not have to specify the plural cases; he can simp | | | |
| ly | | | |
| * use the predefined keywords. The whole plural formatting of messages
can | | * use the predefined keywords. The whole plural formatting of messages
can | |
| * be done using localized patterns from resource bundles. For predefin
ed plural | | * be done using localized patterns from resource bundles. For predefin
ed plural | |
|
| * rules, see CLDR <i>Language Plural Rules</i> page at | | * rules, see the CLDR <i>Language Plural Rules</i> page at | |
| * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_pl
ural_rules.html | | * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_pl
ural_rules.html | |
| * </ul> | | * </ul> | |
| * </p> | | * </p> | |
| * <h4>Usage of <code>PluralFormat</code></h4> | | * <h4>Usage of <code>PluralFormat</code></h4> | |
|
| * <p> | | * <p>Note: Typically, plural formatting is done via <code>MessageFormat</c | |
| | | ode> | |
| | | * with a <code>plural</code> argument type, | |
| | | * rather than using a stand-alone <code>PluralFormat</code>. | |
| | | * </p><p> | |
| * This discussion assumes that you use <code>PluralFormat</code> with | | * This discussion assumes that you use <code>PluralFormat</code> with | |
| * a predefined set of plural rules. You can create one using one of | | * a predefined set of plural rules. You can create one using one of | |
| * the constructors that takes a <code>locale</code> object. To | | * the constructors that takes a <code>locale</code> object. To | |
| * specify the message pattern, you can either pass it to the | | * specify the message pattern, you can either pass it to the | |
| * constructor or set it explicitly using the | | * constructor or set it explicitly using the | |
| * <code>applyPattern()</code> method. The <code>format()</code> | | * <code>applyPattern()</code> method. The <code>format()</code> | |
| * method takes a number object and selects the message of the | | * method takes a number object and selects the message of the | |
| * matching plural case. This message will be returned. | | * matching plural case. This message will be returned. | |
| * </p> | | * </p> | |
| * <h5>Patterns and Their Interpretation</h5> | | * <h5>Patterns and Their Interpretation</h5> | |
| * <p> | | * <p> | |
| * The pattern text defines the message output for each plural case of the | | * The pattern text defines the message output for each plural case of the | |
|
| * used locale. The pattern is a sequence of | | * specified locale. Syntax: | |
| * <code><i>caseKeyword</i>{<i>message</i>}</code> clauses, separated by wh | | * <pre> | |
| ite | | * pluralStyle = [offsetValue] (selector '{' message '}')+ | |
| * space characters. Each clause assigns the message <code><i>message</i></ | | * offsetValue = "offset:" number | |
| code> | | * selector = explicitValue | keyword | |
| * to the plural case identified by <code><i>caseKeyword</i></code>. | | * explicitValue = '=' number // adjacent, no white space in between | |
| | | * keyword = [^[[:Pattern_Syntax:][:Pattern_White_Space:]]]+ | |
| | | * message: see {@link MessageFormat} | |
| | | * </pre> | |
| | | * Pattern_White_Space between syntax elements is ignored, except | |
| | | * between the {curly braces} and their sub-message, | |
| | | * and between the '=' and the number of an explicitValue. | |
| | | * | |
| * </p><p> | | * </p><p> | |
|
| * There are 6 predefined casekeyword in ICU - 'zero', 'one', 'two', 'few',
'many' and | | * There are 6 predefined casekeyword in CLDR/ICU - 'zero', 'one', 'two', '
few', 'many' and | |
| * 'other'. You always have to define a message text for the default plural
case | | * 'other'. You always have to define a message text for the default plural
case | |
|
| * "<code>other</code>" which is contained in every rule set. If the plural | | * <code>other</code> which is contained in every rule set. | |
| * rules of the <code>PluralFormat</code> object do not contain a plural ca | | | |
| se | | | |
| * identified by <code><i>caseKeyword</i></code>, U_DEFAULT_KEYWORD_MISSING | | | |
| * will be set to status. | | | |
| * If you do not specify a message text for a particular plural case, the | | * If you do not specify a message text for a particular plural case, the | |
|
| * message text of the plural case "<code>other</code>" gets assigned to th | | * message text of the plural case <code>other</code> gets assigned to this | |
| is | | * plural case. | |
| * plural case. If you specify more than one message for the same plural ca | | | |
| se, | | | |
| * U_DUPLICATE_KEYWORD will be set to status. | | | |
| * <br> | | | |
| * Spaces between <code><i>caseKeyword</i></code> and | | | |
| * <code><i>message</i></code> will be ignored; spaces within | | | |
| * <code><i>message</i></code> will be preserved. | | | |
| * </p><p> | | * </p><p> | |
|
| * The message text for a particular plural case may contain other message | | * When formatting, the input number is first matched against the explicitV | |
| * format patterns. <code>PluralFormat</code> preserves these so that you | | alue clauses. | |
| * can use the strings produced by <code>PluralFormat</code> with other | | * If there is no exact-number match, then a keyword is selected by calling | |
| * formatters. If you are using <code>PluralFormat</code> inside a | | * the <code>PluralRules</code> with the input number <em>minus the offset< | |
| * <code>MessageFormat</code> pattern, <code>MessageFormat</code> will | | /em>. | |
| * automatically evaluate the resulting format pattern.<br> | | * (The offset defaults to 0 if it is omitted from the pattern string.) | |
| * Thus, curly braces (<code>{</code>, <code>}</code>) are <i>only</i> allo | | * If there is no clause with that keyword, then the "other" clauses is ret | |
| wed | | urned. | |
| * in message texts to define a nested format pattern.<br> | | * </p><p> | |
| * The pound sign (<code>#</code>) will be interpreted as the number placeh | | * An unquoted pound sign (<code>#</code>) in the selected sub-message | |
| older | | * itself (i.e., outside of arguments nested in the sub-message) | |
| * in the message text, if it is not contained in curly braces (to preserve | | * is replaced by the input number minus the offset. | |
| * <code>NumberFormat</code> patterns). <code>PluralFormat</code> will | | * The number-minus-offset value is formatted using a | |
| * replace each of those pound signs by the number passed to the | | | |
| * <code>format()</code> method. It will be formatted using a | | | |
| * <code>NumberFormat</code> for the <code>PluralFormat</code>'s locale. If
you | | * <code>NumberFormat</code> for the <code>PluralFormat</code>'s locale. If
you | |
|
| * need special number formatting, you have to explicitly specify a | | * need special number formatting, you have to use a <code>MessageFormat</c | |
| * <code>NumberFormat</code> for the <code>PluralFormat</code> to use. | | ode> | |
| * </p> | | * and explicitly specify a <code>NumberFormat</code> argument. | |
| * Example | | * <strong>Note:</strong> That argument is formatting without subtracting t | |
| * <pre> | | he offset! | |
| * \code | | * If you need a custom format and have a non-zero offset, then you need to | |
| * UErrorCode status = U_ZERO_ERROR; | | pass the | |
| * MessageFormat* msgFmt = new MessageFormat(UnicodeString("{0, plural, | | * number-minus-offset value as a separate parameter. | |
| * one{{0, number, C''est #,##0.0# fichier}} other {Ce sont # fichiers}} | | | |
| dans la liste."), | | | |
| * Locale("fr"), status); | | | |
| * if (U_FAILURE(status)) { | | | |
| * return; | | | |
| * } | | | |
| * Formattable args1[] = {(int32_t)0}; | | | |
| * Formattable args2[] = {(int32_t)3}; | | | |
| * FieldPosition ignore(FieldPosition::DONT_CARE); | | | |
| * UnicodeString result; | | | |
| * msgFmt->format(args1, 1, result, ignore, status); | | | |
| * cout << result << endl; | | | |
| * result.remove(); | | | |
| * msgFmt->format(args2, 1, result, ignore, status); | | | |
| * cout << result << endl; | | | |
| * \endcode | | | |
| * </pre> | | | |
| * Produces the output:<br> | | | |
| * <code>C'est 0,0 fichier dans la liste.</code><br> | | | |
| * <code>Ce sont 3 fichiers dans la liste.</code> | | | |
| * <p> | | | |
| * <strong>Note:</strong><br> | | | |
| * Currently <code>PluralFormat</code> | | | |
| * does not make use of quotes like <code>MessageFormat</code>. | | | |
| * If you use plural format strings with <code>MessageFormat</code> and w | | | |
| ant | | | |
| * to use a quote sign <code>'</code>, you have to write <code>''</code>. | | | |
| * <code>MessageFormat</code> unquotes this pattern and passes the unquo | | | |
| ted | | | |
| * pattern to <code>PluralFormat</code>. It's a bit trickier if you use | | | |
| * nested formats that do quoting. In the example above, we wanted to ins | | | |
| ert | | | |
| * <code>'</code> in the number format pattern. Since | | | |
| * <code>NumberFormat</code> supports quotes, we had to insert | | | |
| * <code>''</code>. But since <code>MessageFormat</code> unquotes the | | | |
| * pattern before it gets passed to <code>PluralFormat</code>, we have to | | | |
| * double these quotes, i.e. write <code>''''</code>. | | | |
| * </p> | | * </p> | |
|
| | | * For a usage example, see the {@link MessageFormat} class documentation. | |
| | | * | |
| * <h4>Defining Custom Plural Rules</h4> | | * <h4>Defining Custom Plural Rules</h4> | |
| * <p>If you need to use <code>PluralFormat</code> with custom rules, you c
an | | * <p>If you need to use <code>PluralFormat</code> with custom rules, you c
an | |
| * create a <code>PluralRules</code> object and pass it to | | * create a <code>PluralRules</code> object and pass it to | |
| * <code>PluralFormat</code>'s constructor. If you also specify a locale in
this | | * <code>PluralFormat</code>'s constructor. If you also specify a locale in
this | |
| * constructor, this locale will be used to format the number in the messag
e | | * constructor, this locale will be used to format the number in the messag
e | |
| * texts. | | * texts. | |
| * </p><p> | | * </p><p> | |
| * For more information about <code>PluralRules</code>, see | | * For more information about <code>PluralRules</code>, see | |
| * {@link PluralRules}. | | * {@link PluralRules}. | |
| * </p> | | * </p> | |
| | | | |
| skipping to change at line 513 | | skipping to change at line 481 | |
| */ | | */ | |
| static UClassID U_EXPORT2 getStaticClassID(void); | | static UClassID U_EXPORT2 getStaticClassID(void); | |
| | | | |
| /** | | /** | |
| * ICU "poor man's RTTI", returns a UClassID for the actual class. | | * ICU "poor man's RTTI", returns a UClassID for the actual class. | |
| * | | * | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| virtual UClassID getDynamicClassID() const; | | virtual UClassID getDynamicClassID() const; | |
| | | | |
|
| private: | | private: | |
| typedef enum fmtToken { | | | |
| none, | | /** | |
| tLetter, | | * @internal | |
| tNumber, | | */ | |
| tSpace, | | class PluralSelector : public UMemory { | |
| tNumberSign, | | public: | |
| tLeftBrace, | | /** | |
| tRightBrace | | * Given a number, returns the appropriate PluralFormat keyword. | |
| }fmtToken; | | * | |
| | | * @param number The number to be plural-formatted. | |
| | | * @param ec Error code. | |
| | | * @return The selected PluralFormat keyword. | |
| | | */ | |
| | | virtual UnicodeString select(double number, UErrorCode& ec) const = | |
| | | 0; | |
| | | }; | |
| | | | |
| | | /** | |
| | | * @internal | |
| | | */ | |
| | | class U_I18N_API PluralSelectorAdapter : public PluralSelector { | |
| | | public: | |
| | | PluralSelectorAdapter() : pluralRules(NULL) { | |
| | | } | |
| | | | |
| | | virtual ~PluralSelectorAdapter(); | |
| | | | |
| | | virtual UnicodeString select(double number, UErrorCode& /*ec*/) con | |
| | | st; | |
| | | | |
| | | void reset(); | |
| | | | |
| | | PluralRules* pluralRules; | |
| | | }; | |
| | | | |
| Locale locale; | | Locale locale; | |
|
| PluralRules* pluralRules; | | MessagePattern msgPattern; | |
| UnicodeString pattern; | | | |
| Hashtable *fParsedValuesHash; | | | |
| NumberFormat* numberFormat; | | NumberFormat* numberFormat; | |
|
| NumberFormat* replacedNumberFormat; | | double offset; | |
| | | PluralSelectorAdapter pluralRulesWrapper; | |
| | | | |
| PluralFormat(); // default constructor not implemented | | PluralFormat(); // default constructor not implemented | |
|
| void init(const PluralRules* rules, const Locale& curlocale, UErrorCode | | void init(const PluralRules* rules, UErrorCode& status); | |
| & status); | | /** | |
| UBool inRange(UChar ch, fmtToken& type); | | * Copies dynamically allocated values (pointer fields). | |
| UBool checkSufficientDefinition(); | | * Others are copied using their copy constructors and assignment opera | |
| void parsingFailure(); | | tors. | |
| UnicodeString insertFormattedNumber(double number, | | */ | |
| UnicodeString& message, | | void copyObjects(const PluralFormat& other); | |
| UnicodeString& appendTo, | | | |
| FieldPosition& pos) const; | | /** | |
| void copyHashtable(Hashtable *other, UErrorCode& status); | | * Finds the PluralFormat sub-message for the given number, or the "oth | |
| | | er" sub-message. | |
| | | * @param pattern A MessagePattern. | |
| | | * @param partIndex the index of the first PluralFormat argument style | |
| | | part. | |
| | | * @param selector the PluralSelector for mapping the number (minus off | |
| | | set) to a keyword. | |
| | | * @param number a number to be matched to one of the PluralFormat argu | |
| | | ment's explicit values, | |
| | | * or mapped via the PluralSelector. | |
| | | * @param ec ICU error code. | |
| | | * @return the sub-message start part index. | |
| | | */ | |
| | | static int32_t findSubMessage( | |
| | | const MessagePattern& pattern, int32_t partIndex, | |
| | | const PluralSelector& selector, double number, UErrorCode& ec); | |
| | | | |
| | | friend class MessageFormat; | |
| }; | | }; | |
| | | | |
| U_NAMESPACE_END | | U_NAMESPACE_END | |
| | | | |
| #endif /* #if !UCONFIG_NO_FORMATTING */ | | #endif /* #if !UCONFIG_NO_FORMATTING */ | |
| | | | |
| #endif // _PLURFMT | | #endif // _PLURFMT | |
| //eof | | //eof | |
| | | | |
End of changes. 18 change blocks. |
| 116 lines changed or deleted | | 119 lines changed or added | |
|
| plurrule.h | | plurrule.h | |
| /* | | /* | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
|
| * Copyright (C) 2008-2010, International Business Machines Corporation and | | * Copyright (C) 2008-2011, International Business Machines Corporation and | |
| * others. All Rights Reserved. | | * others. All Rights Reserved. | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| * | | * | |
| * | | * | |
| * File PLURRULE.H | | * File PLURRULE.H | |
| * | | * | |
| * Modification History:* | | * Modification History:* | |
| * Date Name Description | | * Date Name Description | |
| * | | * | |
| ***************************************************************************
***** | | ***************************************************************************
***** | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| | | | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: PluralRules object | | * \brief C++ API: PluralRules object | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| #include "unicode/format.h" | | #include "unicode/format.h" | |
| | | | |
|
| | | /** | |
| | | * Value returned by PluralRules::getUniqueKeywordValue() when there is no | |
| | | * unique value to return. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | #define UPLRULES_NO_UNIQUE_VALUE ((double)-0.00123456777) | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| class Hashtable; | | class Hashtable; | |
| class RuleChain; | | class RuleChain; | |
| class RuleParser; | | class RuleParser; | |
|
| | | class PluralKeywordEnumeration; | |
| | | | |
| /** | | /** | |
|
| * Defines rules for mapping positive long values onto a small set of | | * Defines rules for mapping non-negative numeric values onto a small set o
f | |
| * keywords. Rules are constructed from a text description, consisting | | * keywords. Rules are constructed from a text description, consisting | |
| * of a series of keywords and conditions. The {@link #select} method | | * of a series of keywords and conditions. The {@link #select} method | |
| * examines each condition in order and returns the keyword for the | | * examines each condition in order and returns the keyword for the | |
| * first condition that matches the number. If none match, | | * first condition that matches the number. If none match, | |
| * default rule(other) is returned. | | * default rule(other) is returned. | |
| * | | * | |
|
| | | * For more information, details, and tips for writing rules, see the | |
| | | * LDML spec, C.11 Language Plural Rules: | |
| | | * http://www.unicode.org/draft/reports/tr35/tr35.html#Language_Plural_Rule | |
| | | s | |
| | | * | |
| * Examples:<pre> | | * Examples:<pre> | |
| * "one: n is 1; few: n in 2..4"</pre> | | * "one: n is 1; few: n in 2..4"</pre> | |
| * This defines two rules, for 'one' and 'few'. The condition for | | * This defines two rules, for 'one' and 'few'. The condition for | |
| * 'one' is "n is 1" which means that the number must be equal to | | * 'one' is "n is 1" which means that the number must be equal to | |
| * 1 for this condition to pass. The condition for 'few' is | | * 1 for this condition to pass. The condition for 'few' is | |
| * "n in 2..4" which means that the number must be between 2 and | | * "n in 2..4" which means that the number must be between 2 and | |
| * 4 inclusive for this condition to pass. All other numbers | | * 4 inclusive for this condition to pass. All other numbers | |
| * are assigned the keyword "other" by the default rule. | | * are assigned the keyword "other" by the default rule. | |
| * </p><pre> | | * </p><pre> | |
| * "zero: n is 0; one: n is 1; zero: n mod 100 in 1..19"</pre> | | * "zero: n is 0; one: n is 1; zero: n mod 100 in 1..19"</pre> | |
| | | | |
| skipping to change at line 77 | | skipping to change at line 89 | |
| * <p> | | * <p> | |
| * Syntax:<pre> | | * Syntax:<pre> | |
| * \code | | * \code | |
| * rules = rule (';' rule)* | | * rules = rule (';' rule)* | |
| * rule = keyword ':' condition | | * rule = keyword ':' condition | |
| * keyword = <identifier> | | * keyword = <identifier> | |
| * condition = and_condition ('or' and_condition)* | | * condition = and_condition ('or' and_condition)* | |
| * and_condition = relation ('and' relation)* | | * and_condition = relation ('and' relation)* | |
| * relation = is_relation | in_relation | within_relation | 'n' <EOL> | | * relation = is_relation | in_relation | within_relation | 'n' <EOL> | |
| * is_relation = expr 'is' ('not')? value | | * is_relation = expr 'is' ('not')? value | |
|
| * in_relation = expr ('not')? 'in' range | | * in_relation = expr ('not')? 'in' range_list | |
| * within_relation = expr ('not')? 'within' range | | * within_relation = expr ('not')? 'within' range | |
| * expr = 'n' ('mod' value)? | | * expr = 'n' ('mod' value)? | |
|
| | | * range_list = (range | value) (',' range_list)* | |
| * value = digit+ | | * value = digit+ | |
| * digit = 0|1|2|3|4|5|6|7|8|9 | | * digit = 0|1|2|3|4|5|6|7|8|9 | |
| * range = value'..'value | | * range = value'..'value | |
| * \endcode | | * \endcode | |
| * </pre></p> | | * </pre></p> | |
| * <p> | | * <p> | |
|
| * The difference between 'in' and 'within' is that 'in' only includes | | * An "identifier" is a sequence of characters that do not have the | |
| * integers in the specified range, while 'within' includes all values.</p | | * Unicode Pattern_Syntax or Pattern_White_Space properties. | |
| > | | * <p> | |
| * <p> | | * The difference between 'in' and 'within' is that 'in' only includes | |
| * Keywords | | * integers in the specified range, while 'within' includes all values.</p> | |
| * could be defined by users or from ICU locale data. There are 6 | | * <p> | |
| * predefined values in ICU - 'zero', 'one', 'two', 'few', 'many' and | | * Keywords | |
| * 'other'. Callers need to check the value of keyword returned by | | * could be defined by users or from ICU locale data. There are 6 | |
| * {@link #select} method. | | * predefined values in ICU - 'zero', 'one', 'two', 'few', 'many' and | |
| * </p> | | * 'other'. Callers need to check the value of keyword returned by | |
| | | * {@link #select} method. | |
| | | * </p> | |
| * | | * | |
| * Examples:<pre> | | * Examples:<pre> | |
| * UnicodeString keyword = pl->select(number); | | * UnicodeString keyword = pl->select(number); | |
| * if (keyword== UnicodeString("one") { | | * if (keyword== UnicodeString("one") { | |
| * ... | | * ... | |
| * } | | * } | |
| * else if ( ... ) | | * else if ( ... ) | |
| * </pre> | | * </pre> | |
| * <strong>Note:</strong><br> | | * <strong>Note:</strong><br> | |
| * <p> | | * <p> | |
| | | | |
| skipping to change at line 148 | | skipping to change at line 164 | |
| PluralRules* clone() const; | | PluralRules* clone() const; | |
| | | | |
| /** | | /** | |
| * Assignment operator. | | * Assignment operator. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| PluralRules& operator=(const PluralRules&); | | PluralRules& operator=(const PluralRules&); | |
| | | | |
| /** | | /** | |
| * Creates a PluralRules from a description if it is parsable, otherwis
e | | * Creates a PluralRules from a description if it is parsable, otherwis
e | |
|
| * returns null. | | * returns NULL. | |
| * | | * | |
| * @param description rule description | | * @param description rule description | |
| * @param status Output param set to success/failure code on exit,
which | | * @param status Output param set to success/failure code on exit,
which | |
| * must not indicate a failure before the function c
all. | | * must not indicate a failure before the function c
all. | |
| * @return new PluralRules pointer. NULL if there is an erro
r. | | * @return new PluralRules pointer. NULL if there is an erro
r. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| static PluralRules* U_EXPORT2 createRules(const UnicodeString& descript
ion, | | static PluralRules* U_EXPORT2 createRules(const UnicodeString& descript
ion, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| | | | |
| skipping to change at line 221 | | skipping to change at line 237 | |
| * | | * | |
| * @param status Output param set to success/failure code on exit, whic
h | | * @param status Output param set to success/failure code on exit, whic
h | |
| * must not indicate a failure before the function call. | | * must not indicate a failure before the function call. | |
| * @return StringEnumeration with the keywords. | | * @return StringEnumeration with the keywords. | |
| * The caller must delete the object. | | * The caller must delete the object. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| StringEnumeration* getKeywords(UErrorCode& status) const; | | StringEnumeration* getKeywords(UErrorCode& status) const; | |
| | | | |
| /** | | /** | |
|
| | | * Returns a unique value for this keyword if it exists, else the const | |
| | | ant | |
| | | * UPLRULES_NO_UNIQUE_VALUE. | |
| | | * | |
| | | * @param keyword The keyword. | |
| | | * @return The unique value that generates the keyword, or | |
| | | * UPLRULES_NO_UNIQUE_VALUE if the keyword is undefined | |
| | | or there is no | |
| | | * unique value that generates this keyword. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | double getUniqueKeywordValue(const UnicodeString& keyword); | |
| | | | |
| | | /** | |
| | | * Returns all the values for which select() would return the keyword. | |
| | | If | |
| | | * the keyword is unknown, returns no values, but this is not an error. | |
| | | If | |
| | | * the number of values is unlimited, returns no values and -1 as the | |
| | | * count. | |
| | | * | |
| | | * The number of returned values is typically small. | |
| | | * | |
| | | * @param keyword The keyword. | |
| | | * @param dest Array into which to put the returned values. Ma | |
| | | y | |
| | | * be NULL if destCapacity is 0. | |
| | | * @param destCapacity The capacity of the array, must be at least 0. | |
| | | * @param status The error code. | |
| | | * @return The count of values available, or -1. This coun | |
| | | t | |
| | | * can be larger than destCapacity, but no more tha | |
| | | n | |
| | | * destCapacity values will be written. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | int32_t getAllKeywordValues(const UnicodeString &keyword, | |
| | | double *dest, int32_t destCapacity, | |
| | | UErrorCode& status); | |
| | | | |
| | | /** | |
| | | * Returns sample values for which select() would return the keyword. | |
| | | If | |
| | | * the keyword is unknown, returns no values, but this is not an error. | |
| | | * | |
| | | * The number of returned values is typically small. | |
| | | * | |
| | | * @param keyword The keyword. | |
| | | * @param dest Array into which to put the returned values. Ma | |
| | | y | |
| | | * be NULL if destCapacity is 0. | |
| | | * @param destCapacity The capacity of the array, must be at least 0. | |
| | | * @param status The error code. | |
| | | * @return The count of values written. | |
| | | * If more than destCapacity samples are available, | |
| | | then | |
| | | * only destCapacity are written, and destCapacity | |
| | | is returned as the count, | |
| | | * rather than setting a U_BUFFER_OVERFLOW_ERROR. | |
| | | * (The actual number of keyword values could be un | |
| | | limited.) | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | int32_t getSamples(const UnicodeString &keyword, | |
| | | double *dest, int32_t destCapacity, | |
| | | UErrorCode& status); | |
| | | | |
| | | /** | |
| * Returns TRUE if the given keyword is defined in this | | * Returns TRUE if the given keyword is defined in this | |
| * <code>PluralRules</code> object. | | * <code>PluralRules</code> object. | |
| * | | * | |
| * @param keyword the input keyword. | | * @param keyword the input keyword. | |
| * @return TRUE if the input keyword is defined. | | * @return TRUE if the input keyword is defined. | |
| * Otherwise, return FALSE. | | * Otherwise, return FALSE. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| UBool isKeyword(const UnicodeString& keyword) const; | | UBool isKeyword(const UnicodeString& keyword) const; | |
| | | | |
| | | | |
| skipping to change at line 276 | | skipping to change at line 348 | |
| static UClassID U_EXPORT2 getStaticClassID(void); | | static UClassID U_EXPORT2 getStaticClassID(void); | |
| | | | |
| /** | | /** | |
| * ICU "poor man's RTTI", returns a UClassID for the actual class. | | * ICU "poor man's RTTI", returns a UClassID for the actual class. | |
| * | | * | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| virtual UClassID getDynamicClassID() const; | | virtual UClassID getDynamicClassID() const; | |
| | | | |
| private: | | private: | |
|
| Hashtable *fLocaleStringsHash; | | RuleChain *mRules; | |
| UnicodeString mLocaleName; | | RuleParser *mParser; | |
| RuleChain *mRules; | | double *mSamples; | |
| RuleParser *mParser; | | int32_t *mSampleInfo; | |
| | | int32_t mSampleInfoCount; | |
| | | | |
| PluralRules(); // default constructor not implemented | | PluralRules(); // default constructor not implemented | |
| int32_t getRepeatLimit() const; | | int32_t getRepeatLimit() const; | |
| void parseDescription(UnicodeString& ruleData, RuleChain& rules, UError
Code &status); | | void parseDescription(UnicodeString& ruleData, RuleChain& rules, UError
Code &status); | |
| void getNextLocale(const UnicodeString& localeData, int32_t* curIndex,
UnicodeString& localeName); | | void getNextLocale(const UnicodeString& localeData, int32_t* curIndex,
UnicodeString& localeName); | |
| void addRules(RuleChain& rules); | | void addRules(RuleChain& rules); | |
| int32_t getNumberValue(const UnicodeString& token) const; | | int32_t getNumberValue(const UnicodeString& token) const; | |
| UnicodeString getRuleFromResource(const Locale& locale, UErrorCode& sta
tus); | | UnicodeString getRuleFromResource(const Locale& locale, UErrorCode& sta
tus); | |
| | | | |
|
| | | static const int32_t MAX_SAMPLES = 3; | |
| | | | |
| | | int32_t getSamplesInternal(const UnicodeString &keyword, double *dest, | |
| | | int32_t destCapacity, UBool includeUnlimited | |
| | | , | |
| | | UErrorCode& status); | |
| | | int32_t getKeywordIndex(const UnicodeString& keyword, | |
| | | UErrorCode& status) const; | |
| | | void initSamples(UErrorCode& status); | |
| | | | |
| }; | | }; | |
| | | | |
| U_NAMESPACE_END | | U_NAMESPACE_END | |
| | | | |
| #endif /* #if !UCONFIG_NO_FORMATTING */ | | #endif /* #if !UCONFIG_NO_FORMATTING */ | |
| | | | |
| #endif // _PLURRULE | | #endif // _PLURRULE | |
| //eof | | //eof | |
| | | | |
End of changes. 12 change blocks. |
| 18 lines changed or deleted | | 113 lines changed or added | |
|
| selfmt.h | | selfmt.h | |
| /******************************************************************** | | /******************************************************************** | |
| * COPYRIGHT: | | * COPYRIGHT: | |
|
| * Copyright (c) 1997-2010, International Business Machines Corporation and | | * Copyright (c) 1997-2011, International Business Machines Corporation and | |
| * others. All Rights Reserved. | | * others. All Rights Reserved. | |
| * Copyright (C) 2010 , Yahoo! Inc. | | * Copyright (C) 2010 , Yahoo! Inc. | |
| ******************************************************************** | | ******************************************************************** | |
| * | | * | |
| * File SELFMT.H | | * File SELFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 11/11/09 kirtig Finished first cut of implementation. | | * 11/11/09 kirtig Finished first cut of implementation. | |
| ********************************************************************/ | | ********************************************************************/ | |
| | | | |
| #ifndef SELFMT | | #ifndef SELFMT | |
| #define SELFMT | | #define SELFMT | |
| | | | |
|
| #include "unicode/utypes.h" | | #include "unicode/messagepattern.h" | |
| #include "unicode/numfmt.h" | | #include "unicode/numfmt.h" | |
|
| | | #include "unicode/utypes.h" | |
| | | | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: SelectFormat object | | * \brief C++ API: SelectFormat object | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
|
| class Hashtable; | | class MessageFormat; | |
| | | | |
| /** | | /** | |
| * <p><code>SelectFormat</code> supports the creation of internationalize
d | | * <p><code>SelectFormat</code> supports the creation of internationalize
d | |
| * messages by selecting phrases based on keywords. The pattern specifies | | * messages by selecting phrases based on keywords. The pattern specifies | |
| * how to map keywords to phrases and provides a default phrase. The | | * how to map keywords to phrases and provides a default phrase. The | |
| * object provided to the format method is a string that's matched | | * object provided to the format method is a string that's matched | |
| * against the keywords. If there is a match, the corresponding phrase | | * against the keywords. If there is a match, the corresponding phrase | |
| * is selected; otherwise, the default phrase is used.</p> | | * is selected; otherwise, the default phrase is used.</p> | |
| * | | * | |
| * <h4>Using <code>SelectFormat</code> for Gender Agreement</h4> | | * <h4>Using <code>SelectFormat</code> for Gender Agreement</h4> | |
| * | | * | |
|
| | | * <p>Note: Typically, select formatting is done via <code>MessageFormat</ | |
| | | code> | |
| | | * with a <code>select</code> argument type, | |
| | | * rather than using a stand-alone <code>SelectFormat</code>.</p> | |
| | | * | |
| * <p>The main use case for the select format is gender based inflection. | | * <p>The main use case for the select format is gender based inflection. | |
| * When names or nouns are inserted into sentences, their gender can affe
ct pronouns, | | * When names or nouns are inserted into sentences, their gender can affe
ct pronouns, | |
| * verb forms, articles, and adjectives. Special care needs to be | | * verb forms, articles, and adjectives. Special care needs to be | |
| * taken for the case where the gender cannot be determined. | | * taken for the case where the gender cannot be determined. | |
| * The impact varies between languages:</p> | | * The impact varies between languages:</p> | |
| * \htmlonly | | * \htmlonly | |
| * <ul> | | * <ul> | |
| * <li>English has three genders, and unknown gender is handled as a spec
ial | | * <li>English has three genders, and unknown gender is handled as a spec
ial | |
| * case. Names use the gender of the named person (if known), nouns refer
ring | | * case. Names use the gender of the named person (if known), nouns refer
ring | |
| * to people use natural gender, and inanimate objects are usually neutra
l. | | * to people use natural gender, and inanimate objects are usually neutra
l. | |
| | | | |
| skipping to change at line 76 | | skipping to change at line 81 | |
| * | | * | |
| * <li>Polish distinguishes five genders (or noun classes), | | * <li>Polish distinguishes five genders (or noun classes), | |
| * human masculine, animate non-human masculine, inanimate masculine, | | * human masculine, animate non-human masculine, inanimate masculine, | |
| * feminine, and neuter. | | * feminine, and neuter. | |
| * </ul> | | * </ul> | |
| * \endhtmlonly | | * \endhtmlonly | |
| * <p>Some other languages have noun classes that are not related to gend
er, | | * <p>Some other languages have noun classes that are not related to gend
er, | |
| * but similar in grammatical use. | | * but similar in grammatical use. | |
| * Some African languages have around 20 noun classes.</p> | | * Some African languages have around 20 noun classes.</p> | |
| * | | * | |
|
| | | * <p><b>Note:</b>For the gender of a <i>person</i> in a given sentence, | |
| | | * we usually need to distinguish only between female, male and other/unkn | |
| | | own.</p> | |
| | | * | |
| * <p>To enable localizers to create sentence patterns that take their | | * <p>To enable localizers to create sentence patterns that take their | |
| * language's gender dependencies into consideration, software has to pro
vide | | * language's gender dependencies into consideration, software has to pro
vide | |
| * information about the gender associated with a noun or name to | | * information about the gender associated with a noun or name to | |
| * <code>MessageFormat</code>. | | * <code>MessageFormat</code>. | |
| * Two main cases can be distinguished:</p> | | * Two main cases can be distinguished:</p> | |
| * | | * | |
| * <ul> | | * <ul> | |
| * <li>For people, natural gender information should be maintained for ea
ch person. | | * <li>For people, natural gender information should be maintained for ea
ch person. | |
|
| * The keywords "male", "female", "mixed" (for groups of people) | | * Keywords like "male", "female", "mixed" (for groups of people) | |
| * and "unknown" are used. | | * and "unknown" could be used. | |
| * | | * | |
| * <li>For nouns, grammatical gender information should be maintained for | | * <li>For nouns, grammatical gender information should be maintained for | |
| * each noun and per language, e.g., in resource bundles. | | * each noun and per language, e.g., in resource bundles. | |
| * The keywords "masculine", "feminine", and "neuter" are commonly used, | | * The keywords "masculine", "feminine", and "neuter" are commonly used, | |
| * but some languages may require other keywords. | | * but some languages may require other keywords. | |
| * </ul> | | * </ul> | |
| * | | * | |
| * <p>The resulting keyword is provided to <code>MessageFormat</code> as
a | | * <p>The resulting keyword is provided to <code>MessageFormat</code> as
a | |
| * parameter separate from the name or noun it's associated with. For exa
mple, | | * parameter separate from the name or noun it's associated with. For exa
mple, | |
| * to generate a message such as "Jean went to Paris", three separate arg
uments | | * to generate a message such as "Jean went to Paris", three separate arg
uments | |
| * would be provided: The name of the person as argument 0, the gender of | | * would be provided: The name of the person as argument 0, the gender of | |
| * the person as argument 1, and the name of the city as argument 2. | | * the person as argument 1, and the name of the city as argument 2. | |
| * The sentence pattern for English, where the gender of the person has | | * The sentence pattern for English, where the gender of the person has | |
| * no impact on this simple sentence, would not refer to argument 1 at al
l:</p> | | * no impact on this simple sentence, would not refer to argument 1 at al
l:</p> | |
| * | | * | |
| * <pre>{0} went to {2}.</pre> | | * <pre>{0} went to {2}.</pre> | |
| * | | * | |
|
| | | * <p><b>Note:</b> The entire sentence should be included (and partially r | |
| | | epeated) | |
| | | * inside each phrase. Otherwise translators would have to be trained on h | |
| | | ow to | |
| | | * move bits of the sentence in and out of the select argument of a messag | |
| | | e. | |
| | | * (The examples below do not follow this recommendation!)</p> | |
| | | * | |
| * <p>The sentence pattern for French, where the gender of the person affe
cts | | * <p>The sentence pattern for French, where the gender of the person affe
cts | |
| * the form of the participle, uses a select format based on argument 1:</
p> | | * the form of the participle, uses a select format based on argument 1:</
p> | |
| * | | * | |
| * \htmlonly<pre>{0} est {1, select, female {allée} other {all�
E9;}} à {2}.</pre>\endhtmlonly | | * \htmlonly<pre>{0} est {1, select, female {allée} other {all�
E9;}} à {2}.</pre>\endhtmlonly | |
| * | | * | |
| * <p>Patterns can be nested, so that it's possible to handle interaction
s of | | * <p>Patterns can be nested, so that it's possible to handle interaction
s of | |
| * number and gender where necessary. For example, if the above sentence
should | | * number and gender where necessary. For example, if the above sentence
should | |
| * allow for the names of several people to be inserted, the following se
ntence | | * allow for the names of several people to be inserted, the following se
ntence | |
| * pattern can be used (with argument 0 the list of people's names, | | * pattern can be used (with argument 0 the list of people's names, | |
| * argument 1 the number of people, argument 2 their combined gender, and | | * argument 1 the number of people, argument 2 their combined gender, and | |
| | | | |
| skipping to change at line 124 | | skipping to change at line 137 | |
| * | | * | |
| * \htmlonly | | * \htmlonly | |
| * <pre>{0} {1, plural, | | * <pre>{0} {1, plural, | |
| * one {est {2, select, female {allée} other {all&
#x00E9;}}} | | * one {est {2, select, female {allée} other {all&
#x00E9;}}} | |
| * other {sont {2, select, female {allées} other {a
llés}}} | | * other {sont {2, select, female {allées} other {a
llés}}} | |
| * }à {3}.</pre> | | * }à {3}.</pre> | |
| * \endhtmlonly | | * \endhtmlonly | |
| * | | * | |
| * <h4>Patterns and Their Interpretation</h4> | | * <h4>Patterns and Their Interpretation</h4> | |
| * | | * | |
|
| * <p>The <code>SelectFormat</code> pattern text defines the phrase outpu
t | | * <p>The <code>SelectFormat</code> pattern string defines the phrase outp
ut | |
| * for each user-defined keyword. | | * for each user-defined keyword. | |
|
| * The pattern is a sequence of <code><i>keyword</i>{<i>phrase</i>}</code> | | * The pattern is a sequence of (keyword, message) pairs. | |
| * clauses. | | * A keyword is a "pattern identifier": [^[[:Pattern_Syntax:][:Pattern_Whi | |
| * Each clause assigns the phrase <code><i>phrase</i></code> | | te_Space:]]]+</p> | |
| * to the user-defined <code><i>keyword</i></code>.</p> | | | |
| * | | * | |
|
| * <p>Keywords must match the pattern [a-zA-Z][a-zA-Z0-9_-]*; keywords | | * <p>Each message is a MessageFormat pattern string enclosed in {curly br | |
| * that don't match this pattern result in the error code | | aces}.</p> | |
| * <code>U_ILLEGAL_CHARACTER</code>. | | * | |
| * You always have to define a phrase for the default keyword | | * <p>You always have to define a phrase for the default keyword | |
| * <code>other</code>; this phrase is returned when the keyword | | * <code>other</code>; this phrase is returned when the keyword | |
| * provided to | | * provided to | |
| * the <code>format</code> method matches no other keyword. | | * the <code>format</code> method matches no other keyword. | |
| * If a pattern does not provide a phrase for <code>other</code>, the met
hod | | * If a pattern does not provide a phrase for <code>other</code>, the met
hod | |
| * it's provided to returns the error <code>U_DEFAULT_KEYWORD_MISSING</co
de>. | | * it's provided to returns the error <code>U_DEFAULT_KEYWORD_MISSING</co
de>. | |
|
| * If a pattern provides more than one phrase for the same keyword, the | | | |
| * error <code>U_DUPLICATE_KEYWORD</code> is returned. | | | |
| * <br> | | * <br> | |
|
| * Spaces between <code><i>keyword</i></code> and | | * Pattern_White_Space between keywords and messages is ignored. | |
| * <code>{<i>phrase</i>}</code> will be ignored; spaces within | | * Pattern_White_Space within a message is preserved and output.</p> | |
| * <code>{<i>phrase</i>}</code> will be preserved.<p> | | | |
| * | | | |
| * <p>The phrase for a particular select case may contain other message | | | |
| * format patterns. <code>SelectFormat</code> preserves these so that you | | | |
| * can use the strings produced by <code>SelectFormat</code> with other | | | |
| * formatters. If you are using <code>SelectFormat</code> inside a | | | |
| * <code>MessageFormat</code> pattern, <code>MessageFormat</code> will | | | |
| * automatically evaluate the resulting format pattern. | | | |
| * Thus, curly braces (<code>{</code>, <code>}</code>) are <i>only</i> all | | | |
| owed | | | |
| * in phrases to define a nested format pattern.</p> | | | |
| * | | * | |
|
| * <p>Example: | | * <p><pre>Example: | |
| * \htmlonly | | * \htmlonly | |
| * | | * | |
| * UErrorCode status = U_ZERO_ERROR; | | * UErrorCode status = U_ZERO_ERROR; | |
| * MessageFormat *msgFmt = new MessageFormat(UnicodeString("{0} est {1, s
elect, female {allée} other {allé}} à Paris."), Locale
("fr"), status); | | * MessageFormat *msgFmt = new MessageFormat(UnicodeString("{0} est {1, s
elect, female {allée} other {allé}} à Paris."), Locale
("fr"), status); | |
| * if (U_FAILURE(status)) { | | * if (U_FAILURE(status)) { | |
| * return; | | * return; | |
| * } | | * } | |
| * FieldPosition ignore(FieldPosition::DONT_CARE); | | * FieldPosition ignore(FieldPosition::DONT_CARE); | |
| * UnicodeString result; | | * UnicodeString result; | |
| * | | * | |
| * char* str1= "Kirti,female"; | | * char* str1= "Kirti,female"; | |
| * Formattable args1[] = {"Kirti","female"}; | | * Formattable args1[] = {"Kirti","female"}; | |
| * msgFmt->format(args1, 2, result, ignore, status); | | * msgFmt->format(args1, 2, result, ignore, status); | |
| * cout << "Input is " << str1 << " and result is: " << result << endl; | | * cout << "Input is " << str1 << " and result is: " << result << endl; | |
| * delete msgFmt; | | * delete msgFmt; | |
| * | | * | |
| * \endhtmlonly | | * \endhtmlonly | |
|
| | | * </pre> | |
| * </p> | | * </p> | |
| * | | * | |
| * Produces the output:<br> | | * Produces the output:<br> | |
| * \htmlonly | | * \htmlonly | |
| * <code>Kirti est allée à Paris.</code> | | * <code>Kirti est allée à Paris.</code> | |
| * \endhtmlonly | | * \endhtmlonly | |
| * | | * | |
| * @stable ICU 4.4 | | * @stable ICU 4.4 | |
| */ | | */ | |
| | | | |
| | | | |
| skipping to change at line 344 | | skipping to change at line 343 | |
| */ | | */ | |
| static UClassID U_EXPORT2 getStaticClassID(void); | | static UClassID U_EXPORT2 getStaticClassID(void); | |
| | | | |
| /** | | /** | |
| * ICU "poor man's RTTI", returns a UClassID for the actual class. | | * ICU "poor man's RTTI", returns a UClassID for the actual class. | |
| * @stable ICU 4.4 | | * @stable ICU 4.4 | |
| */ | | */ | |
| virtual UClassID getDynamicClassID() const; | | virtual UClassID getDynamicClassID() const; | |
| | | | |
| private: | | private: | |
|
| typedef enum classesForSelectFormat{ | | friend class MessageFormat; | |
| tStartKeyword, | | | |
| tContinueKeyword, | | | |
| tLeftBrace, | | | |
| tRightBrace, | | | |
| tSpace, | | | |
| tOther | | | |
| }CharacterClass; | | | |
| | | | |
| UnicodeString pattern; | | | |
| //Hash to store the keyword, phrase pairs. | | | |
| Hashtable *parsedValuesHash; | | | |
| | | | |
| SelectFormat(); // default constructor not implemented. | | SelectFormat(); // default constructor not implemented. | |
|
| void initHashTable(UErrorCode &status); | | | |
| void cleanHashTable(); | | | |
| | | | |
|
| //For the applyPattern , classifies char.s in one of the characterClass | | /** | |
| . | | * Finds the SelectFormat sub-message for the given keyword, or the "ot | |
| CharacterClass classifyCharacter(UChar ch) const; | | her" sub-message. | |
| //Checks if the "other" keyword is present in pattern. | | * @param pattern A MessagePattern. | |
| UBool checkSufficientDefinition(); | | * @param partIndex the index of the first SelectFormat argument style | |
| //Checks if the keyword passed is valid. | | part. | |
| UBool checkValidKeyword(const UnicodeString& argKeyword) const; | | * @param keyword a keyword to be matched to one of the SelectFormat ar | |
| void parsingFailure(); | | gument's keywords. | |
| void copyHashtable(Hashtable *other, UErrorCode& status); | | * @param ec Error code. | |
| | | * @return the sub-message start part index. | |
| | | */ | |
| | | static int32_t findSubMessage(const MessagePattern& pattern, int32_t pa | |
| | | rtIndex, | |
| | | const UnicodeString& keyword, UErrorCode& | |
| | | ec); | |
| | | | |
| | | MessagePattern msgPattern; | |
| }; | | }; | |
| | | | |
| U_NAMESPACE_END | | U_NAMESPACE_END | |
| | | | |
| #endif /* #if !UCONFIG_NO_FORMATTING */ | | #endif /* #if !UCONFIG_NO_FORMATTING */ | |
| | | | |
| #endif // _SELFMT | | #endif // _SELFMT | |
| //eof | | //eof | |
| | | | |
End of changes. 18 change blocks. |
| 53 lines changed or deleted | | 53 lines changed or added | |
|
| smpdtfmt.h | | smpdtfmt.h | |
| /* | | /* | |
|
| * Copyright (C) 1997-2010, International Business Machines Corporation and | | * Copyright (C) 1997-2011, International Business Machines Corporation and | |
| * others. All Rights Reserved. | | * others. All Rights Reserved. | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| * | | * | |
| * File SMPDTFMT.H | | * File SMPDTFMT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 02/19/97 aliu Converted from java. | | * 02/19/97 aliu Converted from java. | |
| * 07/09/97 helena Make ParsePosition into a class. | | * 07/09/97 helena Make ParsePosition into a class. | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 44 | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| #include "unicode/datefmt.h" | | #include "unicode/datefmt.h" | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| class DateFormatSymbols; | | class DateFormatSymbols; | |
| class DateFormat; | | class DateFormat; | |
| class MessageFormat; | | class MessageFormat; | |
| class FieldPositionHandler; | | class FieldPositionHandler; | |
|
| | | class TimeZoneFormat; | |
| | | | |
| /** | | /** | |
| * | | * | |
| * SimpleDateFormat is a concrete class for formatting and parsing dates in
a | | * SimpleDateFormat is a concrete class for formatting and parsing dates in
a | |
| * language-independent manner. It allows for formatting (millis -> text), | | * language-independent manner. It allows for formatting (millis -> text), | |
| * parsing (text -> millis), and normalization. Formats/Parses a date or ti
me, | | * parsing (text -> millis), and normalization. Formats/Parses a date or ti
me, | |
| * which is the standard milliseconds since 24:00 GMT, Jan 1, 1970. | | * which is the standard milliseconds since 24:00 GMT, Jan 1, 1970. | |
| * <P> | | * <P> | |
| * Clients are encouraged to create a date-time formatter using DateFormat:
:getInstance(), | | * Clients are encouraged to create a date-time formatter using DateFormat:
:getInstance(), | |
| * getDateInstance(), getDateInstance(), or getDateTimeInstance() rather th
an | | * getDateInstance(), getDateInstance(), or getDateTimeInstance() rather th
an | |
| | | | |
| skipping to change at line 807 | | skipping to change at line 808 | |
| /** | | /** | |
| * Called by format() to format a single field. | | * Called by format() to format a single field. | |
| * | | * | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Result is appended to existing contents. | | * Result is appended to existing contents. | |
| * @param ch The format character we encountered in the pattern. | | * @param ch The format character we encountered in the pattern. | |
| * @param count Number of characters in the current pattern symbol
(e.g., | | * @param count Number of characters in the current pattern symbol
(e.g., | |
| * "yyyy" in the pattern would result in a call to thi
s function | | * "yyyy" in the pattern would result in a call to thi
s function | |
| * with ch equal to 'y' and count equal to 4) | | * with ch equal to 'y' and count equal to 4) | |
| * @param handler Records information about field positions. | | * @param handler Records information about field positions. | |
|
| | | * @param cal Calendar to use | |
| * @param status Receives a status code, which will be U_ZERO_ERROR
if the operation | | * @param status Receives a status code, which will be U_ZERO_ERROR
if the operation | |
| * succeeds. | | * succeeds. | |
| */ | | */ | |
| void subFormat(UnicodeString &appendTo, | | void subFormat(UnicodeString &appendTo, | |
| UChar ch, | | UChar ch, | |
| int32_t count, | | int32_t count, | |
| FieldPositionHandler& handler, | | FieldPositionHandler& handler, | |
| Calendar& cal, | | Calendar& cal, | |
| UErrorCode& status) const; // in case of illegal argumen
t | | UErrorCode& status) const; // in case of illegal argumen
t | |
| | | | |
| /** | | /** | |
| * Used by subFormat() to format a numeric value. | | * Used by subFormat() to format a numeric value. | |
| * Appends to toAppendTo a string representation of "value" | | * Appends to toAppendTo a string representation of "value" | |
| * having a number of digits between "minDigits" and | | * having a number of digits between "minDigits" and | |
| * "maxDigits". Uses the DateFormat's NumberFormat. | | * "maxDigits". Uses the DateFormat's NumberFormat. | |
| * | | * | |
|
| | | * @param currentNumberFormat | |
| * @param appendTo Output parameter to receive result. | | * @param appendTo Output parameter to receive result. | |
| * Formatted number is appended to existing contents. | | * Formatted number is appended to existing contents. | |
| * @param value Value to format. | | * @param value Value to format. | |
| * @param minDigits Minimum number of digits the result should have | | * @param minDigits Minimum number of digits the result should have | |
| * @param maxDigits Maximum number of digits the result should have | | * @param maxDigits Maximum number of digits the result should have | |
| */ | | */ | |
| void zeroPaddingNumber(NumberFormat *currentNumberFormat, | | void zeroPaddingNumber(NumberFormat *currentNumberFormat, | |
| UnicodeString &appendTo, | | UnicodeString &appendTo, | |
| int32_t value, | | int32_t value, | |
| int32_t minDigits, | | int32_t minDigits, | |
| | | | |
| skipping to change at line 873 | | skipping to change at line 876 | |
| * @param locale The locale to load the patterns from. | | * @param locale The locale to load the patterns from. | |
| * @param status Filled in with an error code if loading the dat
a from the | | * @param status Filled in with an error code if loading the dat
a from the | |
| * resources fails. | | * resources fails. | |
| */ | | */ | |
| void construct(EStyle timeStyle, EStyle dateStyle, const Locale& locale
, UErrorCode& status); | | void construct(EStyle timeStyle, EStyle dateStyle, const Locale& locale
, UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Called by construct() and the various constructors to set up the Sim
pleDateFormat's | | * Called by construct() and the various constructors to set up the Sim
pleDateFormat's | |
| * Calendar and NumberFormat objects. | | * Calendar and NumberFormat objects. | |
| * @param locale The locale for which we want a Calendar and a Numbe
rFormat. | | * @param locale The locale for which we want a Calendar and a Numbe
rFormat. | |
|
| * @param statuc Filled in with an error code if creating either sub
object fails. | | * @param status Filled in with an error code if creating either sub
object fails. | |
| */ | | */ | |
| void initialize(const Locale& locale, UErrorCode& status); | | void initialize(const Locale& locale, UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Private code-size reduction function used by subParse. | | * Private code-size reduction function used by subParse. | |
| * @param text the time text being parsed. | | * @param text the time text being parsed. | |
| * @param start where to start parsing. | | * @param start where to start parsing. | |
| * @param field the date field being parsed. | | * @param field the date field being parsed. | |
| * @param stringArray the string array to parsed. | | * @param stringArray the string array to parsed. | |
| * @param stringArrayCount the size of the array. | | * @param stringArrayCount the size of the array. | |
| | | | |
| skipping to change at line 908 | | skipping to change at line 911 | |
| * @param stringArrayCount the size of the array. | | * @param stringArrayCount the size of the array. | |
| * @param cal a Calendar set to the date and time to be formatted | | * @param cal a Calendar set to the date and time to be formatted | |
| * into a date/time string. | | * into a date/time string. | |
| * @return the new start position if matching succeeded; a negative num
ber | | * @return the new start position if matching succeeded; a negative num
ber | |
| * indicating matching failure, otherwise. | | * indicating matching failure, otherwise. | |
| */ | | */ | |
| int32_t matchQuarterString(const UnicodeString& text, int32_t start, UC
alendarDateFields field, | | int32_t matchQuarterString(const UnicodeString& text, int32_t start, UC
alendarDateFields field, | |
| const UnicodeString* stringArray, int32_t st
ringArrayCount, Calendar& cal) const; | | const UnicodeString* stringArray, int32_t st
ringArrayCount, Calendar& cal) const; | |
| | | | |
| /** | | /** | |
|
| | | * Private function used by subParse to match literal pattern text. | |
| | | * | |
| | | * @param pattern the pattern string | |
| | | * @param patternOffset the starting offset into the pattern text. On | |
| | | * outupt will be set the offset of the first non-literal charac | |
| | | ter in the pattern | |
| | | * @param text the text being parsed | |
| | | * @param textOffset the starting offset into the text. On output | |
| | | * will be set to the offset of the character after t | |
| | | he match | |
| | | * @param lenient <code>TRUE</code> if the parse is lenient, <code>FALS | |
| | | E</code> otherwise. | |
| | | * | |
| | | * @return <code>TRUE</code> if the literal text could be matched, <cod | |
| | | e>FALSE</code> otherwise. | |
| | | */ | |
| | | static UBool matchLiterals(const UnicodeString &pattern, int32_t &patte | |
| | | rnOffset, | |
| | | const UnicodeString &text, int32_t &textOffs | |
| | | et, UBool lenient); | |
| | | | |
| | | /** | |
| * Private member function that converts the parsed date strings into | | * Private member function that converts the parsed date strings into | |
| * timeFields. Returns -start (for ParsePosition) if failed. | | * timeFields. Returns -start (for ParsePosition) if failed. | |
| * @param text the time text to be parsed. | | * @param text the time text to be parsed. | |
| * @param start where to start parsing. | | * @param start where to start parsing. | |
| * @param ch the pattern character for the date field text to be parsed
. | | * @param ch the pattern character for the date field text to be parsed
. | |
| * @param count the count of a pattern character. | | * @param count the count of a pattern character. | |
| * @param obeyCount if true then the count is strictly obeyed. | | * @param obeyCount if true then the count is strictly obeyed. | |
|
| | | * @param allowNegative | |
| * @param ambiguousYear If true then the two-digit year == the default
start year. | | * @param ambiguousYear If true then the two-digit year == the default
start year. | |
| * @param saveHebrewMonth Used to hang onto month until year is known. | | * @param saveHebrewMonth Used to hang onto month until year is known. | |
| * @param cal a Calendar set to the date and time to be formatted | | * @param cal a Calendar set to the date and time to be formatted | |
| * into a date/time string. | | * into a date/time string. | |
|
| | | * @param patLoc | |
| * @return the new start position if matching succeeded; a negative num
ber | | * @return the new start position if matching succeeded; a negative num
ber | |
| * indicating matching failure, otherwise. | | * indicating matching failure, otherwise. | |
| */ | | */ | |
| int32_t subParse(const UnicodeString& text, int32_t& start, UChar ch, i
nt32_t count, | | int32_t subParse(const UnicodeString& text, int32_t& start, UChar ch, i
nt32_t count, | |
| UBool obeyCount, UBool allowNegative, UBool ambiguousY
ear[], int32_t& saveHebrewMonth, Calendar& cal, | | UBool obeyCount, UBool allowNegative, UBool ambiguousY
ear[], int32_t& saveHebrewMonth, Calendar& cal, | |
| int32_t patLoc) const; | | int32_t patLoc) const; | |
| | | | |
| void parseInt(const UnicodeString& text, | | void parseInt(const UnicodeString& text, | |
| Formattable& number, | | Formattable& number, | |
| ParsePosition& pos, | | ParsePosition& pos, | |
| | | | |
| skipping to change at line 983 | | skipping to change at line 1004 | |
| * @param affix pattern string, taken as a literal | | * @param affix pattern string, taken as a literal | |
| * @param input input text | | * @param input input text | |
| * @param pos offset into input at which to begin matching | | * @param pos offset into input at which to begin matching | |
| * @return length of input that matches, or -1 if match failure | | * @return length of input that matches, or -1 if match failure | |
| */ | | */ | |
| int32_t compareSimpleAffix(const UnicodeString& affix, | | int32_t compareSimpleAffix(const UnicodeString& affix, | |
| const UnicodeString& input, | | const UnicodeString& input, | |
| int32_t pos) const; | | int32_t pos) const; | |
| | | | |
| /** | | /** | |
|
| * Skip over a run of zero or more isRuleWhiteSpace() characters at | | * Skip over a run of zero or more Pattern_White_Space characters at | |
| * pos in text. | | * pos in text. | |
| */ | | */ | |
|
| int32_t skipRuleWhiteSpace(const UnicodeString& text, int32_t pos) cons
t; | | int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos) c
onst; | |
| | | | |
| /** | | /** | |
| * Skip over a run of zero or more isUWhiteSpace() characters at pos | | * Skip over a run of zero or more isUWhiteSpace() characters at pos | |
| * in text. | | * in text. | |
| */ | | */ | |
| int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos) const; | | int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos) const; | |
| | | | |
| /** | | /** | |
| * Private methods for formatting/parsing GMT string | | * Private methods for formatting/parsing GMT string | |
| */ | | */ | |
| | | | |
| skipping to change at line 1036 | | skipping to change at line 1057 | |
| * Used to map pattern characters to Calendar field identifiers. | | * Used to map pattern characters to Calendar field identifiers. | |
| */ | | */ | |
| static const UCalendarDateFields fgPatternIndexToCalendarField[]; | | static const UCalendarDateFields fgPatternIndexToCalendarField[]; | |
| | | | |
| /** | | /** | |
| * Map index into pattern character string to DateFormat field number | | * Map index into pattern character string to DateFormat field number | |
| */ | | */ | |
| static const UDateFormatField fgPatternIndexToDateFormatField[]; | | static const UDateFormatField fgPatternIndexToDateFormatField[]; | |
| | | | |
| /** | | /** | |
|
| | | * Lazy TimeZoneFormat instantiation, semantically const | |
| | | */ | |
| | | TimeZoneFormat *tzFormat() const; | |
| | | | |
| | | /** | |
| * Used to map Calendar field to field level. | | * Used to map Calendar field to field level. | |
| * The larger the level, the smaller the field unit. | | * The larger the level, the smaller the field unit. | |
| * For example, UCAL_ERA level is 0, UCAL_YEAR level is 10, | | * For example, UCAL_ERA level is 0, UCAL_YEAR level is 10, | |
| * UCAL_MONTH level is 20. | | * UCAL_MONTH level is 20. | |
| */ | | */ | |
| static const int32_t fgCalendarFieldToLevel[]; | | static const int32_t fgCalendarFieldToLevel[]; | |
| static const int32_t fgPatternCharToLevel[]; | | static const int32_t fgPatternCharToLevel[]; | |
| | | | |
| /** | | /** | |
| * The formatting pattern for this formatter. | | * The formatting pattern for this formatter. | |
| | | | |
| skipping to change at line 1071 | | skipping to change at line 1097 | |
| */ | | */ | |
| Locale fLocale; | | Locale fLocale; | |
| | | | |
| /** | | /** | |
| * A pointer to an object containing the strings to use in formatting (
e.g., | | * A pointer to an object containing the strings to use in formatting (
e.g., | |
| * month and day names, AM and PM strings, time zone names, etc.) | | * month and day names, AM and PM strings, time zone names, etc.) | |
| */ | | */ | |
| DateFormatSymbols* fSymbols; // Owned | | DateFormatSymbols* fSymbols; // Owned | |
| | | | |
| /** | | /** | |
|
| | | * The time zone formatter | |
| | | */ | |
| | | TimeZoneFormat* fTimeZoneFormat; | |
| | | | |
| | | /** | |
| * If dates have ambiguous years, we map them into the century starting | | * If dates have ambiguous years, we map them into the century starting | |
| * at defaultCenturyStart, which may be any date. If defaultCenturySta
rt is | | * at defaultCenturyStart, which may be any date. If defaultCenturySta
rt is | |
| * set to SYSTEM_DEFAULT_CENTURY, which it is by default, then the syst
em | | * set to SYSTEM_DEFAULT_CENTURY, which it is by default, then the syst
em | |
| * values are used. The instance values defaultCenturyStart and | | * values are used. The instance values defaultCenturyStart and | |
| * defaultCenturyStartYear are only used if explicitly set by the user | | * defaultCenturyStartYear are only used if explicitly set by the user | |
| * through the API method parseAmbiguousDatesAsAfter(). | | * through the API method parseAmbiguousDatesAsAfter(). | |
| */ | | */ | |
| UDate fDefaultCenturyStart; | | UDate fDefaultCenturyStart; | |
| | | | |
| /** | | /** | |
| | | | |
End of changes. 12 change blocks. |
| 4 lines changed or deleted | | 41 lines changed or added | |
|
| timezone.h | | timezone.h | |
| /************************************************************************* | | /************************************************************************* | |
|
| * Copyright (c) 1997-2010, International Business Machines Corporation | | * Copyright (c) 1997-2011, International Business Machines Corporation | |
| * and others. All Rights Reserved. | | * and others. All Rights Reserved. | |
| ************************************************************************** | | ************************************************************************** | |
| * | | * | |
| * File TIMEZONE.H | | * File TIMEZONE.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 04/21/97 aliu Overhauled header. | | * 04/21/97 aliu Overhauled header. | |
| * 07/09/97 helena Changed createInstance to createDefault. | | * 07/09/97 helena Changed createInstance to createDefault. | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| /** | | /** | |
| * \file | | * \file | |
| * \brief C++ API: TimeZone object | | * \brief C++ API: TimeZone object | |
| */ | | */ | |
| | | | |
| #if !UCONFIG_NO_FORMATTING | | #if !UCONFIG_NO_FORMATTING | |
| | | | |
| #include "unicode/uobject.h" | | #include "unicode/uobject.h" | |
| #include "unicode/unistr.h" | | #include "unicode/unistr.h" | |
| #include "unicode/ures.h" | | #include "unicode/ures.h" | |
|
| | | #include "unicode/ucal.h" | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
| class StringEnumeration; | | class StringEnumeration; | |
| | | | |
| /** | | /** | |
| * | | * | |
| * <code>TimeZone</code> represents a time zone offset, and also figures ou
t daylight | | * <code>TimeZone</code> represents a time zone offset, and also figures ou
t daylight | |
| * savings. | | * savings. | |
| * | | * | |
| | | | |
| skipping to change at line 150 | | skipping to change at line 151 | |
| * or a custom ID such as "GMT-8:00". | | * or a custom ID such as "GMT-8:00". | |
| * @return the specified <code>TimeZone</code>, or the GMT zone if the
given ID | | * @return the specified <code>TimeZone</code>, or the GMT zone if the
given ID | |
| * cannot be understood. Return result guaranteed to be non-null. If
you | | * cannot be understood. Return result guaranteed to be non-null. If
you | |
| * require that the specific zone asked for be returned, check the ID o
f the | | * require that the specific zone asked for be returned, check the ID o
f the | |
| * return result. | | * return result. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| static TimeZone* U_EXPORT2 createTimeZone(const UnicodeString& ID); | | static TimeZone* U_EXPORT2 createTimeZone(const UnicodeString& ID); | |
| | | | |
| /** | | /** | |
|
| | | * Returns an enumeration over system time zone IDs with the given | |
| | | * filter conditions. | |
| | | * @param zoneType The system time zone type. | |
| | | * @param region The ISO 3166 two-letter country code or UN M.49 | |
| | | * three-digit area code. When NULL, no filtering | |
| | | * done by region. | |
| | | * @param rawOffset An offset from GMT in milliseconds, ignoring | |
| | | * the effect of daylight savings time, if any. | |
| | | * When NULL, no filtering done by zone offset. | |
| | | * @param ec Output param to filled in with a success or | |
| | | * an error. | |
| | | * @return an enumeration object, owned by the caller. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | static StringEnumeration* U_EXPORT2 createTimeZoneIDEnumeration( | |
| | | USystemTimeZoneType zoneType, | |
| | | const char* region, | |
| | | const int32_t* rawOffset, | |
| | | UErrorCode& ec); | |
| | | | |
| | | /** | |
| * Returns an enumeration over all recognized time zone IDs. (i.e., | | * Returns an enumeration over all recognized time zone IDs. (i.e., | |
| * all strings that createTimeZone() accepts) | | * all strings that createTimeZone() accepts) | |
| * | | * | |
| * @return an enumeration object, owned by the caller. | | * @return an enumeration object, owned by the caller. | |
| * @stable ICU 2.4 | | * @stable ICU 2.4 | |
| */ | | */ | |
| static StringEnumeration* U_EXPORT2 createEnumeration(); | | static StringEnumeration* U_EXPORT2 createEnumeration(); | |
| | | | |
| /** | | /** | |
| * Returns an enumeration over time zone IDs with a given raw | | * Returns an enumeration over time zone IDs with a given raw | |
| | | | |
| skipping to change at line 557 | | skipping to change at line 579 | |
| * or in the default locale if the given locale is not re
cognized. | | * or in the default locale if the given locale is not re
cognized. | |
| * @return A refence to 'result'. | | * @return A refence to 'result'. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const
Locale& locale, UnicodeString& result) const; | | UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const
Locale& locale, UnicodeString& result) const; | |
| | | | |
| /** | | /** | |
| * Queries if this time zone uses daylight savings time. | | * Queries if this time zone uses daylight savings time. | |
| * @return true if this time zone uses daylight savings time, | | * @return true if this time zone uses daylight savings time, | |
| * false, otherwise. | | * false, otherwise. | |
|
| | | * <p><strong>Note:</strong>The default implementation of | |
| | | * ICU TimeZone uses the tz database, which supports historic | |
| | | * rule changes, for system time zones. With the implementation, | |
| | | * there are time zones that used daylight savings time in the | |
| | | * past, but no longer used currently. For example, Asia/Tokyo has | |
| | | * never used daylight savings time since 1951. Most clients would | |
| | | * expect that this method to return <code>FALSE</code> for such case. | |
| | | * The default implementation of this method returns <code>TRUE</code> | |
| | | * when the time zone uses daylight savings time in the current | |
| | | * (Gregorian) calendar year. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| virtual UBool useDaylightTime(void) const = 0; | | virtual UBool useDaylightTime(void) const = 0; | |
| | | | |
| /** | | /** | |
| * Queries if the given date is in daylight savings time in | | * Queries if the given date is in daylight savings time in | |
| * this time zone. | | * this time zone. | |
| * This method is wasteful since it creates a new GregorianCalendar and | | * This method is wasteful since it creates a new GregorianCalendar and | |
| * deletes it each time it is called. This is a deprecated method | | * deletes it each time it is called. This is a deprecated method | |
| * and provided only for Java compatibility. | | * and provided only for Java compatibility. | |
| | | | |
| skipping to change at line 633 | | skipping to change at line 665 | |
| * <p> | | * <p> | |
| * If an underlying TimeZone implementation subclass supports | | * If an underlying TimeZone implementation subclass supports | |
| * historical Daylight Saving Time changes, this method returns | | * historical Daylight Saving Time changes, this method returns | |
| * the known latest daylight saving value. | | * the known latest daylight saving value. | |
| * | | * | |
| * @return the amount of saving time in milliseconds | | * @return the amount of saving time in milliseconds | |
| * @stable ICU 3.6 | | * @stable ICU 3.6 | |
| */ | | */ | |
| virtual int32_t getDSTSavings() const; | | virtual int32_t getDSTSavings() const; | |
| | | | |
|
| | | /** | |
| | | * Gets the region code associated with the given | |
| | | * system time zone ID. The region code is either ISO 3166 | |
| | | * 2-letter country code or UN M.49 3-digit area code. | |
| | | * When the time zone is not associated with a specific location, | |
| | | * for example - "Etc/UTC", "EST5EDT", then this method returns | |
| | | * "001" (UN M.49 area code for World). | |
| | | * | |
| | | * @param id The system time zone ID. | |
| | | * @param region Output buffer for receiving the region code. | |
| | | * @param capacity The size of the output buffer. | |
| | | * @param status Receives the status. When the given time zone | |
| | | ID | |
| | | * is not a known system time zone ID, | |
| | | * U_ILLEGAL_ARGUMENT_ERROR is set. | |
| | | * @return The length of the output region code. | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | static int32_t U_EXPORT2 getRegion(const UnicodeString& id, | |
| | | char *region, int32_t capacity, UErrorCode& status); | |
| | | | |
| protected: | | protected: | |
| | | | |
| /** | | /** | |
| * Default constructor. ID is initialized to the empty string. | | * Default constructor. ID is initialized to the empty string. | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| TimeZone(); | | TimeZone(); | |
| | | | |
| /** | | /** | |
| * Construct a TimeZone with a given ID. | | * Construct a TimeZone with a given ID. | |
| | | | |
| skipping to change at line 679 | | skipping to change at line 731 | |
| * @internal | | * @internal | |
| */ | | */ | |
| static UResourceBundle* loadRule(const UResourceBundle* top, const Unic
odeString& ruleid, UResourceBundle* oldbundle, UErrorCode&status); | | static UResourceBundle* loadRule(const UResourceBundle* top, const Unic
odeString& ruleid, UResourceBundle* oldbundle, UErrorCode&status); | |
| | | | |
| private: | | private: | |
| friend class ZoneMeta; | | friend class ZoneMeta; | |
| | | | |
| static TimeZone* createCustomTimeZone(const UnicodeString&); //
Creates a time zone based on the string. | | static TimeZone* createCustomTimeZone(const UnicodeString&); //
Creates a time zone based on the string. | |
| | | | |
| /** | | /** | |
|
| | | * Finds the given ID in the Olson tzdata. If the given ID is found in | |
| | | the tzdata, | |
| | | * returns the pointer to the ID resource. This method is exposed throu | |
| | | gh ZoneMeta class | |
| | | * for ICU internal implementation and useful for building hashtable us | |
| | | ing a time zone | |
| | | * ID as a key. | |
| | | * @param id zone id string | |
| | | * @return the pointer of the ID resource, or NULL. | |
| | | */ | |
| | | static const UChar* findID(const UnicodeString& id); | |
| | | | |
| | | /** | |
| * Resolve a link in Olson tzdata. When the given id is known and it's
not a link, | | * Resolve a link in Olson tzdata. When the given id is known and it's
not a link, | |
| * the id itself is returned. When the given id is known and it is a l
ink, then | | * the id itself is returned. When the given id is known and it is a l
ink, then | |
| * dereferenced zone id is returned. When the given id is unknown, the
n it returns | | * dereferenced zone id is returned. When the given id is unknown, the
n it returns | |
| * NULL. | | * NULL. | |
| * @param id zone id string | | * @param id zone id string | |
| * @return the dereferenced zone or NULL | | * @return the dereferenced zone or NULL | |
| */ | | */ | |
| static const UChar* dereferOlsonLink(const UnicodeString& id); | | static const UChar* dereferOlsonLink(const UnicodeString& id); | |
| | | | |
| /** | | /** | |
|
| * Returns the region code associated with the given zone. | | * Returns the region code associated with the given zone, | |
| | | * or NULL if the zone is not known. | |
| * @param id zone id string | | * @param id zone id string | |
| * @return the region associated with the given zone | | * @return the region associated with the given zone | |
| */ | | */ | |
| static const UChar* getRegion(const UnicodeString& id); | | static const UChar* getRegion(const UnicodeString& id); | |
| | | | |
| /** | | /** | |
|
| | | * Returns the region code associated with the given zone, | |
| | | * or NULL if the zone is not known. | |
| | | * @param id zone id string | |
| | | * @param status Status parameter | |
| | | * @return the region associated with the given zone | |
| | | */ | |
| | | static const UChar* getRegion(const UnicodeString& id, UErrorCode& stat | |
| | | us); | |
| | | | |
| | | /** | |
| * Parses the given custom time zone identifier | | * Parses the given custom time zone identifier | |
| * @param id id A string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or | | * @param id id A string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or | |
| * GMT[+-]hh. | | * GMT[+-]hh. | |
| * @param sign Receves parsed sign, 1 for positive, -1 for negative. | | * @param sign Receves parsed sign, 1 for positive, -1 for negative. | |
| * @param hour Receives parsed hour field | | * @param hour Receives parsed hour field | |
| * @param minute Receives parsed minute field | | * @param minute Receives parsed minute field | |
| * @param second Receives parsed second field | | * @param second Receives parsed second field | |
| * @return Returns TRUE when the given custom id is valid. | | * @return Returns TRUE when the given custom id is valid. | |
| */ | | */ | |
| static UBool parseCustomID(const UnicodeString& id, int32_t& sign, int3
2_t& hour, | | static UBool parseCustomID(const UnicodeString& id, int32_t& sign, int3
2_t& hour, | |
|
| int32_t& min, int32_t& sec); | | int32_t& minute, int32_t& second); | |
| | | | |
| /** | | /** | |
| * Parse a custom time zone identifier and return the normalized | | * Parse a custom time zone identifier and return the normalized | |
| * custom time zone identifier for the given custom id string. | | * custom time zone identifier for the given custom id string. | |
| * @param id a string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or | | * @param id a string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or | |
| * GMT[+-]hh. | | * GMT[+-]hh. | |
| * @param normalized Receives the normalized custom ID | | * @param normalized Receives the normalized custom ID | |
| * @param status Receives the status. When the input ID string is inva
lid, | | * @param status Receives the status. When the input ID string is inva
lid, | |
| * U_ILLEGAL_ARGUMENT_ERROR is set. | | * U_ILLEGAL_ARGUMENT_ERROR is set. | |
| * @return The normalized custom id string. | | * @return The normalized custom id string. | |
| */ | | */ | |
| static UnicodeString& getCustomID(const UnicodeString& id, UnicodeStrin
g& normalized, | | static UnicodeString& getCustomID(const UnicodeString& id, UnicodeStrin
g& normalized, | |
| UErrorCode& status); | | UErrorCode& status); | |
| | | | |
| /** | | /** | |
| * Returns the normalized custome time zone ID for the given offset fie
lds. | | * Returns the normalized custome time zone ID for the given offset fie
lds. | |
| * @param hour offset hours | | * @param hour offset hours | |
| * @param min offset minutes | | * @param min offset minutes | |
| * @param sec offset seconds | | * @param sec offset seconds | |
|
| * @param netative sign of the offset, TRUE for negative offset. | | * @param negative sign of the offset, TRUE for negative offset. | |
| * @param id Receves the format result (normalized custom ID) | | * @param id Receves the format result (normalized custom ID) | |
| * @return The reference to id | | * @return The reference to id | |
| */ | | */ | |
| static UnicodeString& formatCustomID(int32_t hour, int32_t min, int32_t
sec, | | static UnicodeString& formatCustomID(int32_t hour, int32_t min, int32_t
sec, | |
| UBool negative, UnicodeString& id); | | UBool negative, UnicodeString& id); | |
| | | | |
| /** | | /** | |
| * Responsible for setting up DEFAULT_ZONE. Uses routines in TPlatform
Utilities | | * Responsible for setting up DEFAULT_ZONE. Uses routines in TPlatform
Utilities | |
| * (i.e., platform-specific calls) to get the current system time zone.
Failing | | * (i.e., platform-specific calls) to get the current system time zone.
Failing | |
| * that, uses the platform-specific default time zone. Failing that, u
ses GMT. | | * that, uses the platform-specific default time zone. Failing that, u
ses GMT. | |
| | | | |
| skipping to change at line 749 | | skipping to change at line 821 | |
| | | | |
| // See source file for documentation | | // See source file for documentation | |
| /** | | /** | |
| * Lookup the given name in our system zone table. If found, | | * Lookup the given name in our system zone table. If found, | |
| * instantiate a new zone of that name and return it. If not | | * instantiate a new zone of that name and return it. If not | |
| * found, return 0. | | * found, return 0. | |
| * @param name tthe given name of a system time zone. | | * @param name tthe given name of a system time zone. | |
| * @return the TimeZone indicated by the 'name'. | | * @return the TimeZone indicated by the 'name'. | |
| */ | | */ | |
| static TimeZone* createSystemTimeZone(const UnicodeString& name)
; | | static TimeZone* createSystemTimeZone(const UnicodeString& name)
; | |
|
| | | static TimeZone* createSystemTimeZone(const UnicodeString& name,
UErrorCode& ec); | |
| | | | |
| UnicodeString fID; // this time zone's ID | | UnicodeString fID; // this time zone's ID | |
| | | | |
|
| | | friend class TZEnumeration; | |
| }; | | }; | |
| | | | |
| // ------------------------------------- | | // ------------------------------------- | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| TimeZone::getID(UnicodeString& ID) const | | TimeZone::getID(UnicodeString& ID) const | |
| { | | { | |
| ID = fID; | | ID = fID; | |
| return ID; | | return ID; | |
| } | | } | |
| | | | |
End of changes. 12 change blocks. |
| 4 lines changed or deleted | | 83 lines changed or added | |
|
| uintrnal.h | | uintrnal.h | |
| /* | | /* | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
|
| * Copyright (C) 2004-2010, International Business Machines | | * Copyright (C) 2004-2011, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ***************************************************************************
**** | | ***************************************************************************
**** | |
| * | | * | |
| * file name: uintrnal.h | | * file name: uintrnal.h | |
| * encoding: US-ASCII | | * encoding: US-ASCII | |
| * tab size: 8 (not used) | | * tab size: 8 (not used) | |
| * indentation:4 | | * indentation:4 | |
| * | | * | |
| * Created by: genheaders.pl, a perl script written by Ram Viswanadha | | * Created by: genheaders.pl, a perl script written by Ram Viswanadha | |
| * | | * | |
| | | | |
| skipping to change at line 97 | | skipping to change at line 97 | |
| # define pl_visualRun pl_visualRun_INTERNAL_API_DO_NOT_USE | | # define pl_visualRun pl_visualRun_INTERNAL_API_DO_NOT_USE | |
| # define ucd_close ucd_close_INTERNAL_API_DO_NOT_USE | | # define ucd_close ucd_close_INTERNAL_API_DO_NOT_USE | |
| # define ucd_flushCache ucd_flushCache_INTERNAL_API_DO_NOT_USE | | # define ucd_flushCache ucd_flushCache_INTERNAL_API_DO_NOT_USE | |
| # define ucd_freeCache ucd_freeCache_INTERNAL_API_DO_NOT_USE | | # define ucd_freeCache ucd_freeCache_INTERNAL_API_DO_NOT_USE | |
| # define ucd_getCollator ucd_getCollator_INTERNAL_API_DO_NOT_USE | | # define ucd_getCollator ucd_getCollator_INTERNAL_API_DO_NOT_USE | |
| # define ucd_open ucd_open_INTERNAL_API_DO_NOT_USE | | # define ucd_open ucd_open_INTERNAL_API_DO_NOT_USE | |
| # define ucol_equals ucol_equals_INTERNAL_API_DO_NOT_USE | | # define ucol_equals ucol_equals_INTERNAL_API_DO_NOT_USE | |
| # define ucol_forceHanImplicit ucol_forceHanImplicit_INTERNAL_API_DO
_NOT_USE | | # define ucol_forceHanImplicit ucol_forceHanImplicit_INTERNAL_API_DO
_NOT_USE | |
| # define ucol_forgetUCA ucol_forgetUCA_INTERNAL_API_DO_NOT_USE | | # define ucol_forgetUCA ucol_forgetUCA_INTERNAL_API_DO_NOT_USE | |
| # define ucol_getAttributeOrDefault ucol_getAttributeOrDefault_INTER
NAL_API_DO_NOT_USE | | # define ucol_getAttributeOrDefault ucol_getAttributeOrDefault_INTER
NAL_API_DO_NOT_USE | |
|
| # define ucol_getReorderCodes ucol_getReorderCodes_INTERNAL_API_DO_N
OT_USE | | | |
| # define ucol_getUnsafeSet ucol_getUnsafeSet_INTERNAL_API_DO_NOT_USE | | # define ucol_getUnsafeSet ucol_getUnsafeSet_INTERNAL_API_DO_NOT_USE | |
| # define ucol_nextProcessed ucol_nextProcessed_INTERNAL_API_DO_NOT_U
SE | | # define ucol_nextProcessed ucol_nextProcessed_INTERNAL_API_DO_NOT_U
SE | |
|
| # define ucol_prepareShortStringOpen ucol_prepareShortStringOpen_INT
ERNAL_API_DO_NOT_USE | | | |
| # define ucol_previousProcessed ucol_previousProcessed_INTERNAL_API_
DO_NOT_USE | | # define ucol_previousProcessed ucol_previousProcessed_INTERNAL_API_
DO_NOT_USE | |
|
| # define ucol_setReorderCodes ucol_setReorderCodes_INTERNAL_API_DO_N
OT_USE | | | |
| # define udat_applyPatternRelative udat_applyPatternRelative_INTERNA
L_API_DO_NOT_USE | | # define udat_applyPatternRelative udat_applyPatternRelative_INTERNA
L_API_DO_NOT_USE | |
| # define udat_toPatternRelativeDate udat_toPatternRelativeDate_INTER
NAL_API_DO_NOT_USE | | # define udat_toPatternRelativeDate udat_toPatternRelativeDate_INTER
NAL_API_DO_NOT_USE | |
| # define udat_toPatternRelativeTime udat_toPatternRelativeTime_INTER
NAL_API_DO_NOT_USE | | # define udat_toPatternRelativeTime udat_toPatternRelativeTime_INTER
NAL_API_DO_NOT_USE | |
| # define uplug_getConfiguration uplug_getConfiguration_INTERNAL_API_
DO_NOT_USE | | # define uplug_getConfiguration uplug_getConfiguration_INTERNAL_API_
DO_NOT_USE | |
| # define uplug_getContext uplug_getContext_INTERNAL_API_DO_NOT_USE | | # define uplug_getContext uplug_getContext_INTERNAL_API_DO_NOT_USE | |
| # define uplug_getCurrentLevel uplug_getCurrentLevel_INTERNAL_API_DO
_NOT_USE | | # define uplug_getCurrentLevel uplug_getCurrentLevel_INTERNAL_API_DO
_NOT_USE | |
| # define uplug_getLibrary uplug_getLibrary_INTERNAL_API_DO_NOT_USE | | # define uplug_getLibrary uplug_getLibrary_INTERNAL_API_DO_NOT_USE | |
| # define uplug_getLibraryName uplug_getLibraryName_INTERNAL_API_DO_N
OT_USE | | # define uplug_getLibraryName uplug_getLibraryName_INTERNAL_API_DO_N
OT_USE | |
| # define uplug_getPlugLevel uplug_getPlugLevel_INTERNAL_API_DO_NOT_U
SE | | # define uplug_getPlugLevel uplug_getPlugLevel_INTERNAL_API_DO_NOT_U
SE | |
| # define uplug_getPlugLoadStatus uplug_getPlugLoadStatus_INTERNAL_AP
I_DO_NOT_USE | | # define uplug_getPlugLoadStatus uplug_getPlugLoadStatus_INTERNAL_AP
I_DO_NOT_USE | |
| | | | |
| skipping to change at line 128 | | skipping to change at line 125 | |
| # define uplug_removePlug uplug_removePlug_INTERNAL_API_DO_NOT_USE | | # define uplug_removePlug uplug_removePlug_INTERNAL_API_DO_NOT_USE | |
| # define uplug_setContext uplug_setContext_INTERNAL_API_DO_NOT_USE | | # define uplug_setContext uplug_setContext_INTERNAL_API_DO_NOT_USE | |
| # define uplug_setPlugLevel uplug_setPlugLevel_INTERNAL_API_DO_NOT_U
SE | | # define uplug_setPlugLevel uplug_setPlugLevel_INTERNAL_API_DO_NOT_U
SE | |
| # define uplug_setPlugName uplug_setPlugName_INTERNAL_API_DO_NOT_USE | | # define uplug_setPlugName uplug_setPlugName_INTERNAL_API_DO_NOT_USE | |
| # define uplug_setPlugNoUnload uplug_setPlugNoUnload_INTERNAL_API_DO
_NOT_USE | | # define uplug_setPlugNoUnload uplug_setPlugNoUnload_INTERNAL_API_DO
_NOT_USE | |
| # define uprv_getDefaultCodepage uprv_getDefaultCodepage_INTERNAL_AP
I_DO_NOT_USE | | # define uprv_getDefaultCodepage uprv_getDefaultCodepage_INTERNAL_AP
I_DO_NOT_USE | |
| # define uprv_getDefaultLocaleID uprv_getDefaultLocaleID_INTERNAL_AP
I_DO_NOT_USE | | # define uprv_getDefaultLocaleID uprv_getDefaultLocaleID_INTERNAL_AP
I_DO_NOT_USE | |
| # define ures_openFillIn ures_openFillIn_INTERNAL_API_DO_NOT_USE | | # define ures_openFillIn ures_openFillIn_INTERNAL_API_DO_NOT_USE | |
| # define usearch_search usearch_search_INTERNAL_API_DO_NOT_USE | | # define usearch_search usearch_search_INTERNAL_API_DO_NOT_USE | |
| # define usearch_searchBackwards usearch_searchBackwards_INTERNAL_AP
I_DO_NOT_USE | | # define usearch_searchBackwards usearch_searchBackwards_INTERNAL_AP
I_DO_NOT_USE | |
|
| # define utext_caseCompare utext_caseCompare_INTERNAL_API_DO_NOT_USE | | | |
| # define utext_caseCompareNativeLimit utext_caseCompareNativeLimit_I | | | |
| NTERNAL_API_DO_NOT_USE | | | |
| # define utext_compare utext_compare_INTERNAL_API_DO_NOT_USE | | | |
| # define utext_compareNativeLimit utext_compareNativeLimit_INTERNAL_ | | | |
| API_DO_NOT_USE | | | |
| # define utf8_appendCharSafeBody utf8_appendCharSafeBody_INTERNAL_AP
I_DO_NOT_USE | | # define utf8_appendCharSafeBody utf8_appendCharSafeBody_INTERNAL_AP
I_DO_NOT_USE | |
| # define utf8_back1SafeBody utf8_back1SafeBody_INTERNAL_API_DO_NOT_U
SE | | # define utf8_back1SafeBody utf8_back1SafeBody_INTERNAL_API_DO_NOT_U
SE | |
| # define utf8_countTrailBytes utf8_countTrailBytes_INTERNAL_API_DO_N
OT_USE | | # define utf8_countTrailBytes utf8_countTrailBytes_INTERNAL_API_DO_N
OT_USE | |
| # define utf8_nextCharSafeBody utf8_nextCharSafeBody_INTERNAL_API_DO
_NOT_USE | | # define utf8_nextCharSafeBody utf8_nextCharSafeBody_INTERNAL_API_DO
_NOT_USE | |
| # define utf8_prevCharSafeBody utf8_prevCharSafeBody_INTERNAL_API_DO
_NOT_USE | | # define utf8_prevCharSafeBody utf8_prevCharSafeBody_INTERNAL_API_DO
_NOT_USE | |
| # else | | # else | |
|
| # define RegexPatternDump_4_6 RegexPatternDump_INTERNAL_API_DO_NOT_U | | # define RegexPatternDump_48 RegexPatternDump_INTERNAL_API_DO_NOT_US | |
| SE | | E | |
| # define bms_close_4_6 bms_close_INTERNAL_API_DO_NOT_USE | | # define bms_close_48 bms_close_INTERNAL_API_DO_NOT_USE | |
| # define bms_empty_4_6 bms_empty_INTERNAL_API_DO_NOT_USE | | # define bms_empty_48 bms_empty_INTERNAL_API_DO_NOT_USE | |
| # define bms_getData_4_6 bms_getData_INTERNAL_API_DO_NOT_USE | | # define bms_getData_48 bms_getData_INTERNAL_API_DO_NOT_USE | |
| # define bms_open_4_6 bms_open_INTERNAL_API_DO_NOT_USE | | # define bms_open_48 bms_open_INTERNAL_API_DO_NOT_USE | |
| # define bms_search_4_6 bms_search_INTERNAL_API_DO_NOT_USE | | # define bms_search_48 bms_search_INTERNAL_API_DO_NOT_USE | |
| # define bms_setTargetString_4_6 bms_setTargetString_INTERNAL_API_DO | | # define bms_setTargetString_48 bms_setTargetString_INTERNAL_API_DO_ | |
| _NOT_USE | | NOT_USE | |
| # define pl_addFontRun_4_6 pl_addFontRun_INTERNAL_API_DO_NOT_USE | | # define pl_addFontRun_48 pl_addFontRun_INTERNAL_API_DO_NOT_USE | |
| # define pl_addLocaleRun_4_6 pl_addLocaleRun_INTERNAL_API_DO_NOT_USE | | # define pl_addLocaleRun_48 pl_addLocaleRun_INTERNAL_API_DO_NOT_USE | |
| # define pl_addValueRun_4_6 pl_addValueRun_INTERNAL_API_DO_NOT_USE | | # define pl_addValueRun_48 pl_addValueRun_INTERNAL_API_DO_NOT_USE | |
| # define pl_close_4_6 pl_close_INTERNAL_API_DO_NOT_USE | | # define pl_closeFontRuns_48 pl_closeFontRuns_INTERNAL_API_DO_NOT_US | |
| # define pl_closeFontRuns_4_6 pl_closeFontRuns_INTERNAL_API_DO_NOT_U | | E | |
| SE | | # define pl_closeLine_48 pl_closeLine_INTERNAL_API_DO_NOT_USE | |
| # define pl_closeLine_4_6 pl_closeLine_INTERNAL_API_DO_NOT_USE | | # define pl_closeLocaleRuns_48 pl_closeLocaleRuns_INTERNAL_API_DO_NO | |
| # define pl_closeLocaleRuns_4_6 pl_closeLocaleRuns_INTERNAL_API_DO_N | | T_USE | |
| OT_USE | | # define pl_closeValueRuns_48 pl_closeValueRuns_INTERNAL_API_DO_NOT_ | |
| # define pl_closeValueRuns_4_6 pl_closeValueRuns_INTERNAL_API_DO_NOT | | USE | |
| _USE | | # define pl_close_48 pl_close_INTERNAL_API_DO_NOT_USE | |
| # define pl_countLineRuns_4_6 pl_countLineRuns_INTERNAL_API_DO_NOT_U | | # define pl_countLineRuns_48 pl_countLineRuns_INTERNAL_API_DO_NOT_US | |
| SE | | E | |
| # define pl_getAscent_4_6 pl_getAscent_INTERNAL_API_DO_NOT_USE | | # define pl_getAscent_48 pl_getAscent_INTERNAL_API_DO_NOT_USE | |
| # define pl_getDescent_4_6 pl_getDescent_INTERNAL_API_DO_NOT_USE | | # define pl_getDescent_48 pl_getDescent_INTERNAL_API_DO_NOT_USE | |
| # define pl_getFontRunCount_4_6 pl_getFontRunCount_INTERNAL_API_DO_N | | # define pl_getFontRunCount_48 pl_getFontRunCount_INTERNAL_API_DO_NO | |
| OT_USE | | T_USE | |
| # define pl_getFontRunFont_4_6 pl_getFontRunFont_INTERNAL_API_DO_NOT | | # define pl_getFontRunFont_48 pl_getFontRunFont_INTERNAL_API_DO_NOT_ | |
| _USE | | USE | |
| # define pl_getFontRunLastLimit_4_6 pl_getFontRunLastLimit_INTERNAL_ | | # define pl_getFontRunLastLimit_48 pl_getFontRunLastLimit_INTERNAL_A | |
| API_DO_NOT_USE | | PI_DO_NOT_USE | |
| # define pl_getFontRunLimit_4_6 pl_getFontRunLimit_INTERNAL_API_DO_N | | # define pl_getFontRunLimit_48 pl_getFontRunLimit_INTERNAL_API_DO_NO | |
| OT_USE | | T_USE | |
| # define pl_getLeading_4_6 pl_getLeading_INTERNAL_API_DO_NOT_USE | | # define pl_getLeading_48 pl_getLeading_INTERNAL_API_DO_NOT_USE | |
| # define pl_getLineAscent_4_6 pl_getLineAscent_INTERNAL_API_DO_NOT_U | | # define pl_getLineAscent_48 pl_getLineAscent_INTERNAL_API_DO_NOT_US | |
| SE | | E | |
| # define pl_getLineDescent_4_6 pl_getLineDescent_INTERNAL_API_DO_NOT | | # define pl_getLineDescent_48 pl_getLineDescent_INTERNAL_API_DO_NOT_ | |
| _USE | | USE | |
| # define pl_getLineLeading_4_6 pl_getLineLeading_INTERNAL_API_DO_NOT | | # define pl_getLineLeading_48 pl_getLineLeading_INTERNAL_API_DO_NOT_ | |
| _USE | | USE | |
| # define pl_getLineVisualRun_4_6 pl_getLineVisualRun_INTERNAL_API_DO | | # define pl_getLineVisualRun_48 pl_getLineVisualRun_INTERNAL_API_DO_ | |
| _NOT_USE | | NOT_USE | |
| # define pl_getLineWidth_4_6 pl_getLineWidth_INTERNAL_API_DO_NOT_USE | | # define pl_getLineWidth_48 pl_getLineWidth_INTERNAL_API_DO_NOT_USE | |
| # define pl_getLocaleRunCount_4_6 pl_getLocaleRunCount_INTERNAL_API_ | | # define pl_getLocaleRunCount_48 pl_getLocaleRunCount_INTERNAL_API_D | |
| DO_NOT_USE | | O_NOT_USE | |
| # define pl_getLocaleRunLastLimit_4_6 pl_getLocaleRunLastLimit_INTER | | # define pl_getLocaleRunLastLimit_48 pl_getLocaleRunLastLimit_INTERN | |
| NAL_API_DO_NOT_USE | | AL_API_DO_NOT_USE | |
| # define pl_getLocaleRunLimit_4_6 pl_getLocaleRunLimit_INTERNAL_API_ | | # define pl_getLocaleRunLimit_48 pl_getLocaleRunLimit_INTERNAL_API_D | |
| DO_NOT_USE | | O_NOT_USE | |
| # define pl_getLocaleRunLocale_4_6 pl_getLocaleRunLocale_INTERNAL_AP | | # define pl_getLocaleRunLocale_48 pl_getLocaleRunLocale_INTERNAL_API | |
| I_DO_NOT_USE | | _DO_NOT_USE | |
| # define pl_getParagraphLevel_4_6 pl_getParagraphLevel_INTERNAL_API_ | | # define pl_getParagraphLevel_48 pl_getParagraphLevel_INTERNAL_API_D | |
| DO_NOT_USE | | O_NOT_USE | |
| # define pl_getTextDirection_4_6 pl_getTextDirection_INTERNAL_API_DO | | # define pl_getTextDirection_48 pl_getTextDirection_INTERNAL_API_DO_ | |
| _NOT_USE | | NOT_USE | |
| # define pl_getValueRunCount_4_6 pl_getValueRunCount_INTERNAL_API_DO | | # define pl_getValueRunCount_48 pl_getValueRunCount_INTERNAL_API_DO_ | |
| _NOT_USE | | NOT_USE | |
| # define pl_getValueRunLastLimit_4_6 pl_getValueRunLastLimit_INTERNA | | # define pl_getValueRunLastLimit_48 pl_getValueRunLastLimit_INTERNAL | |
| L_API_DO_NOT_USE | | _API_DO_NOT_USE | |
| # define pl_getValueRunLimit_4_6 pl_getValueRunLimit_INTERNAL_API_DO | | # define pl_getValueRunLimit_48 pl_getValueRunLimit_INTERNAL_API_DO_ | |
| _NOT_USE | | NOT_USE | |
| # define pl_getValueRunValue_4_6 pl_getValueRunValue_INTERNAL_API_DO | | # define pl_getValueRunValue_48 pl_getValueRunValue_INTERNAL_API_DO_ | |
| _NOT_USE | | NOT_USE | |
| # define pl_getVisualRunAscent_4_6 pl_getVisualRunAscent_INTERNAL_AP | | # define pl_getVisualRunAscent_48 pl_getVisualRunAscent_INTERNAL_API | |
| I_DO_NOT_USE | | _DO_NOT_USE | |
| # define pl_getVisualRunDescent_4_6 pl_getVisualRunDescent_INTERNAL_ | | # define pl_getVisualRunDescent_48 pl_getVisualRunDescent_INTERNAL_A | |
| API_DO_NOT_USE | | PI_DO_NOT_USE | |
| # define pl_getVisualRunDirection_4_6 pl_getVisualRunDirection_INTER | | # define pl_getVisualRunDirection_48 pl_getVisualRunDirection_INTERN | |
| NAL_API_DO_NOT_USE | | AL_API_DO_NOT_USE | |
| # define pl_getVisualRunFont_4_6 pl_getVisualRunFont_INTERNAL_API_DO | | # define pl_getVisualRunFont_48 pl_getVisualRunFont_INTERNAL_API_DO_ | |
| _NOT_USE | | NOT_USE | |
| # define pl_getVisualRunGlyphCount_4_6 pl_getVisualRunGlyphCount_INT | | # define pl_getVisualRunGlyphCount_48 pl_getVisualRunGlyphCount_INTE | |
| ERNAL_API_DO_NOT_USE | | RNAL_API_DO_NOT_USE | |
| # define pl_getVisualRunGlyphToCharMap_4_6 pl_getVisualRunGlyphToCha | | # define pl_getVisualRunGlyphToCharMap_48 pl_getVisualRunGlyphToChar | |
| rMap_INTERNAL_API_DO_NOT_USE | | Map_INTERNAL_API_DO_NOT_USE | |
| # define pl_getVisualRunGlyphs_4_6 pl_getVisualRunGlyphs_INTERNAL_AP | | # define pl_getVisualRunGlyphs_48 pl_getVisualRunGlyphs_INTERNAL_API | |
| I_DO_NOT_USE | | _DO_NOT_USE | |
| # define pl_getVisualRunLeading_4_6 pl_getVisualRunLeading_INTERNAL_ | | # define pl_getVisualRunLeading_48 pl_getVisualRunLeading_INTERNAL_A | |
| API_DO_NOT_USE | | PI_DO_NOT_USE | |
| # define pl_getVisualRunPositions_4_6 pl_getVisualRunPositions_INTER | | # define pl_getVisualRunPositions_48 pl_getVisualRunPositions_INTERN | |
| NAL_API_DO_NOT_USE | | AL_API_DO_NOT_USE | |
| # define pl_line_4_6 pl_line_INTERNAL_API_DO_NOT_USE | | # define pl_line_48 pl_line_INTERNAL_API_DO_NOT_USE | |
| # define pl_nextLine_4_6 pl_nextLine_INTERNAL_API_DO_NOT_USE | | # define pl_nextLine_48 pl_nextLine_INTERNAL_API_DO_NOT_USE | |
| # define pl_openEmptyFontRuns_4_6 pl_openEmptyFontRuns_INTERNAL_API_ | | # define pl_openEmptyFontRuns_48 pl_openEmptyFontRuns_INTERNAL_API_D | |
| DO_NOT_USE | | O_NOT_USE | |
| # define pl_openEmptyLocaleRuns_4_6 pl_openEmptyLocaleRuns_INTERNAL_ | | # define pl_openEmptyLocaleRuns_48 pl_openEmptyLocaleRuns_INTERNAL_A | |
| API_DO_NOT_USE | | PI_DO_NOT_USE | |
| # define pl_openEmptyValueRuns_4_6 pl_openEmptyValueRuns_INTERNAL_AP | | # define pl_openEmptyValueRuns_48 pl_openEmptyValueRuns_INTERNAL_API | |
| I_DO_NOT_USE | | _DO_NOT_USE | |
| # define pl_openFontRuns_4_6 pl_openFontRuns_INTERNAL_API_DO_NOT_USE | | # define pl_openFontRuns_48 pl_openFontRuns_INTERNAL_API_DO_NOT_USE | |
| # define pl_openLocaleRuns_4_6 pl_openLocaleRuns_INTERNAL_API_DO_NOT | | # define pl_openLocaleRuns_48 pl_openLocaleRuns_INTERNAL_API_DO_NOT_ | |
| _USE | | USE | |
| # define pl_openValueRuns_4_6 pl_openValueRuns_INTERNAL_API_DO_NOT_U | | # define pl_openValueRuns_48 pl_openValueRuns_INTERNAL_API_DO_NOT_US | |
| SE | | E | |
| # define pl_paragraph_4_6 pl_paragraph_INTERNAL_API_DO_NOT_USE | | # define pl_paragraph_48 pl_paragraph_INTERNAL_API_DO_NOT_USE | |
| # define pl_reflow_4_6 pl_reflow_INTERNAL_API_DO_NOT_USE | | # define pl_reflow_48 pl_reflow_INTERNAL_API_DO_NOT_USE | |
| # define pl_resetFontRuns_4_6 pl_resetFontRuns_INTERNAL_API_DO_NOT_U | | # define pl_resetFontRuns_48 pl_resetFontRuns_INTERNAL_API_DO_NOT_US | |
| SE | | E | |
| # define pl_resetLocaleRuns_4_6 pl_resetLocaleRuns_INTERNAL_API_DO_N | | # define pl_resetLocaleRuns_48 pl_resetLocaleRuns_INTERNAL_API_DO_NO | |
| OT_USE | | T_USE | |
| # define pl_resetValueRuns_4_6 pl_resetValueRuns_INTERNAL_API_DO_NOT | | # define pl_resetValueRuns_48 pl_resetValueRuns_INTERNAL_API_DO_NOT_ | |
| _USE | | USE | |
| # define pl_visualRun_4_6 pl_visualRun_INTERNAL_API_DO_NOT_USE | | # define pl_visualRun_48 pl_visualRun_INTERNAL_API_DO_NOT_USE | |
| # define ucd_close_4_6 ucd_close_INTERNAL_API_DO_NOT_USE | | # define ucd_close_48 ucd_close_INTERNAL_API_DO_NOT_USE | |
| # define ucd_flushCache_4_6 ucd_flushCache_INTERNAL_API_DO_NOT_USE | | # define ucd_flushCache_48 ucd_flushCache_INTERNAL_API_DO_NOT_USE | |
| # define ucd_freeCache_4_6 ucd_freeCache_INTERNAL_API_DO_NOT_USE | | # define ucd_freeCache_48 ucd_freeCache_INTERNAL_API_DO_NOT_USE | |
| # define ucd_getCollator_4_6 ucd_getCollator_INTERNAL_API_DO_NOT_USE | | # define ucd_getCollator_48 ucd_getCollator_INTERNAL_API_DO_NOT_USE | |
| # define ucd_open_4_6 ucd_open_INTERNAL_API_DO_NOT_USE | | # define ucd_open_48 ucd_open_INTERNAL_API_DO_NOT_USE | |
| # define ucol_equals_4_6 ucol_equals_INTERNAL_API_DO_NOT_USE | | # define ucol_equals_48 ucol_equals_INTERNAL_API_DO_NOT_USE | |
| # define ucol_forceHanImplicit_4_6 ucol_forceHanImplicit_INTERNAL_AP | | # define ucol_forceHanImplicit_48 ucol_forceHanImplicit_INTERNAL_API | |
| I_DO_NOT_USE | | _DO_NOT_USE | |
| # define ucol_forgetUCA_4_6 ucol_forgetUCA_INTERNAL_API_DO_NOT_USE | | # define ucol_forgetUCA_48 ucol_forgetUCA_INTERNAL_API_DO_NOT_USE | |
| # define ucol_getAttributeOrDefault_4_6 ucol_getAttributeOrDefault_I | | # define ucol_getAttributeOrDefault_48 ucol_getAttributeOrDefault_IN | |
| NTERNAL_API_DO_NOT_USE | | TERNAL_API_DO_NOT_USE | |
| # define ucol_getReorderCodes_4_6 ucol_getReorderCodes_INTERNAL_API_ | | # define ucol_getUnsafeSet_48 ucol_getUnsafeSet_INTERNAL_API_DO_NOT_ | |
| DO_NOT_USE | | USE | |
| # define ucol_getUnsafeSet_4_6 ucol_getUnsafeSet_INTERNAL_API_DO_NOT | | # define ucol_nextProcessed_48 ucol_nextProcessed_INTERNAL_API_DO_NO | |
| _USE | | T_USE | |
| # define ucol_nextProcessed_4_6 ucol_nextProcessed_INTERNAL_API_DO_N | | # define ucol_previousProcessed_48 ucol_previousProcessed_INTERNAL_A | |
| OT_USE | | PI_DO_NOT_USE | |
| # define ucol_prepareShortStringOpen_4_6 ucol_prepareShortStringOpen | | # define udat_applyPatternRelative_48 udat_applyPatternRelative_INTE | |
| _INTERNAL_API_DO_NOT_USE | | RNAL_API_DO_NOT_USE | |
| # define ucol_previousProcessed_4_6 ucol_previousProcessed_INTERNAL_ | | # define udat_toPatternRelativeDate_48 udat_toPatternRelativeDate_IN | |
| API_DO_NOT_USE | | TERNAL_API_DO_NOT_USE | |
| # define ucol_setReorderCodes_4_6 ucol_setReorderCodes_INTERNAL_API_ | | # define udat_toPatternRelativeTime_48 udat_toPatternRelativeTime_IN | |
| DO_NOT_USE | | TERNAL_API_DO_NOT_USE | |
| # define udat_applyPatternRelative_4_6 udat_applyPatternRelative_INT | | # define uplug_getConfiguration_48 uplug_getConfiguration_INTERNAL_A | |
| ERNAL_API_DO_NOT_USE | | PI_DO_NOT_USE | |
| # define udat_toPatternRelativeDate_4_6 udat_toPatternRelativeDate_I | | # define uplug_getContext_48 uplug_getContext_INTERNAL_API_DO_NOT_US | |
| NTERNAL_API_DO_NOT_USE | | E | |
| # define udat_toPatternRelativeTime_4_6 udat_toPatternRelativeTime_I | | # define uplug_getCurrentLevel_48 uplug_getCurrentLevel_INTERNAL_API | |
| NTERNAL_API_DO_NOT_USE | | _DO_NOT_USE | |
| # define uplug_getConfiguration_4_6 uplug_getConfiguration_INTERNAL_ | | # define uplug_getLibraryName_48 uplug_getLibraryName_INTERNAL_API_D | |
| API_DO_NOT_USE | | O_NOT_USE | |
| # define uplug_getContext_4_6 uplug_getContext_INTERNAL_API_DO_NOT_U | | # define uplug_getLibrary_48 uplug_getLibrary_INTERNAL_API_DO_NOT_US | |
| SE | | E | |
| # define uplug_getCurrentLevel_4_6 uplug_getCurrentLevel_INTERNAL_AP | | # define uplug_getPlugLevel_48 uplug_getPlugLevel_INTERNAL_API_DO_NO | |
| I_DO_NOT_USE | | T_USE | |
| # define uplug_getLibrary_4_6 uplug_getLibrary_INTERNAL_API_DO_NOT_U | | # define uplug_getPlugLoadStatus_48 uplug_getPlugLoadStatus_INTERNAL | |
| SE | | _API_DO_NOT_USE | |
| # define uplug_getLibraryName_4_6 uplug_getLibraryName_INTERNAL_API_ | | # define uplug_getPlugName_48 uplug_getPlugName_INTERNAL_API_DO_NOT_ | |
| DO_NOT_USE | | USE | |
| # define uplug_getPlugLevel_4_6 uplug_getPlugLevel_INTERNAL_API_DO_N | | # define uplug_getSymbolName_48 uplug_getSymbolName_INTERNAL_API_DO_ | |
| OT_USE | | NOT_USE | |
| # define uplug_getPlugLoadStatus_4_6 uplug_getPlugLoadStatus_INTERNA | | # define uplug_loadPlugFromEntrypoint_48 uplug_loadPlugFromEntrypoin | |
| L_API_DO_NOT_USE | | t_INTERNAL_API_DO_NOT_USE | |
| # define uplug_getPlugName_4_6 uplug_getPlugName_INTERNAL_API_DO_NOT | | # define uplug_loadPlugFromLibrary_48 uplug_loadPlugFromLibrary_INTE | |
| _USE | | RNAL_API_DO_NOT_USE | |
| # define uplug_getSymbolName_4_6 uplug_getSymbolName_INTERNAL_API_DO | | # define uplug_nextPlug_48 uplug_nextPlug_INTERNAL_API_DO_NOT_USE | |
| _NOT_USE | | # define uplug_removePlug_48 uplug_removePlug_INTERNAL_API_DO_NOT_US | |
| # define uplug_loadPlugFromEntrypoint_4_6 uplug_loadPlugFromEntrypoi | | E | |
| nt_INTERNAL_API_DO_NOT_USE | | # define uplug_setContext_48 uplug_setContext_INTERNAL_API_DO_NOT_US | |
| # define uplug_loadPlugFromLibrary_4_6 uplug_loadPlugFromLibrary_INT | | E | |
| ERNAL_API_DO_NOT_USE | | # define uplug_setPlugLevel_48 uplug_setPlugLevel_INTERNAL_API_DO_NO | |
| # define uplug_nextPlug_4_6 uplug_nextPlug_INTERNAL_API_DO_NOT_USE | | T_USE | |
| # define uplug_removePlug_4_6 uplug_removePlug_INTERNAL_API_DO_NOT_U | | # define uplug_setPlugName_48 uplug_setPlugName_INTERNAL_API_DO_NOT_ | |
| SE | | USE | |
| # define uplug_setContext_4_6 uplug_setContext_INTERNAL_API_DO_NOT_U | | # define uplug_setPlugNoUnload_48 uplug_setPlugNoUnload_INTERNAL_API | |
| SE | | _DO_NOT_USE | |
| # define uplug_setPlugLevel_4_6 uplug_setPlugLevel_INTERNAL_API_DO_N | | # define uprv_getDefaultCodepage_48 uprv_getDefaultCodepage_INTERNAL | |
| OT_USE | | _API_DO_NOT_USE | |
| # define uplug_setPlugName_4_6 uplug_setPlugName_INTERNAL_API_DO_NOT | | # define uprv_getDefaultLocaleID_48 uprv_getDefaultLocaleID_INTERNAL | |
| _USE | | _API_DO_NOT_USE | |
| # define uplug_setPlugNoUnload_4_6 uplug_setPlugNoUnload_INTERNAL_AP | | # define ures_openFillIn_48 ures_openFillIn_INTERNAL_API_DO_NOT_USE | |
| I_DO_NOT_USE | | # define usearch_searchBackwards_48 usearch_searchBackwards_INTERNAL | |
| # define uprv_getDefaultCodepage_4_6 uprv_getDefaultCodepage_INTERNA | | _API_DO_NOT_USE | |
| L_API_DO_NOT_USE | | # define usearch_search_48 usearch_search_INTERNAL_API_DO_NOT_USE | |
| # define uprv_getDefaultLocaleID_4_6 uprv_getDefaultLocaleID_INTERNA | | # define utf8_appendCharSafeBody_48 utf8_appendCharSafeBody_INTERNAL | |
| L_API_DO_NOT_USE | | _API_DO_NOT_USE | |
| # define ures_openFillIn_4_6 ures_openFillIn_INTERNAL_API_DO_NOT_USE | | # define utf8_back1SafeBody_48 utf8_back1SafeBody_INTERNAL_API_DO_NO | |
| # define usearch_search_4_6 usearch_search_INTERNAL_API_DO_NOT_USE | | T_USE | |
| # define usearch_searchBackwards_4_6 usearch_searchBackwards_INTERNA | | # define utf8_countTrailBytes_48 utf8_countTrailBytes_INTERNAL_API_D | |
| L_API_DO_NOT_USE | | O_NOT_USE | |
| # define utext_caseCompareNativeLimit_4_6 utext_caseCompareNativeLim | | # define utf8_nextCharSafeBody_48 utf8_nextCharSafeBody_INTERNAL_API | |
| it_INTERNAL_API_DO_NOT_USE | | _DO_NOT_USE | |
| # define utext_caseCompare_4_6 utext_caseCompare_INTERNAL_API_DO_NOT | | # define utf8_prevCharSafeBody_48 utf8_prevCharSafeBody_INTERNAL_API | |
| _USE | | _DO_NOT_USE | |
| # define utext_compareNativeLimit_4_6 utext_compareNativeLimit_INTER | | | |
| NAL_API_DO_NOT_USE | | | |
| # define utext_compare_4_6 utext_compare_INTERNAL_API_DO_NOT_USE | | | |
| # define utf8_appendCharSafeBody_4_6 utf8_appendCharSafeBody_INTERNA | | | |
| L_API_DO_NOT_USE | | | |
| # define utf8_back1SafeBody_4_6 utf8_back1SafeBody_INTERNAL_API_DO_N | | | |
| OT_USE | | | |
| # define utf8_countTrailBytes_4_6 utf8_countTrailBytes_INTERNAL_API_ | | | |
| DO_NOT_USE | | | |
| # define utf8_nextCharSafeBody_4_6 utf8_nextCharSafeBody_INTERNAL_AP | | | |
| I_DO_NOT_USE | | | |
| # define utf8_prevCharSafeBody_4_6 utf8_prevCharSafeBody_INTERNAL_AP | | | |
| I_DO_NOT_USE | | | |
| # endif /* U_DISABLE_RENAMING */ | | # endif /* U_DISABLE_RENAMING */ | |
| | | | |
| #endif /* U_HIDE_INTERNAL_API */ | | #endif /* U_HIDE_INTERNAL_API */ | |
| #endif /* UINTRNAL_H */ | | #endif /* UINTRNAL_H */ | |
| | | | |
End of changes. 6 change blocks. |
| 199 lines changed or deleted | | 177 lines changed or added | |
|
| unistr.h | | unistr.h | |
| /* | | /* | |
| ********************************************************************** | | ********************************************************************** | |
|
| * Copyright (C) 1998-2010, International Business Machines | | * Copyright (C) 1998-2011, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ********************************************************************** | | ********************************************************************** | |
| * | | * | |
| * File unistr.h | | * File unistr.h | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 09/25/98 stephen Creation. | | * 09/25/98 stephen Creation. | |
| * 11/11/98 stephen Changed per 11/9 code review. | | * 11/11/98 stephen Changed per 11/9 code review. | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 58 | |
| #ifndef USTRING_H | | #ifndef USTRING_H | |
| /** | | /** | |
| * \ingroup ustring_ustrlen | | * \ingroup ustring_ustrlen | |
| */ | | */ | |
| U_STABLE int32_t U_EXPORT2 | | U_STABLE int32_t U_EXPORT2 | |
| u_strlen(const UChar *s); | | u_strlen(const UChar *s); | |
| #endif | | #endif | |
| | | | |
| U_NAMESPACE_BEGIN | | U_NAMESPACE_BEGIN | |
| | | | |
|
| | | class BreakIterator; // unicode/brkiter.h | |
| class Locale; // unicode/locid.h | | class Locale; // unicode/locid.h | |
| class StringCharacterIterator; | | class StringCharacterIterator; | |
|
| class BreakIterator; // unicode/brkiter.h | | class UnicodeStringAppendable; // unicode/appendable.h | |
| | | | |
| /* The <iostream> include has been moved to unicode/ustream.h */ | | /* The <iostream> include has been moved to unicode/ustream.h */ | |
| | | | |
| /** | | /** | |
| * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) co
nstructor | | * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) co
nstructor | |
| * which constructs a Unicode string from an invariant-character char * str
ing. | | * which constructs a Unicode string from an invariant-character char * str
ing. | |
| * About invariant characters see utypes.h. | | * About invariant characters see utypes.h. | |
| * This constructor has no runtime dependency on conversion code and is | | * This constructor has no runtime dependency on conversion code and is | |
| * therefore recommended over ones taking a charset name string | | * therefore recommended over ones taking a charset name string | |
| * (where the empty string "" indicates invariant-character conversion). | | * (where the empty string "" indicates invariant-character conversion). | |
| | | | |
| skipping to change at line 1990 | | skipping to change at line 1991 | |
| * Append operator. Append the code point <TT>ch</TT> to the UnicodeStrin
g | | * Append operator. Append the code point <TT>ch</TT> to the UnicodeStrin
g | |
| * object. | | * object. | |
| * @param ch the code point to be appended | | * @param ch the code point to be appended | |
| * @return a reference to this | | * @return a reference to this | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| inline UnicodeString& operator+= (UChar32 ch); | | inline UnicodeString& operator+= (UChar32 ch); | |
| | | | |
| /** | | /** | |
| * Append operator. Append the characters in <TT>srcText</TT> to the | | * Append operator. Append the characters in <TT>srcText</TT> to the | |
|
| * UnicodeString object at offset <TT>start</TT>. <TT>srcText</TT> is | | * UnicodeString object. <TT>srcText</TT> is not modified. | |
| * not modified. | | | |
| * @param srcText the source for the new characters | | * @param srcText the source for the new characters | |
| * @return a reference to this | | * @return a reference to this | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| inline UnicodeString& operator+= (const UnicodeString& srcText); | | inline UnicodeString& operator+= (const UnicodeString& srcText); | |
| | | | |
| /** | | /** | |
| * Append the characters | | * Append the characters | |
| * in <TT>srcText</TT> in the range | | * in <TT>srcText</TT> in the range | |
| * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) to the | | * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) to the | |
| | | | |
| skipping to change at line 2017 | | skipping to change at line 2017 | |
| * @param srcLength the number of characters in <TT>srcText</TT> in | | * @param srcLength the number of characters in <TT>srcText</TT> in | |
| * the append string | | * the append string | |
| * @return a reference to this | | * @return a reference to this | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| inline UnicodeString& append(const UnicodeString& srcText, | | inline UnicodeString& append(const UnicodeString& srcText, | |
| int32_t srcStart, | | int32_t srcStart, | |
| int32_t srcLength); | | int32_t srcLength); | |
| | | | |
| /** | | /** | |
|
| * Append the characters in <TT>srcText</TT> to the UnicodeString object | | * Append the characters in <TT>srcText</TT> to the UnicodeString object. | |
| at | | * <TT>srcText</TT> is not modified. | |
| * offset <TT>start</TT>. <TT>srcText</TT> is not modified. | | | |
| * @param srcText the source for the new characters | | * @param srcText the source for the new characters | |
| * @return a reference to this | | * @return a reference to this | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| inline UnicodeString& append(const UnicodeString& srcText); | | inline UnicodeString& append(const UnicodeString& srcText); | |
| | | | |
| /** | | /** | |
| * Append the characters in <TT>srcChars</TT> in the range | | * Append the characters in <TT>srcChars</TT> in the range | |
| * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) to the UnicodeStrin
g | | * [<TT>srcStart</TT>, <TT>srcStart + srcLength</TT>) to the UnicodeStrin
g | |
| * object at offset | | * object at offset | |
| * <TT>start</TT>. <TT>srcChars</TT> is not modified. | | * <TT>start</TT>. <TT>srcChars</TT> is not modified. | |
| * @param srcChars the source for the new characters | | * @param srcChars the source for the new characters | |
| * @param srcStart the offset into <TT>srcChars</TT> where new characters | | * @param srcStart the offset into <TT>srcChars</TT> where new characters | |
| * will be obtained | | * will be obtained | |
| * @param srcLength the number of characters in <TT>srcChars</TT> in | | * @param srcLength the number of characters in <TT>srcChars</TT> in | |
|
| * the append string | | * the append string; can be -1 if <TT>srcChars</TT> is
NUL-terminated | |
| * @return a reference to this | | * @return a reference to this | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| inline UnicodeString& append(const UChar *srcChars, | | inline UnicodeString& append(const UChar *srcChars, | |
| int32_t srcStart, | | int32_t srcStart, | |
| int32_t srcLength); | | int32_t srcLength); | |
| | | | |
| /** | | /** | |
| * Append the characters in <TT>srcChars</TT> to the UnicodeString object | | * Append the characters in <TT>srcChars</TT> to the UnicodeString object | |
| * at offset <TT>start</TT>. <TT>srcChars</TT> is not modified. | | * at offset <TT>start</TT>. <TT>srcChars</TT> is not modified. | |
| * @param srcChars the source for the new characters | | * @param srcChars the source for the new characters | |
|
| * @param srcLength the number of Unicode characters in <TT>srcChars</TT> | | * @param srcLength the number of Unicode characters in <TT>srcChars</TT> | |
| | | ; | |
| | | * can be -1 if <TT>srcChars</TT> is NUL-terminated | |
| * @return a reference to this | | * @return a reference to this | |
| * @stable ICU 2.0 | | * @stable ICU 2.0 | |
| */ | | */ | |
| inline UnicodeString& append(const UChar *srcChars, | | inline UnicodeString& append(const UChar *srcChars, | |
| int32_t srcLength); | | int32_t srcLength); | |
| | | | |
| /** | | /** | |
| * Append the code unit <TT>srcChar</TT> to the UnicodeString object. | | * Append the code unit <TT>srcChar</TT> to the UnicodeString object. | |
| * @param srcChar the code unit to append | | * @param srcChar the code unit to append | |
| * @return a reference to this | | * @return a reference to this | |
| | | | |
| skipping to change at line 3361 | | skipping to change at line 3362 | |
| uint32_t options, | | uint32_t options, | |
| int32_t toWhichCase); | | int32_t toWhichCase); | |
| | | | |
| // ref counting | | // ref counting | |
| void addRef(void); | | void addRef(void); | |
| int32_t removeRef(void); | | int32_t removeRef(void); | |
| int32_t refCount(void) const; | | int32_t refCount(void) const; | |
| | | | |
| // constants | | // constants | |
| enum { | | enum { | |
|
| // Set the stack buffer size so that sizeof(UnicodeString) is a multipl | | // Set the stack buffer size so that sizeof(UnicodeString) is, | |
| e of sizeof(pointer): | | // naturally (without padding), a multiple of sizeof(pointer). | |
| // 32-bit pointers: 4+1+1+13*2 = 32 bytes | | US_STACKBUF_SIZE= sizeof(void *)==4 ? 13 : 15, // Size of stack buffer | |
| // 64-bit pointers: 8+1+1+15*2 = 40 bytes | | for short strings | |
| US_STACKBUF_SIZE= sizeof(void *)==4 ? 13 : 15, // Size of stack buffer | | | |
| for small strings | | | |
| kInvalidUChar=0xffff, // invalid UChar index | | kInvalidUChar=0xffff, // invalid UChar index | |
| kGrowSize=128, // grow size for this buffer | | kGrowSize=128, // grow size for this buffer | |
| kInvalidHashCode=0, // invalid hash code | | kInvalidHashCode=0, // invalid hash code | |
| kEmptyHashCode=1, // hash code for empty string | | kEmptyHashCode=1, // hash code for empty string | |
| | | | |
| // bit flag values for fFlags | | // bit flag values for fFlags | |
| kIsBogus=1, // this string is bogus, i.e., not valid or NULL | | kIsBogus=1, // this string is bogus, i.e., not valid or NULL | |
|
| kUsingStackBuffer=2,// fArray==fStackBuffer | | kUsingStackBuffer=2,// using fUnion.fStackBuffer instead of fUnion.fFie
lds | |
| kRefCounted=4, // there is a refCount field before the characters
in fArray | | kRefCounted=4, // there is a refCount field before the characters
in fArray | |
| kBufferIsReadonly=8,// do not write to this buffer | | kBufferIsReadonly=8,// do not write to this buffer | |
| kOpenGetBuffer=16, // getBuffer(minCapacity) was called (is "open"), | | kOpenGetBuffer=16, // getBuffer(minCapacity) was called (is "open"), | |
| // and releaseBuffer(newLength) must be called | | // and releaseBuffer(newLength) must be called | |
| | | | |
| // combined values for convenience | | // combined values for convenience | |
| kShortString=kUsingStackBuffer, | | kShortString=kUsingStackBuffer, | |
| kLongString=kRefCounted, | | kLongString=kRefCounted, | |
| kReadonlyAlias=kBufferIsReadonly, | | kReadonlyAlias=kBufferIsReadonly, | |
| kWritableAlias=0 | | kWritableAlias=0 | |
| }; | | }; | |
| | | | |
| friend class StringThreadTest; | | friend class StringThreadTest; | |
|
| | | friend class UnicodeStringAppendable; | |
| | | | |
| union StackBufferOrFields; // forward declaration necessary before
friend declaration | | union StackBufferOrFields; // forward declaration necessary before
friend declaration | |
| friend union StackBufferOrFields; // make US_STACKBUF_SIZE visible inside
fUnion | | friend union StackBufferOrFields; // make US_STACKBUF_SIZE visible inside
fUnion | |
| | | | |
| /* | | /* | |
| * The following are all the class fields that are stored | | * The following are all the class fields that are stored | |
| * in each UnicodeString object. | | * in each UnicodeString object. | |
| * Note that UnicodeString has virtual functions, | | * Note that UnicodeString has virtual functions, | |
| * therefore there is an implicit vtable pointer | | * therefore there is an implicit vtable pointer | |
| * as the first real field. | | * as the first real field. | |
|
| * The fields should be aligned such that no padding is | | * The fields should be aligned such that no padding is necessary. | |
| * necessary, mostly by having larger types first. | | | |
| * On 32-bit machines, the size should be 32 bytes, | | * On 32-bit machines, the size should be 32 bytes, | |
| * on 64-bit machines (8-byte pointers), it should be 40 bytes. | | * on 64-bit machines (8-byte pointers), it should be 40 bytes. | |
|
| | | * | |
| | | * We use a hack to achieve this. | |
| | | * | |
| | | * With at least some compilers, each of the following is forced to | |
| | | * a multiple of sizeof(pointer) [the largest field base unit here is a d | |
| | | ata pointer], | |
| | | * rounded up with additional padding if the fields do not already fit th | |
| | | at requirement: | |
| | | * - sizeof(class UnicodeString) | |
| | | * - offsetof(UnicodeString, fUnion) | |
| | | * - sizeof(fUnion) | |
| | | * - sizeof(fFields) | |
| | | * | |
| | | * In order to avoid padding, we make sizeof(fStackBuffer)=16 (=8 UChars) | |
| | | * which is at least as large as sizeof(fFields) on 32-bit and 64-bit mac | |
| | | hines. | |
| | | * (Padding at the end of fFields is ok: | |
| | | * As long as there is no padding after fStackBuffer, it is not wasted sp | |
| | | ace.) | |
| | | * | |
| | | * We further assume that the compiler does not reorder the fields, | |
| | | * so that fRestOfStackBuffer (which holds a few more UChars) immediately | |
| | | follows after fUnion, | |
| | | * with at most some padding (but no other field) in between. | |
| | | * (Padding there would be wasted space, but functionally harmless.) | |
| | | * | |
| | | * We use a few more sizeof(pointer)'s chunks of space with | |
| | | * fRestOfStackBuffer, fShortLength and fFlags, | |
| | | * to get up exactly to the intended sizeof(UnicodeString). | |
| */ | | */ | |
| // (implicit) *vtable; | | // (implicit) *vtable; | |
|
| int8_t fShortLength; // 0..127: length <0: real length is in fUnion | | | |
| .fFields.fLength | | | |
| uint8_t fFlags; // bit flags: see constants above | | | |
| union StackBufferOrFields { | | union StackBufferOrFields { | |
| // fStackBuffer is used iff (fFlags&kUsingStackBuffer) | | // fStackBuffer is used iff (fFlags&kUsingStackBuffer) | |
| // else fFields is used | | // else fFields is used | |
|
| UChar fStackBuffer [US_STACKBUF_SIZE]; // buffer for small strings | | UChar fStackBuffer[8]; // buffer for short strings, together with fRes
tOfStackBuffer | |
| struct { | | struct { | |
|
| uint16_t fPadding; // align the following field at 8B (32b pointer | | UChar *fArray; // the Unicode data | |
| s) or 12B (64b) | | int32_t fCapacity; // capacity of fArray (in UChars) | |
| int32_t fLength; // number of characters in fArray if >127; else | | int32_t fLength; // number of characters in fArray if >127; else u | |
| undefined | | ndefined | |
| UChar *fArray; // the Unicode data (aligned at 12B (32b pointe | | | |
| rs) or 16B (64b)) | | | |
| int32_t fCapacity; // sizeof fArray | | | |
| } fFields; | | } fFields; | |
| } fUnion; | | } fUnion; | |
|
| | | UChar fRestOfStackBuffer[US_STACKBUF_SIZE-8]; | |
| | | int8_t fShortLength; // 0..127: length <0: real length is in fUnion.fFi | |
| | | elds.fLength | |
| | | uint8_t fFlags; // bit flags: see constants above | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Create a new UnicodeString with the concatenation of two others. | | * Create a new UnicodeString with the concatenation of two others. | |
| * | | * | |
| * @param s1 The first string to be copied to the new one. | | * @param s1 The first string to be copied to the new one. | |
| * @param s2 The second string to be copied to the new one, after s1. | | * @param s2 The second string to be copied to the new one, after s1. | |
| * @return UnicodeString(s1).append(s2) | | * @return UnicodeString(s1).append(s2) | |
| * @stable ICU 2.8 | | * @stable ICU 2.8 | |
| */ | | */ | |
| | | | |
| skipping to change at line 4079 | | skipping to change at line 4103 | |
| #if !UCONFIG_NO_CONVERSION | | #if !UCONFIG_NO_CONVERSION | |
| | | | |
| inline int32_t | | inline int32_t | |
| UnicodeString::extract(int32_t start, | | UnicodeString::extract(int32_t start, | |
| int32_t _length, | | int32_t _length, | |
| char *dst, | | char *dst, | |
| const char *codepage) const | | const char *codepage) const | |
| | | | |
| { | | { | |
| // This dstSize value will be checked explicitly | | // This dstSize value will be checked explicitly | |
|
| #if defined(__GNUC__) | | | |
| // Ticket #7039: Clip length to the maximum valid length to the end of ad | | | |
| dressable memory given the starting address | | | |
| // This is only an issue when using GCC and certain optimizations are tur | | | |
| ned on. | | | |
| return extract(start, _length, dst, dst!=0 ? ((dst >= (char*)((size_t)-1) | | | |
| - UINT32_MAX) ? (((char*)UINT32_MAX) - dst) : UINT32_MAX) : 0, codepage); | | | |
| #else | | | |
| return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage); | | return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage); | |
|
| #endif | | | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
| inline void | | inline void | |
| UnicodeString::extractBetween(int32_t start, | | UnicodeString::extractBetween(int32_t start, | |
| int32_t limit, | | int32_t limit, | |
| UChar *dst, | | UChar *dst, | |
| int32_t dstStart) const { | | int32_t dstStart) const { | |
| pinIndex(start); | | pinIndex(start); | |
| | | | |
| skipping to change at line 4262 | | skipping to change at line 4280 | |
| int32_t srcStart) | | int32_t srcStart) | |
| { | | { | |
| unBogus(); | | unBogus(); | |
| srcText.pinIndex(srcStart); | | srcText.pinIndex(srcStart); | |
| return doReplace(0, length(), srcText, srcStart, srcText.length() - srcSt
art); | | return doReplace(0, length(), srcText, srcStart, srcText.length() - srcSt
art); | |
| } | | } | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| UnicodeString::setTo(const UnicodeString& srcText) | | UnicodeString::setTo(const UnicodeString& srcText) | |
| { | | { | |
|
| unBogus(); | | return copyFrom(srcText); | |
| return doReplace(0, length(), srcText, 0, srcText.length()); | | | |
| } | | } | |
| | | | |
| inline UnicodeString& | | inline UnicodeString& | |
| UnicodeString::setTo(const UChar *srcChars, | | UnicodeString::setTo(const UChar *srcChars, | |
| int32_t srcLength) | | int32_t srcLength) | |
| { | | { | |
| unBogus(); | | unBogus(); | |
| return doReplace(0, length(), srcChars, 0, srcLength); | | return doReplace(0, length(), srcChars, 0, srcLength); | |
| } | | } | |
| | | | |
| | | | |
End of changes. 19 change blocks. |
| 40 lines changed or deleted | | 56 lines changed or added | |
|
| uregex.h | | uregex.h | |
| /* | | /* | |
| ********************************************************************** | | ********************************************************************** | |
|
| * Copyright (C) 2004-2010, International Business Machines | | * Copyright (C) 2004-2011, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ********************************************************************** | | ********************************************************************** | |
| * file name: uregex.h | | * file name: uregex.h | |
| * encoding: US-ASCII | | * encoding: US-ASCII | |
| * indentation:4 | | * indentation:4 | |
| * | | * | |
| * created on: 2004mar09 | | * created on: 2004mar09 | |
| * created by: Andy Heninger | | * created by: Andy Heninger | |
| * | | * | |
| * ICU Regular Expressions, API for C | | * ICU Regular Expressions, API for C | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| #include "unicode/utext.h" | | #include "unicode/utext.h" | |
| #include "unicode/utypes.h" | | #include "unicode/utypes.h" | |
| | | | |
| #if !UCONFIG_NO_REGULAR_EXPRESSIONS | | #if !UCONFIG_NO_REGULAR_EXPRESSIONS | |
| | | | |
| #include "unicode/localpointer.h" | | #include "unicode/localpointer.h" | |
| #include "unicode/parseerr.h" | | #include "unicode/parseerr.h" | |
| | | | |
| struct URegularExpression; | | struct URegularExpression; | |
| /** | | /** | |
|
| * Structure representing a compiled regular rexpression, plus the results | | * Structure representing a compiled regular expression, plus the results | |
| * of a match operation. | | * of a match operation. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| typedef struct URegularExpression URegularExpression; | | typedef struct URegularExpression URegularExpression; | |
| | | | |
| /** | | /** | |
| * Constants for Regular Expression Match Modes. | | * Constants for Regular Expression Match Modes. | |
| * @stable ICU 2.4 | | * @stable ICU 2.4 | |
| */ | | */ | |
| typedef enum URegexpFlag{ | | typedef enum URegexpFlag{ | |
| | | | |
| skipping to change at line 101 | | skipping to change at line 101 | |
| * If set, \b uses the Unicode TR 29 definition of word boundaries
. | | * If set, \b uses the Unicode TR 29 definition of word boundaries
. | |
| * Warning: Unicode word boundaries are quite different from | | * Warning: Unicode word boundaries are quite different from | |
| * traditional regular expression word boundaries. See | | * traditional regular expression word boundaries. See | |
| * http://unicode.org/reports/tr29/#Word_Boundaries | | * http://unicode.org/reports/tr29/#Word_Boundaries | |
| * @stable ICU 2.8 | | * @stable ICU 2.8 | |
| */ | | */ | |
| UREGEX_UWORD = 256, | | UREGEX_UWORD = 256, | |
| | | | |
| /** Error on Unrecognized backslash escapes. | | /** Error on Unrecognized backslash escapes. | |
| * If set, fail with an error on patterns that contain | | * If set, fail with an error on patterns that contain | |
|
| * backslash-escaped ASCII letters without a known specail | | * backslash-escaped ASCII letters without a known special | |
| * meaning. If this flag is not set, these | | * meaning. If this flag is not set, these | |
| * escaped letters represent themselves. | | * escaped letters represent themselves. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512 | | UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512 | |
| | | | |
| } URegexpFlag; | | } URegexpFlag; | |
| | | | |
| /** | | /** | |
| * Open (compile) an ICU regular expression. Compiles the regular expres
sion in | | * Open (compile) an ICU regular expression. Compiles the regular expres
sion in | |
| * string form into an internal representation using the specified match
mode flags. | | * string form into an internal representation using the specified match
mode flags. | |
| * The resulting regular expression handle can then be used to perform va
rious | | * The resulting regular expression handle can then be used to perform va
rious | |
| * matching operations. | | * matching operations. | |
| * | | * | |
| * | | * | |
| * @param pattern The Regular Expression pattern to be compiled. | | * @param pattern The Regular Expression pattern to be compiled. | |
| * @param patternLength The length of the pattern, or -1 if the pattern i
s | | * @param patternLength The length of the pattern, or -1 if the pattern i
s | |
|
| * NUL termintated. | | * NUL terminated. | |
| * @param flags Flags that alter the default matching behavior fo
r | | * @param flags Flags that alter the default matching behavior fo
r | |
| * the regular expression, UREGEX_CASE_INSENSITIVE,
for | | * the regular expression, UREGEX_CASE_INSENSITIVE,
for | |
| * example. For default behavior, set this paramete
r to zero. | | * example. For default behavior, set this paramete
r to zero. | |
| * See <code>enum URegexpFlag</code>. All desired f
lags | | * See <code>enum URegexpFlag</code>. All desired f
lags | |
| * are bitwise-ORed together. | | * are bitwise-ORed together. | |
|
| * @param pe Receives the position (line and column nubers) of
any syntax | | * @param pe Receives the position (line and column numbers) o
f any syntax | |
| * error within the source regular expression string
. If this | | * error within the source regular expression string
. If this | |
| * information is not wanted, pass NULL for this par
ameter. | | * information is not wanted, pass NULL for this par
ameter. | |
| * @param status Receives error detected by this function. | | * @param status Receives error detected by this function. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| * | | * | |
| */ | | */ | |
| U_STABLE URegularExpression * U_EXPORT2 | | U_STABLE URegularExpression * U_EXPORT2 | |
| uregex_open( const UChar *pattern, | | uregex_open( const UChar *pattern, | |
| int32_t patternLength, | | int32_t patternLength, | |
| uint32_t flags, | | uint32_t flags, | |
| | | | |
| skipping to change at line 155 | | skipping to change at line 155 | |
| * The contents of the pattern UText will be extracted and saved. Ownersh
ip of the | | * The contents of the pattern UText will be extracted and saved. Ownersh
ip of the | |
| * UText struct itself remains with the caller. This is to match the beh
avior of | | * UText struct itself remains with the caller. This is to match the beh
avior of | |
| * uregex_open(). | | * uregex_open(). | |
| * | | * | |
| * @param pattern The Regular Expression pattern to be compiled. | | * @param pattern The Regular Expression pattern to be compiled. | |
| * @param flags Flags that alter the default matching behavior fo
r | | * @param flags Flags that alter the default matching behavior fo
r | |
| * the regular expression, UREGEX_CASE_INSENSITIVE,
for | | * the regular expression, UREGEX_CASE_INSENSITIVE,
for | |
| * example. For default behavior, set this paramete
r to zero. | | * example. For default behavior, set this paramete
r to zero. | |
| * See <code>enum URegexpFlag</code>. All desired f
lags | | * See <code>enum URegexpFlag</code>. All desired f
lags | |
| * are bitwise-ORed together. | | * are bitwise-ORed together. | |
|
| * @param pe Receives the position (line and column nubers) of
any syntax | | * @param pe Receives the position (line and column numbers) o
f any syntax | |
| * error within the source regular expression string
. If this | | * error within the source regular expression string
. If this | |
| * information is not wanted, pass NULL for this par
ameter. | | * information is not wanted, pass NULL for this par
ameter. | |
| * @param status Receives error detected by this function. | | * @param status Receives error detected by this function. | |
| * | | * | |
| * @draft ICU 4.6 | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT URegularExpression * U_EXPORT2 | | U_DRAFT URegularExpression * U_EXPORT2 | |
| uregex_openUText(UText *pattern, | | uregex_openUText(UText *pattern, | |
| uint32_t flags, | | uint32_t flags, | |
| UParseError *pe, | | UParseError *pe, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Open (compile) an ICU regular expression. The resulting regular expre
ssion | | * Open (compile) an ICU regular expression. The resulting regular expre
ssion | |
| * handle can then be used to perform various matching operations. | | * handle can then be used to perform various matching operations. | |
| * <p> | | * <p> | |
| * This function is the same as uregex_open, except that the pattern | | * This function is the same as uregex_open, except that the pattern | |
| * is supplied as an 8 bit char * string in the default code page. | | * is supplied as an 8 bit char * string in the default code page. | |
| * | | * | |
| * @param pattern The Regular Expression pattern to be compiled, | | * @param pattern The Regular Expression pattern to be compiled, | |
|
| * NUL termintated. | | * NUL terminated. | |
| * @param flags Flags that alter the default matching behavior fo
r | | * @param flags Flags that alter the default matching behavior fo
r | |
| * the regular expression, UREGEX_CASE_INSENSITIVE,
for | | * the regular expression, UREGEX_CASE_INSENSITIVE,
for | |
| * example. For default behavior, set this paramete
r to zero. | | * example. For default behavior, set this paramete
r to zero. | |
| * See <code>enum URegexpFlag</code>. All desired f
lags | | * See <code>enum URegexpFlag</code>. All desired f
lags | |
| * are bitwise-ORed together. | | * are bitwise-ORed together. | |
|
| * @param pe Receives the position (line and column nubers) of
any syntax | | * @param pe Receives the position (line and column numbers) o
f any syntax | |
| * error within the source regular expression string
. If this | | * error within the source regular expression string
. If this | |
| * information is not wanted, pass NULL for this par
ameter. | | * information is not wanted, pass NULL for this par
ameter. | |
| * @param status Receives errors detected by this function. | | * @param status Receives errors detected by this function. | |
| * @return The URegularExpression object representing the co
mpiled | | * @return The URegularExpression object representing the co
mpiled | |
| * pattern. | | * pattern. | |
| * | | * | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| #if !UCONFIG_NO_CONVERSION | | #if !UCONFIG_NO_CONVERSION | |
| U_STABLE URegularExpression * U_EXPORT2 | | U_STABLE URegularExpression * U_EXPORT2 | |
| | | | |
| skipping to change at line 234 | | skipping to change at line 234 | |
| U_NAMESPACE_END | | U_NAMESPACE_END | |
| | | | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * Make a copy of a compiled regular expression. Cloning a regular | | * Make a copy of a compiled regular expression. Cloning a regular | |
| * expression is faster than opening a second instance from the source | | * expression is faster than opening a second instance from the source | |
| * form of the expression, and requires less memory. | | * form of the expression, and requires less memory. | |
| * <p> | | * <p> | |
| * Note that the current input string and the position of any matched text | | * Note that the current input string and the position of any matched text | |
|
| * within it are not cloned; only the pattern itself and and the | | * within it are not cloned; only the pattern itself and the | |
| * match mode flags are copied. | | * match mode flags are copied. | |
| * <p> | | * <p> | |
| * Cloning can be particularly useful to threaded applications that perform | | * Cloning can be particularly useful to threaded applications that perform | |
| * multiple match operations in parallel. Each concurrent RE | | * multiple match operations in parallel. Each concurrent RE | |
| * operation requires its own instance of a URegularExpression. | | * operation requires its own instance of a URegularExpression. | |
| * | | * | |
| * @param regexp The compiled regular expression to be cloned. | | * @param regexp The compiled regular expression to be cloned. | |
| * @param status Receives indication of any errors encountered | | * @param status Receives indication of any errors encountered | |
| * @return the cloned copy of the compiled regular expression. | | * @return the cloned copy of the compiled regular expression. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| | | | |
| skipping to change at line 392 | | skipping to change at line 392 | |
| * If a pre-allocated UText was provided, it will alway
s be used and returned. | | * If a pre-allocated UText was provided, it will alway
s be used and returned. | |
| * | | * | |
| * @draft ICU 4.6 | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT UText * U_EXPORT2 | | U_DRAFT UText * U_EXPORT2 | |
| uregex_getUText(URegularExpression *regexp, | | uregex_getUText(URegularExpression *regexp, | |
| UText *dest, | | UText *dest, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
|
| | | * Set the subject text string upon which the regular expression is looki | |
| | | ng for matches | |
| | | * without changing any other aspect of the matching state. | |
| | | * The new and previous text strings must have the same content. | |
| | | * | |
| | | * This function is intended for use in environments where ICU is operati | |
| | | ng on | |
| | | * strings that may move around in memory. It provides a mechanism for n | |
| | | otifying | |
| | | * ICU that the string has been relocated, and providing a new UText to a | |
| | | ccess the | |
| | | * string in its new position. | |
| | | * | |
| | | * Note that the regular expression implementation never copies the under | |
| | | lying text | |
| | | * of a string being matched, but always operates directly on the origina | |
| | | l text | |
| | | * provided by the user. Refreshing simply drops the references to the ol | |
| | | d text | |
| | | * and replaces them with references to the new. | |
| | | * | |
| | | * Caution: this function is normally used only by very specialized | |
| | | * system-level code. One example use case is with garbage co | |
| | | llection | |
| | | * that moves the text in memory. | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param text The new (moved) text string. | |
| | | * @param status Receives errors detected by this function. | |
| | | * | |
| | | * @draft ICU 4.8 | |
| | | */ | |
| | | U_DRAFT void U_EXPORT2 | |
| | | uregex_refreshUText(URegularExpression *regexp, | |
| | | UText *text, | |
| | | UErrorCode *status); | |
| | | | |
| | | /** | |
| * Attempts to match the input string against the pattern. | | * Attempts to match the input string against the pattern. | |
| * To succeed, the match must extend to the end of the string, | | * To succeed, the match must extend to the end of the string, | |
| * or cover the complete match region. | | * or cover the complete match region. | |
| * | | * | |
| * If startIndex >= zero the match operation starts at the specified | | * If startIndex >= zero the match operation starts at the specified | |
| * index and must extend to the end of the input string. Any region | | * index and must extend to the end of the input string. Any region | |
| * that has been specified is reset. | | * that has been specified is reset. | |
| * | | * | |
| * If startIndex == -1 the match must cover the input region, or the ent
ire | | * If startIndex == -1 the match must cover the input region, or the ent
ire | |
| * input string if no region has been set. This directly corresponds to | | * input string if no region has been set. This directly corresponds to | |
| | | | |
| skipping to change at line 418 | | skipping to change at line 448 | |
| * @return TRUE if there is a match | | * @return TRUE if there is a match | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| U_STABLE UBool U_EXPORT2 | | U_STABLE UBool U_EXPORT2 | |
| uregex_matches(URegularExpression *regexp, | | uregex_matches(URegularExpression *regexp, | |
| int32_t startIndex, | | int32_t startIndex, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * 64bit version of uregex_matches. | | * 64bit version of uregex_matches. | |
|
| | | * Attempts to match the input string against the pattern. | |
| | | * To succeed, the match must extend to the end of the string, | |
| | | * or cover the complete match region. | |
| | | * | |
| | | * If startIndex >= zero the match operation starts at the specified | |
| | | * index and must extend to the end of the input string. Any region | |
| | | * that has been specified is reset. | |
| | | * | |
| | | * If startIndex == -1 the match must cover the input region, or the ent | |
| | | ire | |
| | | * input string if no region has been set. This directly corresponds to | |
| | | * Matcher.matches() in Java | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param startIndex The input string (native) index at which to begi | |
| | | n matching, or -1 | |
| | | * to match the input Region. | |
| | | * @param status Receives errors detected by this function. | |
| | | * @return TRUE if there is a match | |
| * @draft ICU 4.6 | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT UBool U_EXPORT2 | | U_DRAFT UBool U_EXPORT2 | |
| uregex_matches64(URegularExpression *regexp, | | uregex_matches64(URegularExpression *regexp, | |
| int64_t startIndex, | | int64_t startIndex, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Attempts to match the input string, starting from the specified index
, against the pattern. | | * Attempts to match the input string, starting from the specified index
, against the pattern. | |
| * The match may be of any length, and is not required to extend to the
end | | * The match may be of any length, and is not required to extend to the
end | |
| | | | |
| skipping to change at line 455 | | skipping to change at line 502 | |
| * @return TRUE if there is a match. | | * @return TRUE if there is a match. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| U_STABLE UBool U_EXPORT2 | | U_STABLE UBool U_EXPORT2 | |
| uregex_lookingAt(URegularExpression *regexp, | | uregex_lookingAt(URegularExpression *regexp, | |
| int32_t startIndex, | | int32_t startIndex, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * 64bit version of uregex_lookingAt. | | * 64bit version of uregex_lookingAt. | |
|
| * @draft ICU 4.6 | | * Attempts to match the input string, starting from the specified index | |
| | | , against the pattern. | |
| | | * The match may be of any length, and is not required to extend to the | |
| | | end | |
| | | * of the input string. Contrast with uregex_matches(). | |
| | | * | |
| | | * <p>If startIndex is >= 0 any input region that was set for this | |
| | | * URegularExpression is reset before the operation begins. | |
| | | * | |
| | | * <p>If the specified starting index == -1 the match begins at the star | |
| | | t of the input | |
| | | * region, or at the start of the full string if no region has been spec | |
| | | ified. | |
| | | * This corresponds directly with Matcher.lookingAt() in Java. | |
| | | * | |
| | | * <p>If the match succeeds then more information can be obtained via th | |
| | | e | |
| | | * <code>uregexp_start()</code>, <code>uregexp_end()</code>, | |
| | | * and <code>uregexp_group()</code> functions.</p> | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param startIndex The input string (native) index at which to beg | |
| | | in matching, or | |
| | | * -1 to match the Input Region | |
| | | * @param status A reference to a UErrorCode to receive any erro | |
| | | rs. | |
| | | * @return TRUE if there is a match. | |
| | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT UBool U_EXPORT2 | | U_DRAFT UBool U_EXPORT2 | |
| uregex_lookingAt64(URegularExpression *regexp, | | uregex_lookingAt64(URegularExpression *regexp, | |
| int64_t startIndex, | | int64_t startIndex, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Find the first matching substring of the input string that matches th
e pattern. | | * Find the first matching substring of the input string that matches th
e pattern. | |
| * If startIndex is >= zero the search for a match begins at the specifi
ed index, | | * If startIndex is >= zero the search for a match begins at the specifi
ed index, | |
| * and any match region is reset. This corresponds directly with | | * and any match region is reset. This corresponds directly with | |
| | | | |
| skipping to change at line 488 | | skipping to change at line 555 | |
| * @return TRUE if a match is found. | | * @return TRUE if a match is found. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| U_STABLE UBool U_EXPORT2 | | U_STABLE UBool U_EXPORT2 | |
| uregex_find(URegularExpression *regexp, | | uregex_find(URegularExpression *regexp, | |
| int32_t startIndex, | | int32_t startIndex, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * 64bit version of uregex_find. | | * 64bit version of uregex_find. | |
|
| | | * Find the first matching substring of the input string that matches th | |
| | | e pattern. | |
| | | * If startIndex is >= zero the search for a match begins at the specifi | |
| | | ed index, | |
| | | * and any match region is reset. This corresponds directly with | |
| | | * Matcher.find(startIndex) in Java. | |
| | | * | |
| | | * If startIndex == -1 the search begins at the start of the input regio | |
| | | n, | |
| | | * or at the start of the full string if no region has been spec | |
| | | ified. | |
| | | * | |
| | | * If a match is found, <code>uregex_start(), uregex_end()</code>, and | |
| | | * <code>uregex_group()</code> will provide more information regarding t | |
| | | he match. | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param startIndex The position (native) in the input string to beg | |
| | | in the search, or | |
| | | * -1 to search within the Input Region. | |
| | | * @param status A reference to a UErrorCode to receive any error | |
| | | s. | |
| | | * @return TRUE if a match is found. | |
| * @draft ICU 4.6 | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT UBool U_EXPORT2 | | U_DRAFT UBool U_EXPORT2 | |
| uregex_find64(URegularExpression *regexp, | | uregex_find64(URegularExpression *regexp, | |
| int64_t startIndex, | | int64_t startIndex, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Find the next pattern match in the input string. Begin searching | | * Find the next pattern match in the input string. Begin searching | |
| * the input at the location following the end of he previous match, | | * the input at the location following the end of he previous match, | |
| | | | |
| skipping to change at line 619 | | skipping to change at line 702 | |
| * by the specified group. | | * by the specified group. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| U_STABLE int32_t U_EXPORT2 | | U_STABLE int32_t U_EXPORT2 | |
| uregex_start(URegularExpression *regexp, | | uregex_start(URegularExpression *regexp, | |
| int32_t groupNum, | | int32_t groupNum, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * 64bit version of uregex_start. | | * 64bit version of uregex_start. | |
|
| | | * Returns the index in the input string of the start of the text matche | |
| | | d by the | |
| | | * specified capture group during the previous match operation. Return | |
| | | -1 if | |
| | | * the capture group was not part of the last match. | |
| | | * Group #0 refers to the complete range of matched text. | |
| | | * Group #1 refers to the text matched by the first set of capturing par | |
| | | entheses. | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param groupNum The capture group number | |
| | | * @param status A reference to a UErrorCode to receive any erro | |
| | | rs. | |
| | | * @return the starting (native) position in the input of | |
| | | the text matched | |
| | | * by the specified group. | |
| * @draft ICU 4.6 | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT int64_t U_EXPORT2 | | U_DRAFT int64_t U_EXPORT2 | |
| uregex_start64(URegularExpression *regexp, | | uregex_start64(URegularExpression *regexp, | |
| int32_t groupNum, | | int32_t groupNum, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Returns the index in the input string of the position following the e
nd | | * Returns the index in the input string of the position following the e
nd | |
| * of the text matched by the specified capture group. | | * of the text matched by the specified capture group. | |
| | | | |
| skipping to change at line 646 | | skipping to change at line 740 | |
| * @return the (native) index of the position following th
e last matched character. | | * @return the (native) index of the position following th
e last matched character. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| U_STABLE int32_t U_EXPORT2 | | U_STABLE int32_t U_EXPORT2 | |
| uregex_end(URegularExpression *regexp, | | uregex_end(URegularExpression *regexp, | |
| int32_t groupNum, | | int32_t groupNum, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * 64bit version of uregex_end. | | * 64bit version of uregex_end. | |
|
| | | * Returns the index in the input string of the position following the e | |
| | | nd | |
| | | * of the text matched by the specified capture group. | |
| | | * Return -1 if the capture group was not part of the last match. | |
| | | * Group #0 refers to the complete range of matched text. | |
| | | * Group #1 refers to the text matched by the first set of capturing par | |
| | | entheses. | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param groupNum The capture group number | |
| | | * @param status A reference to a UErrorCode to receive any erro | |
| | | rs. | |
| | | * @return the (native) index of the position following th | |
| | | e last matched character. | |
| * @draft ICU 4.6 | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT int64_t U_EXPORT2 | | U_DRAFT int64_t U_EXPORT2 | |
| uregex_end64(URegularExpression *regexp, | | uregex_end64(URegularExpression *regexp, | |
| int32_t groupNum, | | int32_t groupNum, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Reset any saved state from the previous match. Has the effect of | | * Reset any saved state from the previous match. Has the effect of | |
| * causing uregex_findNext to begin at the specified index, and causing | | * causing uregex_findNext to begin at the specified index, and causing | |
| | | | |
| skipping to change at line 672 | | skipping to change at line 776 | |
| * uregex_findNext() should begin searching. | | * uregex_findNext() should begin searching. | |
| * @param status A reference to a UErrorCode to receive any erro
rs. | | * @param status A reference to a UErrorCode to receive any erro
rs. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| U_STABLE void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| uregex_reset(URegularExpression *regexp, | | uregex_reset(URegularExpression *regexp, | |
| int32_t index, | | int32_t index, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
|
| * 64bit version of uregex_reset. | | * 64bit version of uregex_reset. | |
| * @draft ICU 4.6 | | * Reset any saved state from the previous match. Has the effect of | |
| | | * causing uregex_findNext to begin at the specified index, and causing | |
| | | * uregex_start(), uregex_end() and uregex_group() to return an error | |
| | | * indicating that there is no match information available. Clears any | |
| | | * match region that may have been set. | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param index The position (native) in the text at which a | |
| | | * uregex_findNext() should begin searching. | |
| | | * @param status A reference to a UErrorCode to receive any erro | |
| | | rs. | |
| | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT void U_EXPORT2 | | U_DRAFT void U_EXPORT2 | |
| uregex_reset64(URegularExpression *regexp, | | uregex_reset64(URegularExpression *regexp, | |
| int64_t index, | | int64_t index, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
|
| /** Sets the limits of the matching region for this URegularExpression. | | /** | |
| | | * Sets the limits of the matching region for this URegularExpression. | |
| * The region is the part of the input string that will be considered when
matching. | | * The region is the part of the input string that will be considered when
matching. | |
| * Invoking this method resets any saved state from the previous match, | | * Invoking this method resets any saved state from the previous match, | |
| * then sets the region to start at the index specified by the start param
eter | | * then sets the region to start at the index specified by the start param
eter | |
| * and end at the index specified by the end parameter. | | * and end at the index specified by the end parameter. | |
| * | | * | |
| * Depending on the transparency and anchoring being used (see useTranspar
entBounds | | * Depending on the transparency and anchoring being used (see useTranspar
entBounds | |
| * and useAnchoringBounds), certain constructs such as anchors may behave
differently | | * and useAnchoringBounds), certain constructs such as anchors may behave
differently | |
| * at or around the boundaries of the region | | * at or around the boundaries of the region | |
| * | | * | |
| * The function will fail if start is greater than limit, or if either ind
ex | | * The function will fail if start is greater than limit, or if either ind
ex | |
| | | | |
| skipping to change at line 706 | | skipping to change at line 821 | |
| * @param status A pointer to a UErrorCode to receive any errors. | | * @param status A pointer to a UErrorCode to receive any errors. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| U_STABLE void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| uregex_setRegion(URegularExpression *regexp, | | uregex_setRegion(URegularExpression *regexp, | |
| int32_t regionStart, | | int32_t regionStart, | |
| int32_t regionLimit, | | int32_t regionLimit, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
|
| * 64bit version of uregex_setRegion. | | * 64bit version of uregex_setRegion. | |
| * @draft ICU 4.6 | | * Sets the limits of the matching region for this URegularExpression. | |
| | | * The region is the part of the input string that will be considered when | |
| | | matching. | |
| | | * Invoking this method resets any saved state from the previous match, | |
| | | * then sets the region to start at the index specified by the start param | |
| | | eter | |
| | | * and end at the index specified by the end parameter. | |
| | | * | |
| | | * Depending on the transparency and anchoring being used (see useTranspar | |
| | | entBounds | |
| | | * and useAnchoringBounds), certain constructs such as anchors may behave | |
| | | differently | |
| | | * at or around the boundaries of the region | |
| | | * | |
| | | * The function will fail if start is greater than limit, or if either ind | |
| | | ex | |
| | | * is less than zero or greater than the length of the string being match | |
| | | ed. | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param regionStart The (native) index to begin searches at. | |
| | | * @param regionLimit The (native) index to end searches at (exclusive). | |
| | | * @param status A pointer to a UErrorCode to receive any errors. | |
| | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT void U_EXPORT2 | | U_DRAFT void U_EXPORT2 | |
| uregex_setRegion64(URegularExpression *regexp, | | uregex_setRegion64(URegularExpression *regexp, | |
| int64_t regionStart, | | int64_t regionStart, | |
| int64_t regionLimit, | | int64_t regionLimit, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
|
| * Variation on uregex_setRegion to set the region without resetting the | | * Set the matching region and the starting index for subsequent matches | |
| start index | | * in a single operation. | |
| * without resetting the position for subsequent matches. | | * This is useful because the usual function for setting the starting | |
| * @draft ICU 4.6 | | * index, urgex_reset(), also resets any region limits. | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param regionStart The (native) index to begin searches at. | |
| | | * @param regionLimit The (native) index to end searches at (exclusive). | |
| | | * @param startIndex The index in the input text at which the next | |
| | | * match operation should begin. | |
| | | * @param status A pointer to a UErrorCode to receive any errors. | |
| | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT void U_EXPORT2 | | U_DRAFT void U_EXPORT2 | |
| uregex_setRegionAndStart(URegularExpression *regexp, | | uregex_setRegionAndStart(URegularExpression *regexp, | |
| int64_t regionStart, | | int64_t regionStart, | |
| int64_t regionLimit, | | int64_t regionLimit, | |
| int64_t startIndex, | | int64_t startIndex, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Reports the start index of the matching region. Any matches found are l
imited to | | * Reports the start index of the matching region. Any matches found are l
imited to | |
| | | | |
| skipping to change at line 741 | | skipping to change at line 882 | |
| * @param regexp The compiled regular expression. | | * @param regexp The compiled regular expression. | |
| * @param status A pointer to a UErrorCode to receive any errors. | | * @param status A pointer to a UErrorCode to receive any errors. | |
| * @return The starting (native) index of this matcher's region. | | * @return The starting (native) index of this matcher's region. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| U_STABLE int32_t U_EXPORT2 | | U_STABLE int32_t U_EXPORT2 | |
| uregex_regionStart(const URegularExpression *regexp, | | uregex_regionStart(const URegularExpression *regexp, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
|
| * 64bit version of uregex_regionStart. | | * 64bit version of uregex_regionStart. | |
| * @draft ICU 4.6 | | * Reports the start index of the matching region. Any matches found are l | |
| | | imited to | |
| | | * to the region bounded by regionStart (inclusive) and regionEnd (exclusi | |
| | | ve). | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param status A pointer to a UErrorCode to receive any errors. | |
| | | * @return The starting (native) index of this matcher's region. | |
| | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT int64_t U_EXPORT2 | | U_DRAFT int64_t U_EXPORT2 | |
| uregex_regionStart64(const URegularExpression *regexp, | | uregex_regionStart64(const URegularExpression *regexp, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Reports the end index (exclusive) of the matching region for this URegu
larExpression. | | * Reports the end index (exclusive) of the matching region for this URegu
larExpression. | |
| * Any matches found are limited to to the region bounded by regionStart (
inclusive) | | * Any matches found are limited to to the region bounded by regionStart (
inclusive) | |
| * and regionEnd (exclusive). | | * and regionEnd (exclusive). | |
| * | | * | |
| * @param regexp The compiled regular expression. | | * @param regexp The compiled regular expression. | |
| * @param status A pointer to a UErrorCode to receive any errors. | | * @param status A pointer to a UErrorCode to receive any errors. | |
| * @return The ending point (native) of this matcher's region. | | * @return The ending point (native) of this matcher's region. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| U_STABLE int32_t U_EXPORT2 | | U_STABLE int32_t U_EXPORT2 | |
| uregex_regionEnd(const URegularExpression *regexp, | | uregex_regionEnd(const URegularExpression *regexp, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
|
| * 64bit version of uregex_regionEnd. | | * 64bit version of uregex_regionEnd. | |
| * @draft ICU 4.6 | | * Reports the end index (exclusive) of the matching region for this URegu | |
| | | larExpression. | |
| | | * Any matches found are limited to to the region bounded by regionStart ( | |
| | | inclusive) | |
| | | * and regionEnd (exclusive). | |
| | | * | |
| | | * @param regexp The compiled regular expression. | |
| | | * @param status A pointer to a UErrorCode to receive any errors. | |
| | | * @return The ending point (native) of this matcher's region. | |
| | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT int64_t U_EXPORT2 | | U_DRAFT int64_t U_EXPORT2 | |
| uregex_regionEnd64(const URegularExpression *regexp, | | uregex_regionEnd64(const URegularExpression *regexp, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Queries the transparency of region bounds for this URegularExpression. | | * Queries the transparency of region bounds for this URegularExpression. | |
| * See useTransparentBounds for a description of transparent and opaque bo
unds. | | * See useTransparentBounds for a description of transparent and opaque bo
unds. | |
| * By default, matching boundaries are opaque. | | * By default, matching boundaries are opaque. | |
| * | | * | |
| | | | |
| skipping to change at line 884 | | skipping to change at line 1038 | |
| * Input that is not part of any match is copied unchanged to the | | * Input that is not part of any match is copied unchanged to the | |
| * destination buffer. Matched regions are replaced in the output | | * destination buffer. Matched regions are replaced in the output | |
| * buffer by the replacement string. The replacement string may conta
in | | * buffer by the replacement string. The replacement string may conta
in | |
| * references to capture groups; these take the form of $1, $2, etc. | | * references to capture groups; these take the form of $1, $2, etc. | |
| * | | * | |
| * @param regexp The compiled regular expression. | | * @param regexp The compiled regular expression. | |
| * @param replacementText A string containing the replacement text
. | | * @param replacementText A string containing the replacement text
. | |
| * @param replacementLength The length of the replacement string, or | | * @param replacementLength The length of the replacement string, or | |
| * -1 if it is NUL terminated. | | * -1 if it is NUL terminated. | |
| * @param destBuf A (UChar *) buffer that will receive the
result. | | * @param destBuf A (UChar *) buffer that will receive the
result. | |
|
| * @param destCapacity The capacity of the desitnation buffer. | | * @param destCapacity The capacity of the destination buffer. | |
| * @param status A reference to a UErrorCode to receive a
ny errors. | | * @param status A reference to a UErrorCode to receive a
ny errors. | |
| * @return The length of the string resulting from
the find | | * @return The length of the string resulting from
the find | |
| * and replace operation. In the event tha
t the | | * and replace operation. In the event tha
t the | |
| * destination capacity is inadequate, the
return value | | * destination capacity is inadequate, the
return value | |
| * is still the full length of the untrunca
ted string. | | * is still the full length of the untrunca
ted string. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| U_STABLE int32_t U_EXPORT2 | | U_STABLE int32_t U_EXPORT2 | |
| uregex_replaceAll(URegularExpression *regexp, | | uregex_replaceAll(URegularExpression *regexp, | |
| const UChar *replacementText, | | const UChar *replacementText, | |
| | | | |
| skipping to change at line 943 | | skipping to change at line 1097 | |
| * All input that is not part of the match is copied unchanged to the | | * All input that is not part of the match is copied unchanged to the | |
| * destination buffer. The matched region is replaced in the output | | * destination buffer. The matched region is replaced in the output | |
| * buffer by the replacement string. The replacement string may conta
in | | * buffer by the replacement string. The replacement string may conta
in | |
| * references to capture groups; these take the form of $1, $2, etc. | | * references to capture groups; these take the form of $1, $2, etc. | |
| * | | * | |
| * @param regexp The compiled regular expression. | | * @param regexp The compiled regular expression. | |
| * @param replacementText A string containing the replacement text
. | | * @param replacementText A string containing the replacement text
. | |
| * @param replacementLength The length of the replacement string, or | | * @param replacementLength The length of the replacement string, or | |
| * -1 if it is NUL terminated. | | * -1 if it is NUL terminated. | |
| * @param destBuf A (UChar *) buffer that will receive the
result. | | * @param destBuf A (UChar *) buffer that will receive the
result. | |
|
| * @param destCapacity The capacity of the desitnation buffer. | | * @param destCapacity The capacity of the destination buffer. | |
| * @param status a reference to a UErrorCode to receive a
ny errors. | | * @param status a reference to a UErrorCode to receive a
ny errors. | |
| * @return The length of the string resulting from
the find | | * @return The length of the string resulting from
the find | |
| * and replace operation. In the event tha
t the | | * and replace operation. In the event tha
t the | |
| * destination capacity is inadequate, the
return value | | * destination capacity is inadequate, the
return value | |
| * is still the full length of the untrunca
ted string. | | * is still the full length of the untrunca
ted string. | |
| * @stable ICU 3.0 | | * @stable ICU 3.0 | |
| */ | | */ | |
| U_STABLE int32_t U_EXPORT2 | | U_STABLE int32_t U_EXPORT2 | |
| uregex_replaceFirst(URegularExpression *regexp, | | uregex_replaceFirst(URegularExpression *regexp, | |
| const UChar *replacementText, | | const UChar *replacementText, | |
| | | | |
| skipping to change at line 1109 | | skipping to change at line 1263 | |
| * As the final step in a find-and-replace operation, append the remainder | | * As the final step in a find-and-replace operation, append the remainder | |
| * of the input string, starting at the position following the last match, | | * of the input string, starting at the position following the last match, | |
| * to the destination string. <code>uregex_appendTailUText()</code> is int
ended | | * to the destination string. <code>uregex_appendTailUText()</code> is int
ended | |
| * to be invoked after one or more invocations of the | | * to be invoked after one or more invocations of the | |
| * <code>uregex_appendReplacementUText()</code> function. | | * <code>uregex_appendReplacementUText()</code> function. | |
| * | | * | |
| * @param regexp The regular expression object. This is needed t
o | | * @param regexp The regular expression object. This is needed t
o | |
| * obtain the input string and with the position | | * obtain the input string and with the position | |
| * of the last match within it. | | * of the last match within it. | |
| * @param dest A mutable UText that will receive the result. Mu
st not be NULL. | | * @param dest A mutable UText that will receive the result. Mu
st not be NULL. | |
|
| | | * | |
| | | * @param status Error code | |
| | | * | |
| * @return The destination UText. | | * @return The destination UText. | |
| * | | * | |
| * @draft ICU 4.6 | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT UText * U_EXPORT2 | | U_DRAFT UText * U_EXPORT2 | |
| uregex_appendTailUText(URegularExpression *regexp, | | uregex_appendTailUText(URegularExpression *regexp, | |
| UText *dest, | | UText *dest, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Split a string into fields. Somewhat like split() from Perl. | | * Split a string into fields. Somewhat like split() from Perl. | |
| * The pattern matches identify delimiters that separate the input | | * The pattern matches identify delimiters that separate the input | |
| * into fields. The input data between the matches becomes the | | * into fields. The input data between the matches becomes the | |
| * fields themselves. | | * fields themselves. | |
|
| * <p> | | * | |
| * Each of the fields is copied from the input string to the destination | | * Each of the fields is copied from the input string to the destination | |
| * buffer, and NUL terminated. The position of each field within | | * buffer, and NUL terminated. The position of each field within | |
| * the destination buffer is returned in the destFields array. | | * the destination buffer is returned in the destFields array. | |
| * | | * | |
|
| * Note: another choice for the design of this function would be to not | | * If the delimiter pattern includes capture groups, the captured text w | |
| * copy the resulting fields at all, but to return indexes and | | ill | |
| * lengths within the source text. | | * also appear in the destination array of output strings, interspersed | |
| * Advantages would be | | * with the fields. This is similar to Perl, but differs from Java, | |
| * o Faster. No Copying. | | * which ignores the presence of capture groups in the pattern. | |
| * o Nothing extra needed when field data may contain embedd | | * | |
| ed NUL chars. | | * Trailing empty fields will always be returned, assuming sufficient | |
| * o Less memory needed if working on large data. | | * destination capacity. This differs from the default behavior for Jav | |
| * Disadvantages | | a | |
| * o Less consistent with C++ split, which copies into an | | * and Perl where trailing empty fields are not returned. | |
| * array of UnicodeStrings. | | * | |
| * o No NUL termination, extracted fields would be less conv | | * The number of strings produced by the split operation is returned. | |
| enient | | * This count includes the strings from capture groups in the delimiter | |
| * to use in most cases. | | pattern. | |
| * o Possible problems in the future, when support Unicode N | | * This behavior differs from Java, which ignores capture groups. | |
| ormalization | | | |
| * could cause the fields to not correspond exactly to | | | |
| * a range of the source text. | | | |
| * | | * | |
| * @param regexp The compiled regular expression. | | * @param regexp The compiled regular expression. | |
| * @param destBuf A (UChar *) buffer to receive the fields that | | * @param destBuf A (UChar *) buffer to receive the fields that | |
| * are extracted from the input string. These | | * are extracted from the input string. These | |
| * field pointers will refer to positions within
the | | * field pointers will refer to positions within
the | |
| * destination buffer supplied by the caller. An
y | | * destination buffer supplied by the caller. An
y | |
| * extra positions within the destFields array wi
ll be | | * extra positions within the destFields array wi
ll be | |
| * set to NULL. | | * set to NULL. | |
| * @param destCapacity The capacity of the destBuf. | | * @param destCapacity The capacity of the destBuf. | |
| * @param requiredCapacity The actual capacity required of the dest
Buf. | | * @param requiredCapacity The actual capacity required of the dest
Buf. | |
| | | | |
| skipping to change at line 1254 | | skipping to change at line 1408 | |
| * @param regexp The compiled regular expression. | | * @param regexp The compiled regular expression. | |
| * @param status A reference to a UErrorCode to receive any errors. | | * @param status A reference to a UErrorCode to receive any errors. | |
| * @return the maximum allowed time for a match, in units of processing ste
ps. | | * @return the maximum allowed time for a match, in units of processing ste
ps. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| U_STABLE int32_t U_EXPORT2 | | U_STABLE int32_t U_EXPORT2 | |
| uregex_getTimeLimit(const URegularExpression *regexp, | | uregex_getTimeLimit(const URegularExpression *regexp, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
|
| * Set the amount of heap storage avaliable for use by the match backtracki
ng stack. | | * Set the amount of heap storage available for use by the match backtracki
ng stack. | |
| * <p> | | * <p> | |
| * ICU uses a backtracking regular expression engine, with the backtrack st
ack | | * ICU uses a backtracking regular expression engine, with the backtrack st
ack | |
| * maintained on the heap. This function sets the limit to the amount of m
emory | | * maintained on the heap. This function sets the limit to the amount of m
emory | |
| * that can be used for this purpose. A backtracking stack overflow will | | * that can be used for this purpose. A backtracking stack overflow will | |
| * result in an error from the match operation that caused it. | | * result in an error from the match operation that caused it. | |
| * <p> | | * <p> | |
| * A limit is desirable because a malicious or poorly designed pattern can
use | | * A limit is desirable because a malicious or poorly designed pattern can
use | |
| * excessive memory, potentially crashing the process. A limit is enabled | | * excessive memory, potentially crashing the process. A limit is enabled | |
| * by default. | | * by default. | |
| * <p> | | * <p> | |
| | | | |
| skipping to change at line 1337 | | skipping to change at line 1491 | |
| U_STABLE void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| uregex_setMatchCallback(URegularExpression *regexp, | | uregex_setMatchCallback(URegularExpression *regexp, | |
| URegexMatchCallback *callback, | | URegexMatchCallback *callback, | |
| const void *context, | | const void *context, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Get the callback function for this URegularExpression. | | * Get the callback function for this URegularExpression. | |
| * | | * | |
| * @param regexp The compiled regular expression. | | * @param regexp The compiled regular expression. | |
|
| * @param callback Out paramater, receives a pointer to the user-suppl
ied | | * @param callback Out parameter, receives a pointer to the user-suppl
ied | |
| * callback function. | | * callback function. | |
| * @param context Out parameter, receives the user context pointer th
at | | * @param context Out parameter, receives the user context pointer th
at | |
| * was set when uregex_setMatchCallback() was called. | | * was set when uregex_setMatchCallback() was called. | |
| * @param status A reference to a UErrorCode to receive any errors. | | * @param status A reference to a UErrorCode to receive any errors. | |
| * @stable ICU 4.0 | | * @stable ICU 4.0 | |
| */ | | */ | |
| U_STABLE void U_EXPORT2 | | U_STABLE void U_EXPORT2 | |
| uregex_getMatchCallback(const URegularExpression *regexp, | | uregex_getMatchCallback(const URegularExpression *regexp, | |
| URegexMatchCallback **callback, | | URegexMatchCallback **callback, | |
| const void **context, | | const void **context, | |
| | | | |
| skipping to change at line 1407 | | skipping to change at line 1561 | |
| U_DRAFT void U_EXPORT2 | | U_DRAFT void U_EXPORT2 | |
| uregex_setFindProgressCallback(URegularExpression *regexp, | | uregex_setFindProgressCallback(URegularExpression *regexp, | |
| URegexFindProgressCallback *callback, | | URegexFindProgressCallback *callback, | |
| const void *context, | | const void *context, | |
| UErrorCode *status); | | UErrorCode *status); | |
| | | | |
| /** | | /** | |
| * Get the find progress callback function for this URegularExpression. | | * Get the find progress callback function for this URegularExpression. | |
| * | | * | |
| * @param regexp The compiled regular expression. | | * @param regexp The compiled regular expression. | |
|
| * @param callback Out paramater, receives a pointer to the user-suppl
ied | | * @param callback Out parameter, receives a pointer to the user-suppl
ied | |
| * callback function. | | * callback function. | |
| * @param context Out parameter, receives the user context pointer th
at | | * @param context Out parameter, receives the user context pointer th
at | |
| * was set when uregex_setFindProgressCallback() was c
alled. | | * was set when uregex_setFindProgressCallback() was c
alled. | |
| * @param status A reference to a UErrorCode to receive any errors. | | * @param status A reference to a UErrorCode to receive any errors. | |
| * @draft ICU 4.6 | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT void U_EXPORT2 | | U_DRAFT void U_EXPORT2 | |
| uregex_getFindProgressCallback(const URegularExpression *regexp, | | uregex_getFindProgressCallback(const URegularExpression *regexp, | |
| URegexFindProgressCallback **callbac
k, | | URegexFindProgressCallback **callbac
k, | |
| const void **context
, | | const void **context
, | |
| | | | |
End of changes. 29 change blocks. |
| 47 lines changed or deleted | | 244 lines changed or added | |
|
| uscript.h | | uscript.h | |
| /* | | /* | |
| ********************************************************************** | | ********************************************************************** | |
|
| * Copyright (C) 1997-2010, International Business Machines | | * Copyright (C) 1997-2011, International Business Machines | |
| * Corporation and others. All Rights Reserved. | | * Corporation and others. All Rights Reserved. | |
| ********************************************************************** | | ********************************************************************** | |
| * | | * | |
| * File USCRIPT.H | | * File USCRIPT.H | |
| * | | * | |
| * Modification History: | | * Modification History: | |
| * | | * | |
| * Date Name Description | | * Date Name Description | |
| * 07/06/2001 Ram Creation. | | * 07/06/2001 Ram Creation. | |
| **************************************************************************
**** | | **************************************************************************
**** | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| * | | * | |
| * For example, there are no characters that have a UCD script code of | | * For example, there are no characters that have a UCD script code of | |
| * Hans or Hant. All Han ideographs have the Hani script code. | | * Hans or Hant. All Han ideographs have the Hani script code. | |
| * The Hans and Hant script codes are used with CLDR data. | | * The Hans and Hant script codes are used with CLDR data. | |
| * | | * | |
| * ISO 15924 script codes are included for use with CLDR and similar. | | * ISO 15924 script codes are included for use with CLDR and similar. | |
| * | | * | |
| * @stable ICU 2.2 | | * @stable ICU 2.2 | |
| */ | | */ | |
| typedef enum UScriptCode { | | typedef enum UScriptCode { | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_INVALID_CODE = -1, | | USCRIPT_INVALID_CODE = -1, | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_COMMON = 0, /* Zyyy */ | | USCRIPT_COMMON = 0, /* Zyyy */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_INHERITED = 1, /* Zinh */ /* "Code for inherited script"
, for non-spacing combining marks; also Qaai */ | | USCRIPT_INHERITED = 1, /* Zinh */ /* "Code for inherited script"
, for non-spacing combining marks; also Qaai */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_ARABIC = 2, /* Arab */ | | USCRIPT_ARABIC = 2, /* Arab */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_ARMENIAN = 3, /* Armn */ | | USCRIPT_ARMENIAN = 3, /* Armn */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_BENGALI = 4, /* Beng */ | | USCRIPT_BENGALI = 4, /* Beng */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_BOPOMOFO = 5, /* Bopo */ | | USCRIPT_BOPOMOFO = 5, /* Bopo */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_CHEROKEE = 6, /* Cher */ | | USCRIPT_CHEROKEE = 6, /* Cher */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_COPTIC = 7, /* Copt */ | | USCRIPT_COPTIC = 7, /* Copt */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_CYRILLIC = 8, /* Cyrl */ | | USCRIPT_CYRILLIC = 8, /* Cyrl */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_DESERET = 9, /* Dsrt */ | | USCRIPT_DESERET = 9, /* Dsrt */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_DEVANAGARI = 10, /* Deva */ | | USCRIPT_DEVANAGARI = 10, /* Deva */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_ETHIOPIC = 11, /* Ethi */ | | USCRIPT_ETHIOPIC = 11, /* Ethi */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_GEORGIAN = 12, /* Geor */ | | USCRIPT_GEORGIAN = 12, /* Geor */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_GOTHIC = 13, /* Goth */ | | USCRIPT_GOTHIC = 13, /* Goth */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_GREEK = 14, /* Grek */ | | USCRIPT_GREEK = 14, /* Grek */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_GUJARATI = 15, /* Gujr */ | | USCRIPT_GUJARATI = 15, /* Gujr */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_GURMUKHI = 16, /* Guru */ | | USCRIPT_GURMUKHI = 16, /* Guru */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_HAN = 17, /* Hani */ | | USCRIPT_HAN = 17, /* Hani */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_HANGUL = 18, /* Hang */ | | USCRIPT_HANGUL = 18, /* Hang */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_HEBREW = 19, /* Hebr */ | | USCRIPT_HEBREW = 19, /* Hebr */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_HIRAGANA = 20, /* Hira */ | | USCRIPT_HIRAGANA = 20, /* Hira */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_KANNADA = 21, /* Knda */ | | USCRIPT_KANNADA = 21, /* Knda */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_KATAKANA = 22, /* Kana */ | | USCRIPT_KATAKANA = 22, /* Kana */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_KHMER = 23, /* Khmr */ | | USCRIPT_KHMER = 23, /* Khmr */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_LAO = 24, /* Laoo */ | | USCRIPT_LAO = 24, /* Laoo */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_LATIN = 25, /* Latn */ | | USCRIPT_LATIN = 25, /* Latn */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_MALAYALAM = 26, /* Mlym */ | | USCRIPT_MALAYALAM = 26, /* Mlym */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_MONGOLIAN = 27, /* Mong */ | | USCRIPT_MONGOLIAN = 27, /* Mong */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_MYANMAR = 28, /* Mymr */ | | USCRIPT_MYANMAR = 28, /* Mymr */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_OGHAM = 29, /* Ogam */ | | USCRIPT_OGHAM = 29, /* Ogam */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_OLD_ITALIC = 30, /* Ital */ | | USCRIPT_OLD_ITALIC = 30, /* Ital */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_ORIYA = 31, /* Orya */ | | USCRIPT_ORIYA = 31, /* Orya */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_RUNIC = 32, /* Runr */ | | USCRIPT_RUNIC = 32, /* Runr */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_SINHALA = 33, /* Sinh */ | | USCRIPT_SINHALA = 33, /* Sinh */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_SYRIAC = 34, /* Syrc */ | | USCRIPT_SYRIAC = 34, /* Syrc */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_TAMIL = 35, /* Taml */ | | USCRIPT_TAMIL = 35, /* Taml */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_TELUGU = 36, /* Telu */ | | USCRIPT_TELUGU = 36, /* Telu */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_THAANA = 37, /* Thaa */ | | USCRIPT_THAANA = 37, /* Thaa */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_THAI = 38, /* Thai */ | | USCRIPT_THAI = 38, /* Thai */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_TIBETAN = 39, /* Tibt */ | | USCRIPT_TIBETAN = 39, /* Tibt */ | |
| /** Canadian_Aboriginal script. @stable ICU 2.6 */ | | /** Canadian_Aboriginal script. @stable ICU 2.6 */ | |
| USCRIPT_CANADIAN_ABORIGINAL = 40, /* Cans */ | | USCRIPT_CANADIAN_ABORIGINAL = 40, /* Cans */ | |
| /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */ | | /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */ | |
| USCRIPT_UCAS = USCRIPT_CANADIAN_ABORIGINAL, | | USCRIPT_UCAS = USCRIPT_CANADIAN_ABORIGINAL, | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_YI = 41, /* Yiii */ | | USCRIPT_YI = 41, /* Yiii */ | |
|
| | | /* New scripts in Unicode 3.2 */ | |
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_TAGALOG = 42, /* Tglg */ | | USCRIPT_TAGALOG = 42, /* Tglg */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_HANUNOO = 43, /* Hano */ | | USCRIPT_HANUNOO = 43, /* Hano */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_BUHID = 44, /* Buhd */ | | USCRIPT_BUHID = 44, /* Buhd */ | |
|
| | | /** @stable ICU 2.2 */ | |
| USCRIPT_TAGBANWA = 45, /* Tagb */ | | USCRIPT_TAGBANWA = 45, /* Tagb */ | |
| | | | |
|
| /* New scripts in Unicode 4 @stable ICU 2.6 */ | | /* New scripts in Unicode 4 */ | |
| | | /** @stable ICU 2.6 */ | |
| USCRIPT_BRAILLE = 46, /* Brai */ | | USCRIPT_BRAILLE = 46, /* Brai */ | |
|
| | | /** @stable ICU 2.6 */ | |
| USCRIPT_CYPRIOT = 47, /* Cprt */ | | USCRIPT_CYPRIOT = 47, /* Cprt */ | |
|
| | | /** @stable ICU 2.6 */ | |
| USCRIPT_LIMBU = 48, /* Limb */ | | USCRIPT_LIMBU = 48, /* Limb */ | |
|
| | | /** @stable ICU 2.6 */ | |
| USCRIPT_LINEAR_B = 49, /* Linb */ | | USCRIPT_LINEAR_B = 49, /* Linb */ | |
|
| | | /** @stable ICU 2.6 */ | |
| USCRIPT_OSMANYA = 50, /* Osma */ | | USCRIPT_OSMANYA = 50, /* Osma */ | |
|
| | | /** @stable ICU 2.6 */ | |
| USCRIPT_SHAVIAN = 51, /* Shaw */ | | USCRIPT_SHAVIAN = 51, /* Shaw */ | |
|
| | | /** @stable ICU 2.6 */ | |
| USCRIPT_TAI_LE = 52, /* Tale */ | | USCRIPT_TAI_LE = 52, /* Tale */ | |
|
| | | /** @stable ICU 2.6 */ | |
| USCRIPT_UGARITIC = 53, /* Ugar */ | | USCRIPT_UGARITIC = 53, /* Ugar */ | |
| | | | |
| /** New script code in Unicode 4.0.1 @stable ICU 3.0 */ | | /** New script code in Unicode 4.0.1 @stable ICU 3.0 */ | |
| USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */ | | USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */ | |
| | | | |
|
| /* New scripts in Unicode 4.1 @stable ICU 3.4 */ | | /* New scripts in Unicode 4.1 */ | |
| | | /** @stable ICU 3.4 */ | |
| USCRIPT_BUGINESE = 55, /* Bugi */ | | USCRIPT_BUGINESE = 55, /* Bugi */ | |
|
| | | /** @stable ICU 3.4 */ | |
| USCRIPT_GLAGOLITIC = 56, /* Glag */ | | USCRIPT_GLAGOLITIC = 56, /* Glag */ | |
|
| | | /** @stable ICU 3.4 */ | |
| USCRIPT_KHAROSHTHI = 57, /* Khar */ | | USCRIPT_KHAROSHTHI = 57, /* Khar */ | |
|
| | | /** @stable ICU 3.4 */ | |
| USCRIPT_SYLOTI_NAGRI = 58, /* Sylo */ | | USCRIPT_SYLOTI_NAGRI = 58, /* Sylo */ | |
|
| | | /** @stable ICU 3.4 */ | |
| USCRIPT_NEW_TAI_LUE = 59, /* Talu */ | | USCRIPT_NEW_TAI_LUE = 59, /* Talu */ | |
|
| | | /** @stable ICU 3.4 */ | |
| USCRIPT_TIFINAGH = 60, /* Tfng */ | | USCRIPT_TIFINAGH = 60, /* Tfng */ | |
|
| | | /** @stable ICU 3.4 */ | |
| USCRIPT_OLD_PERSIAN = 61, /* Xpeo */ | | USCRIPT_OLD_PERSIAN = 61, /* Xpeo */ | |
| | | | |
|
| /* New script codes from ISO 15924 @stable ICU 3.6 */ | | /* New script codes from ISO 15924 */ | |
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_BALINESE = 62, /* Bali */ | | USCRIPT_BALINESE = 62, /* Bali */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_BATAK = 63, /* Batk */ | | USCRIPT_BATAK = 63, /* Batk */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_BLISSYMBOLS = 64, /* Blis */ | | USCRIPT_BLISSYMBOLS = 64, /* Blis */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_BRAHMI = 65, /* Brah */ | | USCRIPT_BRAHMI = 65, /* Brah */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_CHAM = 66, /* Cham */ | | USCRIPT_CHAM = 66, /* Cham */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_CIRTH = 67, /* Cirt */ | | USCRIPT_CIRTH = 67, /* Cirt */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC = 68, /* Cyrs */ | | USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC = 68, /* Cyrs */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_DEMOTIC_EGYPTIAN = 69, /* Egyd */ | | USCRIPT_DEMOTIC_EGYPTIAN = 69, /* Egyd */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_HIERATIC_EGYPTIAN = 70, /* Egyh */ | | USCRIPT_HIERATIC_EGYPTIAN = 70, /* Egyh */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_EGYPTIAN_HIEROGLYPHS = 71, /* Egyp */ | | USCRIPT_EGYPTIAN_HIEROGLYPHS = 71, /* Egyp */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_KHUTSURI = 72, /* Geok */ | | USCRIPT_KHUTSURI = 72, /* Geok */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_SIMPLIFIED_HAN = 73, /* Hans */ | | USCRIPT_SIMPLIFIED_HAN = 73, /* Hans */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_TRADITIONAL_HAN = 74, /* Hant */ | | USCRIPT_TRADITIONAL_HAN = 74, /* Hant */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_PAHAWH_HMONG = 75, /* Hmng */ | | USCRIPT_PAHAWH_HMONG = 75, /* Hmng */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_OLD_HUNGARIAN = 76, /* Hung */ | | USCRIPT_OLD_HUNGARIAN = 76, /* Hung */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_HARAPPAN_INDUS = 77, /* Inds */ | | USCRIPT_HARAPPAN_INDUS = 77, /* Inds */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_JAVANESE = 78, /* Java */ | | USCRIPT_JAVANESE = 78, /* Java */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_KAYAH_LI = 79, /* Kali */ | | USCRIPT_KAYAH_LI = 79, /* Kali */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_LATIN_FRAKTUR = 80, /* Latf */ | | USCRIPT_LATIN_FRAKTUR = 80, /* Latf */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_LATIN_GAELIC = 81, /* Latg */ | | USCRIPT_LATIN_GAELIC = 81, /* Latg */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_LEPCHA = 82, /* Lepc */ | | USCRIPT_LEPCHA = 82, /* Lepc */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_LINEAR_A = 83, /* Lina */ | | USCRIPT_LINEAR_A = 83, /* Lina */ | |
| /** @stable ICU 4.6 */ | | /** @stable ICU 4.6 */ | |
| USCRIPT_MANDAIC = 84, /* Mand */ | | USCRIPT_MANDAIC = 84, /* Mand */ | |
| /** @stable ICU 3.6 */ | | /** @stable ICU 3.6 */ | |
| USCRIPT_MANDAEAN = USCRIPT_MANDAIC, | | USCRIPT_MANDAEAN = USCRIPT_MANDAIC, | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_MAYAN_HIEROGLYPHS = 85, /* Maya */ | | USCRIPT_MAYAN_HIEROGLYPHS = 85, /* Maya */ | |
| /** @stable ICU 4.6 */ | | /** @stable ICU 4.6 */ | |
| USCRIPT_MEROITIC_HIEROGLYPHS = 86, /* Mero */ | | USCRIPT_MEROITIC_HIEROGLYPHS = 86, /* Mero */ | |
| /** @stable ICU 3.6 */ | | /** @stable ICU 3.6 */ | |
| USCRIPT_MEROITIC = USCRIPT_MEROITIC_HIEROGLYPHS, | | USCRIPT_MEROITIC = USCRIPT_MEROITIC_HIEROGLYPHS, | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_NKO = 87, /* Nkoo */ | | USCRIPT_NKO = 87, /* Nkoo */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_ORKHON = 88, /* Orkh */ | | USCRIPT_ORKHON = 88, /* Orkh */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_OLD_PERMIC = 89, /* Perm */ | | USCRIPT_OLD_PERMIC = 89, /* Perm */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_PHAGS_PA = 90, /* Phag */ | | USCRIPT_PHAGS_PA = 90, /* Phag */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_PHOENICIAN = 91, /* Phnx */ | | USCRIPT_PHOENICIAN = 91, /* Phnx */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_PHONETIC_POLLARD = 92, /* Plrd */ | | USCRIPT_PHONETIC_POLLARD = 92, /* Plrd */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_RONGORONGO = 93, /* Roro */ | | USCRIPT_RONGORONGO = 93, /* Roro */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_SARATI = 94, /* Sara */ | | USCRIPT_SARATI = 94, /* Sara */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_ESTRANGELO_SYRIAC = 95, /* Syre */ | | USCRIPT_ESTRANGELO_SYRIAC = 95, /* Syre */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_WESTERN_SYRIAC = 96, /* Syrj */ | | USCRIPT_WESTERN_SYRIAC = 96, /* Syrj */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_EASTERN_SYRIAC = 97, /* Syrn */ | | USCRIPT_EASTERN_SYRIAC = 97, /* Syrn */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_TENGWAR = 98, /* Teng */ | | USCRIPT_TENGWAR = 98, /* Teng */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_VAI = 99, /* Vaii */ | | USCRIPT_VAI = 99, /* Vaii */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_VISIBLE_SPEECH = 100,/* Visp */ | | USCRIPT_VISIBLE_SPEECH = 100,/* Visp */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_CUNEIFORM = 101,/* Xsux */ | | USCRIPT_CUNEIFORM = 101,/* Xsux */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_UNWRITTEN_LANGUAGES = 102,/* Zxxx */ | | USCRIPT_UNWRITTEN_LANGUAGES = 102,/* Zxxx */ | |
|
| | | /** @stable ICU 3.6 */ | |
| USCRIPT_UNKNOWN = 103,/* Zzzz */ /* Unknown="Co
de for uncoded script", for unassigned code points */ | | USCRIPT_UNKNOWN = 103,/* Zzzz */ /* Unknown="Co
de for uncoded script", for unassigned code points */ | |
| | | | |
|
| /* New script codes from ISO 15924 @stable ICU 3.8 */ | | /* New script codes from ISO 15924 */ | |
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_CARIAN = 104,/* Cari */ | | USCRIPT_CARIAN = 104,/* Cari */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_JAPANESE = 105,/* Jpan */ | | USCRIPT_JAPANESE = 105,/* Jpan */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_LANNA = 106,/* Lana */ | | USCRIPT_LANNA = 106,/* Lana */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_LYCIAN = 107,/* Lyci */ | | USCRIPT_LYCIAN = 107,/* Lyci */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_LYDIAN = 108,/* Lydi */ | | USCRIPT_LYDIAN = 108,/* Lydi */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_OL_CHIKI = 109,/* Olck */ | | USCRIPT_OL_CHIKI = 109,/* Olck */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_REJANG = 110,/* Rjng */ | | USCRIPT_REJANG = 110,/* Rjng */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_SAURASHTRA = 111,/* Saur */ | | USCRIPT_SAURASHTRA = 111,/* Saur */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_SIGN_WRITING = 112,/* Sgnw */ | | USCRIPT_SIGN_WRITING = 112,/* Sgnw */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_SUNDANESE = 113,/* Sund */ | | USCRIPT_SUNDANESE = 113,/* Sund */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_MOON = 114,/* Moon */ | | USCRIPT_MOON = 114,/* Moon */ | |
|
| | | /** @stable ICU 3.8 */ | |
| USCRIPT_MEITEI_MAYEK = 115,/* Mtei */ | | USCRIPT_MEITEI_MAYEK = 115,/* Mtei */ | |
| | | | |
|
| /* New script codes from ISO 15924 @stable ICU 4.0 */ | | /* New script codes from ISO 15924 */ | |
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_IMPERIAL_ARAMAIC = 116,/* Armi */ | | USCRIPT_IMPERIAL_ARAMAIC = 116,/* Armi */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_AVESTAN = 117,/* Avst */ | | USCRIPT_AVESTAN = 117,/* Avst */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_CHAKMA = 118,/* Cakm */ | | USCRIPT_CHAKMA = 118,/* Cakm */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_KOREAN = 119,/* Kore */ | | USCRIPT_KOREAN = 119,/* Kore */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_KAITHI = 120,/* Kthi */ | | USCRIPT_KAITHI = 120,/* Kthi */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_MANICHAEAN = 121,/* Mani */ | | USCRIPT_MANICHAEAN = 121,/* Mani */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_INSCRIPTIONAL_PAHLAVI = 122,/* Phli */ | | USCRIPT_INSCRIPTIONAL_PAHLAVI = 122,/* Phli */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_PSALTER_PAHLAVI = 123,/* Phlp */ | | USCRIPT_PSALTER_PAHLAVI = 123,/* Phlp */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_BOOK_PAHLAVI = 124,/* Phlv */ | | USCRIPT_BOOK_PAHLAVI = 124,/* Phlv */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_INSCRIPTIONAL_PARTHIAN = 125,/* Prti */ | | USCRIPT_INSCRIPTIONAL_PARTHIAN = 125,/* Prti */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_SAMARITAN = 126,/* Samr */ | | USCRIPT_SAMARITAN = 126,/* Samr */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_TAI_VIET = 127,/* Tavt */ | | USCRIPT_TAI_VIET = 127,/* Tavt */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_MATHEMATICAL_NOTATION = 128,/* Zmth */ | | USCRIPT_MATHEMATICAL_NOTATION = 128,/* Zmth */ | |
|
| | | /** @stable ICU 4.0 */ | |
| USCRIPT_SYMBOLS = 129,/* Zsym */ | | USCRIPT_SYMBOLS = 129,/* Zsym */ | |
| | | | |
|
| /* New script codes from ISO 15924 @stable ICU 4.4 */ | | /* New script codes from ISO 15924 */ | |
| | | /** @stable ICU 4.4 */ | |
| USCRIPT_BAMUM = 130,/* Bamu */ | | USCRIPT_BAMUM = 130,/* Bamu */ | |
|
| | | /** @stable ICU 4.4 */ | |
| USCRIPT_LISU = 131,/* Lisu */ | | USCRIPT_LISU = 131,/* Lisu */ | |
|
| | | /** @stable ICU 4.4 */ | |
| USCRIPT_NAKHI_GEBA = 132,/* Nkgb */ | | USCRIPT_NAKHI_GEBA = 132,/* Nkgb */ | |
|
| | | /** @stable ICU 4.4 */ | |
| USCRIPT_OLD_SOUTH_ARABIAN = 133,/* Sarb */ | | USCRIPT_OLD_SOUTH_ARABIAN = 133,/* Sarb */ | |
| | | | |
|
| /* New script codes from ISO 15924 @stable ICU 4.6 */ | | /* New script codes from ISO 15924 */ | |
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_BASSA_VAH = 134,/* Bass */ | | USCRIPT_BASSA_VAH = 134,/* Bass */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_DUPLOYAN_SHORTAND = 135,/* Dupl */ | | USCRIPT_DUPLOYAN_SHORTAND = 135,/* Dupl */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_ELBASAN = 136,/* Elba */ | | USCRIPT_ELBASAN = 136,/* Elba */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_GRANTHA = 137,/* Gran */ | | USCRIPT_GRANTHA = 137,/* Gran */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_KPELLE = 138,/* Kpel */ | | USCRIPT_KPELLE = 138,/* Kpel */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_LOMA = 139,/* Loma */ | | USCRIPT_LOMA = 139,/* Loma */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_MENDE = 140,/* Mend */ | | USCRIPT_MENDE = 140,/* Mend */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_MEROITIC_CURSIVE = 141,/* Merc */ | | USCRIPT_MEROITIC_CURSIVE = 141,/* Merc */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_OLD_NORTH_ARABIAN = 142,/* Narb */ | | USCRIPT_OLD_NORTH_ARABIAN = 142,/* Narb */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_NABATAEAN = 143,/* Nbat */ | | USCRIPT_NABATAEAN = 143,/* Nbat */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_PALMYRENE = 144,/* Palm */ | | USCRIPT_PALMYRENE = 144,/* Palm */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_SINDHI = 145,/* Sind */ | | USCRIPT_SINDHI = 145,/* Sind */ | |
|
| | | /** @stable ICU 4.6 */ | |
| USCRIPT_WARANG_CITI = 146,/* Wara */ | | USCRIPT_WARANG_CITI = 146,/* Wara */ | |
| | | | |
|
| | | /** @stable ICU 4.8 */ | |
| | | USCRIPT_AFAKA = 147,/* Afak */ | |
| | | /** @stable ICU 4.8 */ | |
| | | USCRIPT_JURCHEN = 148,/* Jurc */ | |
| | | /** @stable ICU 4.8 */ | |
| | | USCRIPT_MRO = 149,/* Mroo */ | |
| | | /** @stable ICU 4.8 */ | |
| | | USCRIPT_NUSHU = 150,/* Nshu */ | |
| | | /** @stable ICU 4.8 */ | |
| | | USCRIPT_SHARADA = 151,/* Shrd */ | |
| | | /** @stable ICU 4.8 */ | |
| | | USCRIPT_SORA_SOMPENG = 152,/* Sora */ | |
| | | /** @stable ICU 4.8 */ | |
| | | USCRIPT_TAKRI = 153,/* Takr */ | |
| | | /** @stable ICU 4.8 */ | |
| | | USCRIPT_TANGUT = 154,/* Tang */ | |
| | | /** @stable ICU 4.8 */ | |
| | | USCRIPT_WOLEAI = 155,/* Wole */ | |
| | | | |
| /* Private use codes from Qaaa - Qabx are not supported */ | | /* Private use codes from Qaaa - Qabx are not supported */ | |
|
| USCRIPT_CODE_LIMIT = 147 | | | |
| | | /** @stable ICU 2.2 */ | |
| | | USCRIPT_CODE_LIMIT = 156 | |
| } UScriptCode; | | } UScriptCode; | |
| | | | |
| /** | | /** | |
| * Gets script codes associated with the given locale or ISO 15924 abbrevia
tion or name. | | * Gets script codes associated with the given locale or ISO 15924 abbrevia
tion or name. | |
| * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym". | | * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym". | |
| * Fills in USCRIPT_LATIN given "en" OR "en_US" | | * Fills in USCRIPT_LATIN given "en" OR "en_US" | |
| * If required capacity is greater than capacity of the destination buffer
then the error code | | * If required capacity is greater than capacity of the destination buffer
then the error code | |
| * is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned | | * is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned | |
| * | | * | |
| * <p>Note: To search by short or long script alias only, use | | * <p>Note: To search by short or long script alias only, use | |
| | | | |
| skipping to change at line 324 | | skipping to change at line 490 | |
| * pass the U_SUCCESS() test, or else the function returns | | * pass the U_SUCCESS() test, or else the function returns | |
| * immediately. Check for U_FAILURE() on output or use wit
h | | * immediately. Check for U_FAILURE() on output or use wit
h | |
| * function chaining. (See User Guide for details.) | | * function chaining. (See User Guide for details.) | |
| * @return number of script codes in c's Script_Extensions, | | * @return number of script codes in c's Script_Extensions, | |
| * written to scripts unless U_BUFFER_OVERFLOW_ERROR indicates insu
fficient capacity | | * written to scripts unless U_BUFFER_OVERFLOW_ERROR indicates insu
fficient capacity | |
| * @draft ICU 4.6 | | * @draft ICU 4.6 | |
| */ | | */ | |
| U_DRAFT int32_t U_EXPORT2 | | U_DRAFT int32_t U_EXPORT2 | |
| uscript_getScriptExtensions(UChar32 c, | | uscript_getScriptExtensions(UChar32 c, | |
| UScriptCode *scripts, int32_t capacity, | | UScriptCode *scripts, int32_t capacity, | |
|
| UErrorCode *pErrorCode); | | UErrorCode *errorCode); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 148 change blocks. |
| 10 lines changed or deleted | | 176 lines changed or added | |
|