Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: source/i18n/unicode/reldatefmt.h

Issue 2440913002: Update ICU to 58.1
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/i18n/unicode/region.h ('k') | source/i18n/unicode/scientificnumberformatter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/unicode/reldatefmt.h
diff --git a/source/i18n/unicode/reldatefmt.h b/source/i18n/unicode/reldatefmt.h
index c3350c516c4e6fb79b12c2c5371110506e23d662..e91d20667e39af178bf2791e814e747a8cb6cf6a 100644
--- a/source/i18n/unicode/reldatefmt.h
+++ b/source/i18n/unicode/reldatefmt.h
@@ -1,6 +1,8 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
*****************************************************************************
-* Copyright (C) 2014-2015, International Business Machines Corporation and
+* Copyright (C) 2014-2016, International Business Machines Corporation and
* others.
* All Rights Reserved.
*****************************************************************************
@@ -15,6 +17,7 @@
#include "unicode/utypes.h"
#include "unicode/uobject.h"
#include "unicode/udisplaycontext.h"
+#include "unicode/ureldatefmt.h"
#include "unicode/locid.h"
/**
@@ -22,37 +25,7 @@
* \brief C++ API: Formats relative dates such as "1 day ago" or "tomorrow"
*/
-#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION
-
-/**
- * The formatting style
- * @stable ICU 54
- */
-typedef enum UDateRelativeDateTimeFormatterStyle {
- /**
- * Everything spelled out.
- * @stable ICU 54
- */
- UDAT_STYLE_LONG,
-
- /**
- * Abbreviations used when possible.
- * @stable ICU 54
- */
- UDAT_STYLE_SHORT,
-
- /**
- * Use the shortest possible form.
- * @stable ICU 54
- */
- UDAT_STYLE_NARROW,
-
- /**
- * The number of styles.
- * @stable ICU 54
- */
- UDAT_STYLE_COUNT
-} UDateRelativeDateTimeFormatterStyle;
+#if !UCONFIG_NO_FORMATTING
/**
* Represents the unit for formatting a relative date. e.g "in 5 days"
@@ -103,11 +76,13 @@ typedef enum UDateRelativeUnit {
*/
UDAT_RELATIVE_YEARS,
+#ifndef U_HIDE_DEPRECATED_API
/**
- * Count of items in this enum.
- * @stable ICU 53
+ * One more than the highest normal UDateRelativeUnit value.
+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UDAT_RELATIVE_UNIT_COUNT
+#endif // U_HIDE_DEPRECATED_API
} UDateRelativeUnit;
/**
@@ -190,11 +165,13 @@ typedef enum UDateAbsoluteUnit {
*/
UDAT_ABSOLUTE_NOW,
+#ifndef U_HIDE_DEPRECATED_API
/**
- * Count of items in this enum.
- * @stable ICU 53
+ * One more than the highest normal UDateAbsoluteUnit value.
+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UDAT_ABSOLUTE_UNIT_COUNT
+#endif // U_HIDE_DEPRECATED_API
} UDateAbsoluteUnit;
/**
@@ -240,13 +217,16 @@ typedef enum UDateDirection {
*/
UDAT_DIRECTION_PLAIN,
+#ifndef U_HIDE_DEPRECATED_API
/**
- * Count of items in this enum.
- * @stable ICU 53
+ * One more than the highest normal UDateDirection value.
+ * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
UDAT_DIRECTION_COUNT
+#endif // U_HIDE_DEPRECATED_API
} UDateDirection;
+#if !UCONFIG_NO_BREAK_ITERATION
U_NAMESPACE_BEGIN
@@ -434,6 +414,54 @@ 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",
+ * "5 weeks ago", "in 5 weeks".
+ *
+ * @param offset The signed offset for the specified unit. This
+ * will be formatted according to this object's
+ * NumberFormat object.
+ * @param unit The unit to use when formatting the relative
+ * date, e.g. UDAT_REL_UNIT_WEEK,
+ * UDAT_REL_UNIT_FRIDAY.
+ * @param appendTo The string to which the formatted result will be
+ * appended.
+ * @param status ICU error code returned here.
+ * @return appendTo
+ * @draft ICU 57
+ */
+ UnicodeString& formatNumeric(
+ double offset,
+ URelativeDateTimeUnit unit,
+ UnicodeString& appendTo,
+ UErrorCode& status) const;
+
+ /**
+ * Format a combination of URelativeDateTimeUnit and numeric offset
+ * using a text style if possible, e.g. "last week", "this week",
+ * "next week", "yesterday", "tomorrow". Falls back to numeric
+ * style if no appropriate text term is available for the specified
+ * offset in the object's locale.
+ *
+ * @param offset The signed offset for the specified unit.
+ * @param unit The unit to use when formatting the relative
+ * date, e.g. UDAT_REL_UNIT_WEEK,
+ * UDAT_REL_UNIT_FRIDAY.
+ * @param appendTo The string to which the formatted result will be
+ * appended.
+ * @param status ICU error code returned here.
+ * @return appendTo
+ * @draft 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
* locale. This is done with the same date-time separator used for the
@@ -490,5 +518,6 @@ private:
U_NAMESPACE_END
-#endif /* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION*/
-#endif
+#endif /* !UCONFIG_NO_BREAK_ITERATION */
+#endif /* !UCONFIG_NO_FORMATTING */
+#endif /* __RELDATEFMT_H */
« no previous file with comments | « source/i18n/unicode/region.h ('k') | source/i18n/unicode/scientificnumberformatter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698