• Home
  • Raw
  • Download

Lines Matching +full:code +full:- +full:format

4 * Copyright (C) 2007-2013, International Business Machines Corporation and
15 * 07/22/98 stephen Removed operator!= (defined in Format)
28 * \brief C++ API: Formats messages in a language-neutral way.
33 #include "unicode/format.h"
61 * <p><code>MessageFormat</code> differs from the other <code>Format</code>
62 * classes in that you create a <code>MessageFormat</code> object with one
63 * of its constructors (not with a <code>createInstance</code> style factory
64 * method). Factory methods aren't necessary because <code>MessageFormat</code>
65 * itself doesn't implement locale-specific behavior. Any locale-specific
69 * <p>Arguments can be named (using identifiers) or numbered (using small ASCII-digit integers).
73 * <p>An argument might not specify any format type. In this case,
78 * Format object is created, cached and used.
80 * <p>An argument might have a "complex" type with nested MessageFormat sub-patterns.
81 * During formatting, one of these sub-messages is selected according to the argument value
84 * <p>After construction, a custom Format object can be set for
85 * a top-level argument, overriding the default formatting and parsing behavior
100 * (or using a custom Format object if one was set).
102 * as an ASCII-decimal-digit string (without leading zero).
106 * <code>MessageFormat</code> uses patterns of the following form:
147 * human-readable text, and use the ASCII apostrophe ' (U+0027)
151 * <p>The <code>choice</code> argument type is deprecated.
152 * Use <code>plural</code> arguments for proper plural selection,
153 * and <code>select</code> arguments for simple selection among a fixed set of choices.
155 * <p>The <code>argType</code> and <code>argStyle</code> values are used to create
156 * a <code>Format</code> instance for the format element. The following
157 * table shows how the values map to Format instances. Combinations not
158 * shown in the table are illegal. Any <code>argStyleText</code> must
159 * be a valid pattern string for the Format subclass used.
165 * <th>resulting Format object
168 * <td><code>null</code>
170 * <td rowspan=6><code>number</code>
172 * <td><code>NumberFormat.createInstance(getLocale(), status)</code>
174 * <td><code>integer</code>
175 * <td><code>NumberFormat.createInstance(getLocale(), kNumberStyle, status)</code>
177 * <td><code>currency</code>
178 * <td><code>NumberFormat.createCurrencyInstance(getLocale(), status)</code>
180 * <td><code>percent</code>
181 * <td><code>NumberFormat.createPercentInstance(getLocale(), status)</code>
184 …* <td><code>new DecimalFormat(argStyleText, new DecimalFormatSymbols(getLocale(), status), s…
187 …* <td><code>NumberFormatter::forSkeleton(argSkeletonText, status).locale(getLocale()).toForm…
189 * <td rowspan=7><code>date</code>
191 * <td><code>DateFormat.createDateInstance(kDefault, getLocale(), status)</code>
193 * <td><code>short</code>
194 * <td><code>DateFormat.createDateInstance(kShort, getLocale(), status)</code>
196 * <td><code>medium</code>
197 * <td><code>DateFormat.createDateInstance(kDefault, getLocale(), status)</code>
199 * <td><code>long</code>
200 * <td><code>DateFormat.createDateInstance(kLong, getLocale(), status)</code>
202 * <td><code>full</code>
203 * <td><code>DateFormat.createDateInstance(kFull, getLocale(), status)</code>
206 * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code>
209 …* <td><code>DateFormat::createInstanceForSkeleton(argSkeletonText, getLocale(), status)</cod…
211 * <td rowspan=6><code>time</code>
213 * <td><code>DateFormat.createTimeInstance(kDefault, getLocale(), status)</code>
215 * <td><code>short</code>
216 * <td><code>DateFormat.createTimeInstance(kShort, getLocale(), status)</code>
218 * <td><code>medium</code>
219 * <td><code>DateFormat.createTimeInstance(kDefault, getLocale(), status)</code>
221 * <td><code>long</code>
222 * <td><code>DateFormat.createTimeInstance(kLong, getLocale(), status)</code>
224 * <td><code>full</code>
225 * <td><code>DateFormat.createTimeInstance(kFull, getLocale(), status)</code>
228 * <td><code>new SimpleDateFormat(argStyleText, getLocale(), status)</code>
230 * <td><code>spellout</code>
232 * <td><code>new RuleBasedNumberFormat(URBNF_SPELLOUT, getLocale(), status)
233 * <br/>&nbsp;&nbsp;&nbsp;&nbsp;.setDefaultRuleset(argStyleText, status);</code>
235 * <td><code>ordinal</code>
237 * <td><code>new RuleBasedNumberFormat(URBNF_ORDINAL, getLocale(), status)
238 * <br/>&nbsp;&nbsp;&nbsp;&nbsp;.setDefaultRuleset(argStyleText, status);</code>
240 * <td><code>duration</code>
242 * <td><code>new RuleBasedNumberFormat(URBNF_DURATION, getLocale(), status)
243 * <br/>&nbsp;&nbsp;&nbsp;&nbsp;.setDefaultRuleset(argStyleText, status);</code>
255 * or preformatted values, but not pattern strings or custom format objects.</p>
258 …* <a href="https://unicode-org.github.io/icu/userguide/format_parse/messages">ICU User Guide</a>.<…
266 * \code
276 * MessageFormat::format(
286 * Typically, the message format will come from resources, and the
292 * \code
301 * cout << "format: " << form.format(testArgs, 2, string, fpos, success ) << endl;
313 * \code
326 * cout << msgFmt.format(testArgs, testArgsNames, 2, result, fpos, 0, success);
328 * cout << msgFmt.format(testArgs, testArgsNames, 2, result, fpos, 0, success);
339 * It is recommended to create separate format instances for each thread.
340 * If multiple threads access a format concurrently, it must be synchronized
345 class U_I18N_API MessageFormat : public Format {
350 * @obsolete ICU 3.0. The 10-argument limit was removed as of ICU 2.6,
356 * @obsolete ICU 3.0. The 10-argument limit was removed as of ICU 2.6,
368 * @param status Input/output error code. If the
369 * pattern cannot be parsed, set to failure code.
379 * @param status Input/output error code. If the
380 * pattern cannot be parsed, set to failure code.
392 * @param status Input/output error code. If the
393 * pattern cannot be parsed, set to failure code.
419 * Clones this Format object polymorphically. The caller owns the
426 * Returns true if the given Format objects are semantically equal.
429 * @return true if the given Format objects are semantically equal.
432 virtual bool operator==(const Format& other) const override;
435 * Sets the locale to be used for creating argument Format objects.
442 * Gets the locale used for creating argument Format objects.
443 * format information.
450 * Applies the given pattern string to this message format.
453 * @param status Input/output error code. If the
454 * pattern cannot be parsed, set to failure code.
460 * Applies the given pattern string to this message format.
465 * @param status Input/output error code. If the
466 * pattern cannot be parsed, set to failure code.
474 * Sets the UMessagePatternApostropheMode and the pattern used by this message format.
475 * Parses the pattern and caches Format objects for simple argument types.
487 * @param status Input/output error code. If the
488 * pattern cannot be parsed, set to failure code.
516 * See the class description about format numbering.
517 * The caller should not delete the Format objects after this call.
523 * <p>If this format uses named arguments, the new formats are discarded
524 * and this format remains unchanged.
527 * @param formatsToAdopt the format to be adopted.
530 virtual void adoptFormats(Format** formatsToAdopt, int32_t count);
534 * See the class description about format numbering.
539 * <p>If this format uses named arguments, the new formats are discarded
540 * and this format remains unchanged.
543 * @param newFormats the new format to be set.
546 virtual void setFormats(const Format** newFormats, int32_t cnt);
551 * See the class description about format numbering.
552 * The caller should not delete the Format object after this call.
556 * <p>If this format uses named arguments, the new format is discarded
557 * and this format remains unchanged.
561 * @param formatToAdopt the format to be adopted.
563 virtual void adoptFormat(int32_t formatNumber, Format* formatToAdopt);
567 * See the class description about format numbering.
571 * @param format the format to be set.
574 virtual void setFormat(int32_t formatNumber, const Format& format);
577 * Gets format names. This function returns formatNames in StringEnumerations
581 * @param status output param set to success/failure code.
587 * Gets subformat pointer for given format name.
591 * The returned Format object should not be deleted by the caller,
595 * @param formatName the name or number specifying a format
596 * @param status output param set to success/failure code.
599 virtual Format* getFormat(const UnicodeString& formatName, UErrorCode& status);
602 * Sets one subformat for given format name.
603 * See the class description about format name.
605 * arguments-- if numbered, the formatName is the
610 * @param format the format to be set.
611 * @param status output param set to success/failure code.
614 … virtual void setFormat(const UnicodeString& formatName, const Format& format, UErrorCode& status);
617 * Sets one subformat for given format name.
618 * See the class description about format name.
620 * arguments-- if numbered, the formatName is the
624 * The caller should not delete the Format object after this call.
626 * @param formatToAdopt Format to be adopted.
627 * @param status output param set to success/failure code.
630 …virtual void adoptFormat(const UnicodeString& formatName, Format* formatToAdopt, UErrorCode& statu…
636 * until the next call to this format. See the class description
637 * about format numbering.
640 * @return an array of count Format* objects, or nullptr if out of
644 virtual const Format** getFormats(int32_t& count) const;
647 using Format::format;
650 * Formats the given array of arguments into a user-readable string.
653 * <p>If this format uses named arguments, appendTo is unchanged and
661 * @param status Input/output error code. If the
662 * pattern cannot be parsed, set to failure code.
666 UnicodeString& format(const Formattable* source,
673 * Formats the given array of arguments into a user-readable string
676 * <p>If this format uses named arguments, appendTo is unchanged and
684 * @param status Input/output error code. If the
685 * pattern cannot be parsed, set to failure code.
689 static UnicodeString& format(const UnicodeString& pattern,
696 * Formats the given array of arguments into a user-readable
701 * <p>If this format uses named arguments, appendTo is unchanged and
710 * @param status Input/output error code. If the
711 * pattern cannot be parsed, set to failure code.
715 virtual UnicodeString& format(const Formattable& obj,
721 * Formats the given array of arguments into a user-defined argument name
723 * arguments-- if numbered, the formatName is the
733 * @param status Input/output error code. If the
734 * pattern cannot be parsed, set to failure code.
738 UnicodeString& format(const UnicodeString* argumentNames,
763 * <p>If this format uses named arguments, status is set to
768 * @param status Input/output error code. If the
769 * pattern cannot be parsed, set to failure code.
796 * Convert an 'apostrophe-friendly' pattern into a standard
808 * @param pattern the 'apostrophe-friendly' patttern to convert
809 * @param status Input/output error code. If the pattern
810 * cannot be parsed, the failure code is set.
860 * . if (polymorphic_pointer->getDynamicClassID() ==
870 * Compares two Format objects. This is used for constructing the hash
873 * @param left pointer to a Format object. Must not be nullptr.
874 * @param right pointer to a Format object. Must not be nullptr.
886 Format** formatAliases; // see getFormats
894 * For example, if the number matches an explicit-value selector like "=1"
929 // Variable-size array management
933 * Default Format objects used when no format is specified and a
965 * Thin wrapper around the format(... AppendableWrapper ...) variant.
969 UnicodeString& format(const Formattable* arguments,
981 * @param plNumber nullptr except when formatting a plural argument sub-message
982 * where a '#' is replaced by the format string for this number.
991 * @param success The error code status.
993 void format(int32_t msgStart,
1004 void setArgStartFormat(int32_t argStart, Format* formatter, UErrorCode& status);
1006 void setCustomArgStartFormat(int32_t argStart, Format* formatter, UErrorCode& status);
1014 Format* createAppropriateFormat(UnicodeString& type,
1034 * Finds the "other" sub-message.
1036 * @return the "other" sub-message start part index.
1041 * Returns the ARG_START index of the first occurrence of the plural number in a sub-message.
1042 * Returns -1 if it is a REPLACE_NUMBER.
1047 Format* getCachedFormatter(int32_t argumentNumber) const;
1087 class U_I18N_API DummyFormat : public Format {
1089 virtual bool operator==(const Format&) const override;
1091 virtual UnicodeString& format(const Formattable& obj,
1094 virtual UnicodeString& format(const Formattable&,
1098 virtual UnicodeString& format(const Formattable& obj,