X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/57a6839dcb3bba09e8228b822b290604668416fe..HEAD:/icuSources/i18n/unicode/msgfmt.h?ds=inline diff --git a/icuSources/i18n/unicode/msgfmt.h b/icuSources/i18n/unicode/msgfmt.h index 5de91e41..99b0eaee 100644 --- a/icuSources/i18n/unicode/msgfmt.h +++ b/icuSources/i18n/unicode/msgfmt.h @@ -1,3 +1,5 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* * Copyright (C) 2007-2013, International Business Machines Corporation and * others. All Rights Reserved. @@ -19,6 +21,8 @@ #include "unicode/utypes.h" +#if U_SHOW_CPLUSPLUS_API + /** * \file * \brief C++ API: Formats messages in a language-neutral way. @@ -67,9 +71,8 @@ class NumberFormat; * if the pattern has named arguments (see {@link #usesNamedArguments()}). * *
An argument might not specify any format type. In this case, - * a Number value is formatted with a default (for the locale) NumberFormat, - * a Date value is formatted with a default (for the locale) DateFormat, - * and for any other value its toString() value is used. + * a numeric value is formatted with a default (for the locale) NumberFormat, + * and a date/time value is formatted with a default (for the locale) DateFormat. * *
An argument might specify a "simple" type for which the specified * Format object is created, cached and used. @@ -122,7 +125,7 @@ class NumberFormat; * argNumber = '0' | ('1'..'9' ('0'..'9')*) * * argType = "number" | "date" | "time" | "spellout" | "ordinal" | "duration" - * argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | "percent" | argStyleText + * argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | "percent" | argStyleText | "::" argSkeletonText * * *
null
* number
+ * number
* NumberFormat.createInstance(getLocale(), status)
* new DecimalFormat(argStyleText, new DecimalFormatSymbols(getLocale(), status), status)
* date
+ * NumberFormatter::forSkeleton(argSkeletonText, status).locale(getLocale()).toFormat(status)
+ * date
* DateFormat.createDateInstance(kDefault, getLocale(), status)
* DateFormat.createDateInstance(kFull, getLocale(), status)
* new SimpleDateFormat(argStyleText, getLocale(), status)
+ * new SimpleDateFormat(argStyleText, getLocale(), status)
+ *
+ * argSkeletonText
+ * DateFormat::createInstanceForSkeleton(argSkeletonText, getLocale(), status)
*
* time
* (none)
@@ -216,7 +225,7 @@ class NumberFormat;
* DateFormat.createTimeInstance(kFull, getLocale(), status)
*
* argStyleText
- * new SimpleDateFormat(argStyleText, getLocale(), status)
+ * new SimpleDateFormat(argStyleText, getLocale(), status)
*
* spellout
* argStyleText (optional)
@@ -235,6 +244,19 @@ class NumberFormat;
*
*
*
+ *
Argument formatting
+ *
+ * Arguments are formatted according to their type, using the default
+ * ICU formatters for those types, unless otherwise specified.
+ *
+ * There are also several ways to control the formatting.
+ *
+ * We recommend you use default styles, predefined style values, skeletons,
+ * or preformatted values, but not pattern strings or custom format objects.
+ *
+ * For more details, see the
+ * ICU User Guide.
+ *
* Usage Information
*
* Here are some examples of usage:
@@ -252,11 +274,11 @@ class NumberFormat;
*
* UnicodeString result;
* MessageFormat::format(
- * "At {1,time} on {1,date}, there was {2} on planet {0,number}.",
+ * "At {1,time,::jmm} on {1,date,::dMMMM}, there was {2} on planet {0,number}.",
* arguments, 3, result, success );
*
* cout << "result: " << result << endl;
- * //