ICU-13052 Merge ICU4C branch to trunk

X-SVN-Rev: 39901
This commit is contained in:
Peter Edberg 2017-03-22 20:14:08 +00:00
commit 5652a93338
6 changed files with 58 additions and 84 deletions

View File

@ -19,8 +19,6 @@
#include "unicode/utypes.h"
#include "unicode/unistr.h"
#ifndef U_HIDE_DRAFT_API
U_NAMESPACE_BEGIN
/**
@ -49,13 +47,13 @@ U_NAMESPACE_BEGIN
*
* @see MessageFormat
* @see UMessagePatternApostropheMode
* @draft ICU 57
* @stable ICU 57
*/
class U_COMMON_API SimpleFormatter U_FINAL : public UMemory {
public:
/**
* Default constructor.
* @draft ICU 57
* @stable ICU 57
*/
SimpleFormatter() : compiledPattern((char16_t)0) {}
@ -66,7 +64,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax.
* @draft ICU 57
* @stable ICU 57
*/
SimpleFormatter(const UnicodeString& pattern, UErrorCode &errorCode) {
applyPattern(pattern, errorCode);
@ -84,7 +82,7 @@ public:
* Must fulfill U_SUCCESS before the function call.
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and
* too few or too many arguments.
* @draft ICU 57
* @stable ICU 57
*/
SimpleFormatter(const UnicodeString& pattern, int32_t min, int32_t max,
UErrorCode &errorCode) {
@ -93,20 +91,20 @@ public:
/**
* Copy constructor.
* @draft ICU 57
* @stable ICU 57
*/
SimpleFormatter(const SimpleFormatter& other)
: compiledPattern(other.compiledPattern) {}
/**
* Assignment operator.
* @draft ICU 57
* @stable ICU 57
*/
SimpleFormatter &operator=(const SimpleFormatter& other);
/**
* Destructor.
* @draft ICU 57
* @stable ICU 57
*/
~SimpleFormatter();
@ -118,7 +116,7 @@ public:
* Must fulfill U_SUCCESS before the function call.
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax.
* @return TRUE if U_SUCCESS(errorCode).
* @draft ICU 57
* @stable ICU 57
*/
UBool applyPattern(const UnicodeString &pattern, UErrorCode &errorCode) {
return applyPatternMinMaxArguments(pattern, 0, INT32_MAX, errorCode);
@ -137,14 +135,14 @@ public:
* Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and
* too few or too many arguments.
* @return TRUE if U_SUCCESS(errorCode).
* @draft ICU 57
* @stable ICU 57
*/
UBool applyPatternMinMaxArguments(const UnicodeString &pattern,
int32_t min, int32_t max, UErrorCode &errorCode);
/**
* @return The max argument number + 1.
* @draft ICU 57
* @stable ICU 57
*/
int32_t getArgumentLimit() const {
return getArgumentLimit(compiledPattern.getBuffer(), compiledPattern.length());
@ -160,7 +158,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
* @draft ICU 57
* @stable ICU 57
*/
UnicodeString &format(
const UnicodeString &value0,
@ -177,7 +175,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
* @draft ICU 57
* @stable ICU 57
*/
UnicodeString &format(
const UnicodeString &value0,
@ -196,7 +194,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
* @draft ICU 57
* @stable ICU 57
*/
UnicodeString &format(
const UnicodeString &value0,
@ -221,7 +219,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return appendTo
* @draft ICU 57
* @stable ICU 57
*/
UnicodeString &formatAndAppend(
const UnicodeString *const *values, int32_t valuesLength,
@ -247,7 +245,7 @@ public:
* @param errorCode ICU error code in/out parameter.
* Must fulfill U_SUCCESS before the function call.
* @return result
* @draft ICU 57
* @stable ICU 57
*/
UnicodeString &formatAndReplace(
const UnicodeString *const *values, int32_t valuesLength,
@ -257,7 +255,7 @@ public:
/**
* Returns the pattern text with none of the arguments.
* Like formatting with all-empty string values.
* @draft ICU 57
* @stable ICU 57
*/
UnicodeString getTextWithNoArguments() const {
return getTextWithNoArguments(compiledPattern.getBuffer(), compiledPattern.length());
@ -292,6 +290,4 @@ private:
U_NAMESPACE_END
#endif /* U_HIDE_DRAFT_API */
#endif // __SIMPLEFORMATTER_H__

View File

@ -399,36 +399,34 @@ typedef enum UProperty {
UCHAR_CHANGES_WHEN_CASEMAPPED=55,
/** Binary property Changes_When_NFKC_Casefolded. @stable ICU 4.4 */
UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED=56,
#ifndef U_HIDE_DRAFT_API
/**
* Binary property Emoji.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
* @draft ICU 57
* @stable ICU 57
*/
UCHAR_EMOJI=57,
/**
* Binary property Emoji_Presentation.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
* @draft ICU 57
* @stable ICU 57
*/
UCHAR_EMOJI_PRESENTATION=58,
/**
* Binary property Emoji_Modifier.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
* @draft ICU 57
* @stable ICU 57
*/
UCHAR_EMOJI_MODIFIER=59,
/**
* Binary property Emoji_Modifier_Base.
* See http://www.unicode.org/reports/tr51/#Emoji_Properties
*
* @draft ICU 57
* @stable ICU 57
*/
UCHAR_EMOJI_MODIFIER_BASE=60,
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the last constant for binary Unicode properties.

View File

@ -345,35 +345,29 @@ class U_I18N_API MeasureUnit: public UObject {
*/
static MeasureUnit *createKarat(UErrorCode &status);
#ifndef U_HIDE_DRAFT_API
/**
* Returns unit of concentr: milligram-per-deciliter.
* Caller owns returned value and must free it.
* @param status ICU error code.
* @draft ICU 57
* @stable ICU 57
*/
static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status);
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_DRAFT_API
/**
* Returns unit of concentr: millimole-per-liter.
* Caller owns returned value and must free it.
* @param status ICU error code.
* @draft ICU 57
* @stable ICU 57
*/
static MeasureUnit *createMillimolePerLiter(UErrorCode &status);
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_DRAFT_API
/**
* Returns unit of concentr: part-per-million.
* Caller owns returned value and must free it.
* @param status ICU error code.
* @draft ICU 57
* @stable ICU 57
*/
static MeasureUnit *createPartPerMillion(UErrorCode &status);
#endif /* U_HIDE_DRAFT_API */
/**
* Returns unit of consumption: liter-per-100kilometers.
@ -399,15 +393,13 @@ class U_I18N_API MeasureUnit: public UObject {
*/
static MeasureUnit *createMilePerGallon(UErrorCode &status);
#ifndef U_HIDE_DRAFT_API
/**
* Returns unit of consumption: mile-per-gallon-imperial.
* Caller owns returned value and must free it.
* @param status ICU error code.
* @draft ICU 57
* @stable ICU 57
*/
static MeasureUnit *createMilePerGallonImperial(UErrorCode &status);
#endif /* U_HIDE_DRAFT_API */
/**
* @draft ICU 58, withdrawn
@ -1227,15 +1219,13 @@ class U_I18N_API MeasureUnit: public UObject {
*/
static MeasureUnit *createGallon(UErrorCode &status);
#ifndef U_HIDE_DRAFT_API
/**
* Returns unit of volume: gallon-imperial.
* Caller owns returned value and must free it.
* @param status ICU error code.
* @draft ICU 57
* @stable ICU 57
*/
static MeasureUnit *createGallonImperial(UErrorCode &status);
#endif /* U_HIDE_DRAFT_API */
/**
* Returns unit of volume: hectoliter.

View File

@ -415,7 +415,6 @@ public:
UnicodeString& appendTo,
UErrorCode& status) const;
#ifndef U_HIDE_DRAFT_API
/**
* Format a combination of URelativeDateTimeUnit and numeric offset
* using a numeric style, e.g. "1 week ago", "in 1 week",
@ -431,7 +430,7 @@ public:
* appended.
* @param status ICU error code returned here.
* @return appendTo
* @draft ICU 57
* @stable ICU 57
*/
UnicodeString& formatNumeric(
double offset,
@ -454,14 +453,13 @@ public:
* appended.
* @param status ICU error code returned here.
* @return appendTo
* @draft ICU 57
* @stable ICU 57
*/
UnicodeString& format(
double offset,
URelativeDateTimeUnit unit,
UnicodeString& appendTo,
UErrorCode& status) const;
#endif /* U_HIDE_DRAFT_API */
/**
* Combines a relative date string and a time string in this object's

View File

@ -763,21 +763,19 @@ typedef enum UDateFormatField {
UDAT_RELATED_YEAR_FIELD = 34,
#endif /* U_HIDE_INTERNAL_API */
#ifndef U_HIDE_DRAFT_API
/**
* FieldPosition selector for 'b' field alignment.
* Displays midnight and noon for 12am and 12pm, respectively, if available;
* otherwise fall back to AM / PM.
* @draft ICU 57
* @stable ICU 57
*/
UDAT_AM_PM_MIDNIGHT_NOON_FIELD = 35,
/* FieldPosition selector for 'B' field alignment.
* Displays flexible day periods, such as "in the morning", if available.
* @draft ICU 57
* @stable ICU 57
*/
UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36,
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_INTERNAL_API
/**

View File

@ -34,7 +34,7 @@
* for determining which unit to use, such as deciding between "in 7 days"
* and "in 1 week".
*
* @draft ICU 57
* @stable ICU 57
*/
/**
@ -69,101 +69,100 @@ typedef enum UDateRelativeDateTimeFormatterStyle {
#endif // U_HIDE_DEPRECATED_API
} UDateRelativeDateTimeFormatterStyle;
#ifndef U_HIDE_DRAFT_API
/**
* Represents the unit for formatting a relative date. e.g "in 5 days"
* or "next year"
* @draft ICU 57
* @stable ICU 57
*/
typedef enum URelativeDateTimeUnit {
/**
* Specifies that relative unit is year, e.g. "last year",
* "in 5 years".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_YEAR,
/**
* Specifies that relative unit is quarter, e.g. "last quarter",
* "in 5 quarters".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_QUARTER,
/**
* Specifies that relative unit is month, e.g. "last month",
* "in 5 months".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_MONTH,
/**
* Specifies that relative unit is week, e.g. "last week",
* "in 5 weeks".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_WEEK,
/**
* Specifies that relative unit is day, e.g. "yesterday",
* "in 5 days".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_DAY,
/**
* Specifies that relative unit is hour, e.g. "1 hour ago",
* "in 5 hours".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_HOUR,
/**
* Specifies that relative unit is minute, e.g. "1 minute ago",
* "in 5 minutes".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_MINUTE,
/**
* Specifies that relative unit is second, e.g. "1 second ago",
* "in 5 seconds".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_SECOND,
/**
* Specifies that relative unit is Sunday, e.g. "last Sunday",
* "this Sunday", "next Sunday", "in 5 Sundays".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_SUNDAY,
/**
* Specifies that relative unit is Monday, e.g. "last Monday",
* "this Monday", "next Monday", "in 5 Mondays".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_MONDAY,
/**
* Specifies that relative unit is Tuesday, e.g. "last Tuesday",
* "this Tuesday", "next Tuesday", "in 5 Tuesdays".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_TUESDAY,
/**
* Specifies that relative unit is Wednesday, e.g. "last Wednesday",
* "this Wednesday", "next Wednesday", "in 5 Wednesdays".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_WEDNESDAY,
/**
* Specifies that relative unit is Thursday, e.g. "last Thursday",
* "this Thursday", "next Thursday", "in 5 Thursdays".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_THURSDAY,
/**
* Specifies that relative unit is Friday, e.g. "last Friday",
* "this Friday", "next Friday", "in 5 Fridays".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_FRIDAY,
/**
* Specifies that relative unit is Saturday, e.g. "last Saturday",
* "this Saturday", "next Saturday", "in 5 Saturdays".
* @draft ICU 57
* @stable ICU 57
*/
UDAT_REL_UNIT_SATURDAY,
#ifndef U_HIDE_DEPRECATED_API
@ -174,13 +173,10 @@ typedef enum URelativeDateTimeUnit {
UDAT_REL_UNIT_COUNT
#endif // U_HIDE_DEPRECATED_API
} URelativeDateTimeUnit;
#endif /* U_HIDE_DRAFT_API */
#ifndef U_HIDE_DRAFT_API
/**
* Opaque URelativeDateTimeFormatter object for use in C programs.
* @draft ICU 57
* @stable ICU 57
*/
struct URelativeDateTimeFormatter;
typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C typedef for struct URelativeDateTimeFormatter. @draft ICU 57 */
@ -216,9 +212,9 @@ typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C ty
* @return
* A pointer to a URelativeDateTimeFormatter object for the specified locale,
* or NULL if an error occurred.
* @draft ICU 57
* @stable ICU 57
*/
U_DRAFT URelativeDateTimeFormatter* U_EXPORT2
U_STABLE URelativeDateTimeFormatter* U_EXPORT2
ureldatefmt_open( const char* locale,
UNumberFormat* nfToAdopt,
UDateRelativeDateTimeFormatterStyle width,
@ -229,9 +225,9 @@ ureldatefmt_open( const char* locale,
* Close a URelativeDateTimeFormatter object. Once closed it may no longer be used.
* @param reldatefmt
* The URelativeDateTimeFormatter object to close.
* @draft ICU 57
* @stable ICU 57
*/
U_DRAFT void U_EXPORT2
U_STABLE void U_EXPORT2
ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt);
#if U_SHOW_CPLUSPLUS_API
@ -245,7 +241,7 @@ U_NAMESPACE_BEGIN
*
* @see LocalPointerBase
* @see LocalPointer
* @draft ICU 57
* @stable ICU 57
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDateTimeFormatter, ureldatefmt_close);
@ -279,9 +275,9 @@ U_NAMESPACE_END
* @return
* The length of the formatted result; may be greater
* than resultCapacity, in which case an error is returned.
* @draft ICU 57
* @stable ICU 57
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
double offset,
URelativeDateTimeUnit unit,
@ -315,9 +311,9 @@ ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
* @return
* The length of the formatted result; may be greater
* than resultCapacity, in which case an error is returned.
* @draft ICU 57
* @stable ICU 57
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
double offset,
URelativeDateTimeUnit unit,
@ -352,9 +348,9 @@ ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
* @return
* The length of the formatted result; may be greater than resultCapacity,
* in which case an error is returned.
* @draft ICU 57
* @stable ICU 57
*/
U_DRAFT int32_t U_EXPORT2
U_STABLE int32_t U_EXPORT2
ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt,
const UChar * relativeDateString,
int32_t relativeDateStringLen,
@ -364,8 +360,6 @@ ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt,
int32_t resultCapacity,
UErrorCode* status );
#endif /* U_HIDE_DRAFT_API */
#endif /* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION */
#endif