Linux sagir-us1.hostever.us 5.14.0-570.51.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 8 09:41:34 EDT 2025 x86_64
LiteSpeed
Server IP : 104.247.108.91 & Your IP : 216.73.216.26
Domains : 74 Domain
User : georgeto
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
local /
apps /
icu69 /
include /
unicode /
Delete
Unzip
Name
Size
Permission
Date
Action
alphaindex.h
26.48
KB
-rw-r--r--
2024-02-06 07:47
appendable.h
8.49
KB
-rw-r--r--
2024-02-06 07:47
basictz.h
9.68
KB
-rw-r--r--
2024-02-06 07:47
brkiter.h
27.8
KB
-rw-r--r--
2024-02-06 07:47
bytestream.h
10.73
KB
-rw-r--r--
2024-02-06 07:47
bytestrie.h
20.77
KB
-rw-r--r--
2024-02-06 07:47
bytestriebuilder.h
7.29
KB
-rw-r--r--
2024-02-06 07:47
calendar.h
105.88
KB
-rw-r--r--
2024-02-06 07:47
caniter.h
7.43
KB
-rw-r--r--
2024-02-06 07:47
casemap.h
25.33
KB
-rw-r--r--
2024-02-06 07:47
char16ptr.h
7.22
KB
-rw-r--r--
2024-02-06 07:47
chariter.h
24.05
KB
-rw-r--r--
2024-02-06 07:47
choicfmt.h
23.91
KB
-rw-r--r--
2024-02-06 07:47
coleitr.h
13.76
KB
-rw-r--r--
2024-02-06 07:47
coll.h
56.26
KB
-rw-r--r--
2024-02-06 07:47
compactdecimalformat.h
6.88
KB
-rw-r--r--
2024-02-06 07:47
curramt.h
3.76
KB
-rw-r--r--
2024-02-06 07:47
currpinf.h
7.3
KB
-rw-r--r--
2024-02-06 07:47
currunit.h
4
KB
-rw-r--r--
2024-02-06 07:47
datefmt.h
40.67
KB
-rw-r--r--
2024-02-06 07:47
dbbi.h
1.19
KB
-rw-r--r--
2024-02-06 07:47
dcfmtsym.h
20.42
KB
-rw-r--r--
2024-02-06 07:47
decimfmt.h
87.58
KB
-rw-r--r--
2024-02-06 07:47
docmain.h
7.21
KB
-rw-r--r--
2024-02-06 07:47
dtfmtsym.h
37.73
KB
-rw-r--r--
2024-02-06 07:47
dtintrv.h
3.84
KB
-rw-r--r--
2024-02-06 07:47
dtitvfmt.h
49.29
KB
-rw-r--r--
2024-02-06 07:47
dtitvinf.h
18.62
KB
-rw-r--r--
2024-02-06 07:47
dtptngen.h
26.06
KB
-rw-r--r--
2024-02-06 07:47
dtrule.h
8.68
KB
-rw-r--r--
2024-02-06 07:47
edits.h
20.74
KB
-rw-r--r--
2024-02-06 07:47
enumset.h
2.08
KB
-rw-r--r--
2024-02-06 07:47
errorcode.h
4.84
KB
-rw-r--r--
2024-02-06 07:47
fieldpos.h
8.69
KB
-rw-r--r--
2024-02-06 07:47
filteredbrk.h
5.37
KB
-rw-r--r--
2024-02-06 07:47
fmtable.h
24.42
KB
-rw-r--r--
2024-02-06 07:47
format.h
12.5
KB
-rw-r--r--
2024-02-06 07:47
formattedvalue.h
9.75
KB
-rw-r--r--
2024-02-06 07:47
fpositer.h
3.04
KB
-rw-r--r--
2024-02-06 07:47
gender.h
3.33
KB
-rw-r--r--
2024-02-06 07:47
gregocal.h
31.71
KB
-rw-r--r--
2024-02-06 07:47
icudataver.h
1.02
KB
-rw-r--r--
2024-02-06 07:47
icuplug.h
11.83
KB
-rw-r--r--
2024-02-06 07:47
idna.h
12.7
KB
-rw-r--r--
2024-02-06 07:47
listformatter.h
8.79
KB
-rw-r--r--
2024-02-06 07:47
localebuilder.h
11.23
KB
-rw-r--r--
2024-02-06 07:47
localematcher.h
26.98
KB
-rw-r--r--
2024-02-06 07:47
localpointer.h
19.36
KB
-rw-r--r--
2024-02-06 07:47
locdspnm.h
7.12
KB
-rw-r--r--
2024-02-06 07:47
locid.h
47.65
KB
-rw-r--r--
2024-02-06 07:47
measfmt.h
11.37
KB
-rw-r--r--
2024-02-06 07:47
measunit.h
104.66
KB
-rw-r--r--
2024-02-06 07:47
measure.h
4.32
KB
-rw-r--r--
2024-02-06 07:47
messagepattern.h
33.71
KB
-rw-r--r--
2024-02-06 07:47
msgfmt.h
44.12
KB
-rw-r--r--
2024-02-06 07:47
normalizer2.h
33.66
KB
-rw-r--r--
2024-02-06 07:47
normlzr.h
30.94
KB
-rw-r--r--
2024-02-06 07:47
nounit.h
2.3
KB
-rw-r--r--
2024-02-06 07:47
numberformatter.h
92.23
KB
-rw-r--r--
2024-02-06 07:47
numberrangeformatter.h
25.04
KB
-rw-r--r--
2024-02-06 07:47
numfmt.h
49.77
KB
-rw-r--r--
2024-02-06 07:47
numsys.h
7.32
KB
-rw-r--r--
2024-02-06 07:47
parseerr.h
3.08
KB
-rw-r--r--
2024-02-06 07:47
parsepos.h
5.56
KB
-rw-r--r--
2024-02-06 07:47
platform.h
28.08
KB
-rw-r--r--
2024-02-06 07:47
plurfmt.h
25.18
KB
-rw-r--r--
2024-02-06 07:47
plurrule.h
20.84
KB
-rw-r--r--
2024-02-06 07:47
ptypes.h
3.49
KB
-rw-r--r--
2024-02-06 07:47
putil.h
6.32
KB
-rw-r--r--
2024-02-06 07:47
rbbi.h
27.57
KB
-rw-r--r--
2024-02-06 07:47
rbnf.h
48.73
KB
-rw-r--r--
2024-02-06 07:47
rbtz.h
15.72
KB
-rw-r--r--
2024-02-06 07:47
regex.h
84.34
KB
-rw-r--r--
2024-02-06 07:47
region.h
9.18
KB
-rw-r--r--
2024-02-06 07:47
reldatefmt.h
22.22
KB
-rw-r--r--
2024-02-06 07:47
rep.h
9.37
KB
-rw-r--r--
2024-02-06 07:47
resbund.h
18.07
KB
-rw-r--r--
2024-02-06 07:47
schriter.h
6.32
KB
-rw-r--r--
2024-02-06 07:47
scientificnumberformatter.h
6.4
KB
-rw-r--r--
2024-02-06 07:47
search.h
22.22
KB
-rw-r--r--
2024-02-06 07:47
selfmt.h
14.3
KB
-rw-r--r--
2024-02-06 07:47
simpleformatter.h
12.59
KB
-rw-r--r--
2024-02-06 07:47
simpletz.h
45.55
KB
-rw-r--r--
2024-02-06 07:47
smpdtfmt.h
71
KB
-rw-r--r--
2024-02-06 07:47
sortkey.h
11.18
KB
-rw-r--r--
2024-02-06 07:47
std_string.h
1.05
KB
-rw-r--r--
2024-02-06 07:47
strenum.h
9.92
KB
-rw-r--r--
2024-02-06 07:47
stringoptions.h
5.79
KB
-rw-r--r--
2024-02-06 07:47
stringpiece.h
10.05
KB
-rw-r--r--
2024-02-06 07:47
stringtriebuilder.h
15.33
KB
-rw-r--r--
2024-02-06 07:47
stsearch.h
21.3
KB
-rw-r--r--
2024-02-06 07:47
symtable.h
4.27
KB
-rw-r--r--
2024-02-06 07:47
tblcoll.h
36.65
KB
-rw-r--r--
2024-02-06 07:47
timezone.h
41.52
KB
-rw-r--r--
2024-02-06 07:47
tmunit.h
3.38
KB
-rw-r--r--
2024-02-06 07:47
tmutamt.h
4.9
KB
-rw-r--r--
2024-02-06 07:47
tmutfmt.h
7.85
KB
-rw-r--r--
2024-02-06 07:47
translit.h
65.81
KB
-rw-r--r--
2024-02-06 07:47
tzfmt.h
42.89
KB
-rw-r--r--
2024-02-06 07:47
tznames.h
16.85
KB
-rw-r--r--
2024-02-06 07:47
tzrule.h
35.37
KB
-rw-r--r--
2024-02-06 07:47
tztrans.h
6.12
KB
-rw-r--r--
2024-02-06 07:47
ubidi.h
89.54
KB
-rw-r--r--
2024-02-06 07:47
ubiditransform.h
12.7
KB
-rw-r--r--
2024-02-06 07:47
ubrk.h
24.45
KB
-rw-r--r--
2024-02-06 07:47
ucal.h
61
KB
-rw-r--r--
2024-02-06 07:47
ucasemap.h
15.21
KB
-rw-r--r--
2024-02-06 07:47
ucat.h
5.35
KB
-rw-r--r--
2024-02-06 07:47
uchar.h
141.13
KB
-rw-r--r--
2024-02-06 07:47
ucharstrie.h
22.53
KB
-rw-r--r--
2024-02-06 07:47
ucharstriebuilder.h
7.3
KB
-rw-r--r--
2024-02-06 07:47
uchriter.h
13.2
KB
-rw-r--r--
2024-02-06 07:47
uclean.h
11.2
KB
-rw-r--r--
2024-02-06 07:47
ucnv.h
83.04
KB
-rw-r--r--
2024-02-06 07:47
ucnv_cb.h
6.58
KB
-rw-r--r--
2024-02-06 07:47
ucnv_err.h
20.97
KB
-rw-r--r--
2024-02-06 07:47
ucnvsel.h
6.19
KB
-rw-r--r--
2024-02-06 07:47
ucol.h
61.51
KB
-rw-r--r--
2024-02-06 07:47
ucoleitr.h
9.82
KB
-rw-r--r--
2024-02-06 07:47
uconfig.h
12.07
KB
-rw-r--r--
2024-02-06 07:47
ucpmap.h
5.53
KB
-rw-r--r--
2024-02-06 07:47
ucptrie.h
22.51
KB
-rw-r--r--
2024-02-06 07:47
ucsdet.h
14.69
KB
-rw-r--r--
2024-02-06 07:47
ucurr.h
16.77
KB
-rw-r--r--
2024-02-06 07:47
udat.h
62.11
KB
-rw-r--r--
2024-02-06 07:47
udata.h
15.62
KB
-rw-r--r--
2024-02-06 07:47
udateintervalformat.h
11.98
KB
-rw-r--r--
2024-02-06 07:47
udatpg.h
26.76
KB
-rw-r--r--
2024-02-06 07:47
udisplaycontext.h
5.94
KB
-rw-r--r--
2024-02-06 07:47
uenum.h
7.79
KB
-rw-r--r--
2024-02-06 07:47
ufieldpositer.h
4.41
KB
-rw-r--r--
2024-02-06 07:47
uformattable.h
10.97
KB
-rw-r--r--
2024-02-06 07:47
uformattedvalue.h
12.3
KB
-rw-r--r--
2024-02-06 07:47
ugender.h
2.06
KB
-rw-r--r--
2024-02-06 07:47
uidna.h
33.43
KB
-rw-r--r--
2024-02-06 07:47
uiter.h
22.75
KB
-rw-r--r--
2024-02-06 07:47
uldnames.h
10.48
KB
-rw-r--r--
2024-02-06 07:47
ulistformatter.h
10.78
KB
-rw-r--r--
2024-02-06 07:47
uloc.h
54.6
KB
-rw-r--r--
2024-02-06 07:47
ulocdata.h
11.3
KB
-rw-r--r--
2024-02-06 07:47
umachine.h
16.05
KB
-rw-r--r--
2024-02-06 07:47
umisc.h
1.33
KB
-rw-r--r--
2024-02-06 07:47
umsg.h
24.25
KB
-rw-r--r--
2024-02-06 07:47
umutablecptrie.h
8.29
KB
-rw-r--r--
2024-02-06 07:47
unifilt.h
3.96
KB
-rw-r--r--
2024-02-06 07:47
unifunct.h
4.04
KB
-rw-r--r--
2024-02-06 07:47
unimatch.h
6.1
KB
-rw-r--r--
2024-02-06 07:47
unirepl.h
3.38
KB
-rw-r--r--
2024-02-06 07:47
uniset.h
65.04
KB
-rw-r--r--
2024-02-06 07:47
unistr.h
170.46
KB
-rw-r--r--
2024-02-06 07:47
unorm.h
20.52
KB
-rw-r--r--
2024-02-06 07:47
unorm2.h
24.68
KB
-rw-r--r--
2024-02-06 07:47
unum.h
54.88
KB
-rw-r--r--
2024-02-06 07:47
unumberformatter.h
30.55
KB
-rw-r--r--
2024-02-06 07:47
unumberrangeformatter.h
15.38
KB
-rw-r--r--
2024-02-06 07:47
unumsys.h
7.26
KB
-rw-r--r--
2024-02-06 07:47
uobject.h
10.68
KB
-rw-r--r--
2024-02-06 07:47
upluralrules.h
8.8
KB
-rw-r--r--
2024-02-06 07:47
uregex.h
71.99
KB
-rw-r--r--
2024-02-06 07:47
uregion.h
9.81
KB
-rw-r--r--
2024-02-06 07:47
ureldatefmt.h
17.04
KB
-rw-r--r--
2024-02-06 07:47
urename.h
133.97
KB
-rw-r--r--
2024-02-06 07:47
urep.h
5.38
KB
-rw-r--r--
2024-02-06 07:47
ures.h
36.54
KB
-rw-r--r--
2024-02-06 07:47
uscript.h
27.19
KB
-rw-r--r--
2024-02-06 07:47
usearch.h
39.07
KB
-rw-r--r--
2024-02-06 07:47
uset.h
42.59
KB
-rw-r--r--
2024-02-06 07:47
usetiter.h
9.55
KB
-rw-r--r--
2024-02-06 07:47
ushape.h
18
KB
-rw-r--r--
2024-02-06 07:47
uspoof.h
65.84
KB
-rw-r--r--
2024-02-06 07:47
usprep.h
8.19
KB
-rw-r--r--
2024-02-06 07:47
ustdio.h
38.55
KB
-rw-r--r--
2024-02-06 07:47
ustream.h
1.89
KB
-rw-r--r--
2024-02-06 07:47
ustring.h
72.35
KB
-rw-r--r--
2024-02-06 07:47
ustringtrie.h
3.15
KB
-rw-r--r--
2024-02-06 07:47
utext.h
58.08
KB
-rw-r--r--
2024-02-06 07:47
utf.h
7.87
KB
-rw-r--r--
2024-02-06 07:47
utf16.h
23.35
KB
-rw-r--r--
2024-02-06 07:47
utf32.h
763
B
-rw-r--r--
2024-02-06 07:47
utf8.h
30.83
KB
-rw-r--r--
2024-02-06 07:47
utf_old.h
45.83
KB
-rw-r--r--
2024-02-06 07:47
utmscale.h
13.78
KB
-rw-r--r--
2024-02-06 07:47
utrace.h
17.18
KB
-rw-r--r--
2024-02-06 07:47
utrans.h
25.54
KB
-rw-r--r--
2024-02-06 07:47
utypes.h
31.06
KB
-rw-r--r--
2024-02-06 07:47
uvernum.h
6.68
KB
-rw-r--r--
2024-02-06 07:47
uversion.h
5.99
KB
-rw-r--r--
2024-02-06 07:47
vtzone.h
20.67
KB
-rw-r--r--
2024-02-06 07:47
Save
Rename
// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ***************************************************************************** * Copyright (C) 2014-2016, International Business Machines Corporation and * others. * All Rights Reserved. ***************************************************************************** * * File RELDATEFMT.H ***************************************************************************** */ #ifndef __RELDATEFMT_H #define __RELDATEFMT_H #include "unicode/utypes.h" #if U_SHOW_CPLUSPLUS_API #include "unicode/uobject.h" #include "unicode/udisplaycontext.h" #include "unicode/ureldatefmt.h" #include "unicode/locid.h" #include "unicode/formattedvalue.h" /** * \file * \brief C++ API: Formats relative dates such as "1 day ago" or "tomorrow" */ #if !UCONFIG_NO_FORMATTING /** * Represents the unit for formatting a relative date. e.g "in 5 days" * or "in 3 months" * @stable ICU 53 */ typedef enum UDateRelativeUnit { /** * Seconds * @stable ICU 53 */ UDAT_RELATIVE_SECONDS, /** * Minutes * @stable ICU 53 */ UDAT_RELATIVE_MINUTES, /** * Hours * @stable ICU 53 */ UDAT_RELATIVE_HOURS, /** * Days * @stable ICU 53 */ UDAT_RELATIVE_DAYS, /** * Weeks * @stable ICU 53 */ UDAT_RELATIVE_WEEKS, /** * Months * @stable ICU 53 */ UDAT_RELATIVE_MONTHS, /** * Years * @stable ICU 53 */ UDAT_RELATIVE_YEARS, #ifndef U_HIDE_DEPRECATED_API /** * 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; /** * Represents an absolute unit. * @stable ICU 53 */ typedef enum UDateAbsoluteUnit { // Days of week have to remain together and in order from Sunday to // Saturday. /** * Sunday * @stable ICU 53 */ UDAT_ABSOLUTE_SUNDAY, /** * Monday * @stable ICU 53 */ UDAT_ABSOLUTE_MONDAY, /** * Tuesday * @stable ICU 53 */ UDAT_ABSOLUTE_TUESDAY, /** * Wednesday * @stable ICU 53 */ UDAT_ABSOLUTE_WEDNESDAY, /** * Thursday * @stable ICU 53 */ UDAT_ABSOLUTE_THURSDAY, /** * Friday * @stable ICU 53 */ UDAT_ABSOLUTE_FRIDAY, /** * Saturday * @stable ICU 53 */ UDAT_ABSOLUTE_SATURDAY, /** * Day * @stable ICU 53 */ UDAT_ABSOLUTE_DAY, /** * Week * @stable ICU 53 */ UDAT_ABSOLUTE_WEEK, /** * Month * @stable ICU 53 */ UDAT_ABSOLUTE_MONTH, /** * Year * @stable ICU 53 */ UDAT_ABSOLUTE_YEAR, /** * Now * @stable ICU 53 */ UDAT_ABSOLUTE_NOW, /** * Quarter * @stable ICU 63 */ UDAT_ABSOLUTE_QUARTER, /** * Hour * @stable ICU 65 */ UDAT_ABSOLUTE_HOUR, /** * Minute * @stable ICU 65 */ UDAT_ABSOLUTE_MINUTE, #ifndef U_HIDE_DEPRECATED_API /** * 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 = UDAT_ABSOLUTE_NOW + 4 #endif // U_HIDE_DEPRECATED_API } UDateAbsoluteUnit; /** * Represents a direction for an absolute unit e.g "Next Tuesday" * or "Last Tuesday" * @stable ICU 53 */ typedef enum UDateDirection { /** * Two before. Not fully supported in every locale. * @stable ICU 53 */ UDAT_DIRECTION_LAST_2, /** * Last * @stable ICU 53 */ UDAT_DIRECTION_LAST, /** * This * @stable ICU 53 */ UDAT_DIRECTION_THIS, /** * Next * @stable ICU 53 */ UDAT_DIRECTION_NEXT, /** * Two after. Not fully supported in every locale. * @stable ICU 53 */ UDAT_DIRECTION_NEXT_2, /** * Plain, which means the absence of a qualifier. * @stable ICU 53 */ UDAT_DIRECTION_PLAIN, #ifndef U_HIDE_DEPRECATED_API /** * 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 class BreakIterator; class RelativeDateTimeCacheData; class SharedNumberFormat; class SharedPluralRules; class SharedBreakIterator; class NumberFormat; class UnicodeString; class FormattedRelativeDateTime; class FormattedRelativeDateTimeData; /** * An immutable class containing the result of a relative datetime formatting operation. * * Instances of this class are immutable and thread-safe. * * Not intended for public subclassing. * * @stable ICU 64 */ class U_I18N_API FormattedRelativeDateTime : public UMemory, public FormattedValue { public: /** * Default constructor; makes an empty FormattedRelativeDateTime. * @stable ICU 64 */ FormattedRelativeDateTime() : fData(nullptr), fErrorCode(U_INVALID_STATE_ERROR) {} /** * Move constructor: Leaves the source FormattedRelativeDateTime in an undefined state. * @stable ICU 64 */ FormattedRelativeDateTime(FormattedRelativeDateTime&& src) U_NOEXCEPT; /** * Destruct an instance of FormattedRelativeDateTime. * @stable ICU 64 */ virtual ~FormattedRelativeDateTime() U_OVERRIDE; /** Copying not supported; use move constructor instead. */ FormattedRelativeDateTime(const FormattedRelativeDateTime&) = delete; /** Copying not supported; use move assignment instead. */ FormattedRelativeDateTime& operator=(const FormattedRelativeDateTime&) = delete; /** * Move assignment: Leaves the source FormattedRelativeDateTime in an undefined state. * @stable ICU 64 */ FormattedRelativeDateTime& operator=(FormattedRelativeDateTime&& src) U_NOEXCEPT; /** @copydoc FormattedValue::toString() */ UnicodeString toString(UErrorCode& status) const U_OVERRIDE; /** @copydoc FormattedValue::toTempString() */ UnicodeString toTempString(UErrorCode& status) const U_OVERRIDE; /** @copydoc FormattedValue::appendTo() */ Appendable &appendTo(Appendable& appendable, UErrorCode& status) const U_OVERRIDE; /** @copydoc FormattedValue::nextPosition() */ UBool nextPosition(ConstrainedFieldPosition& cfpos, UErrorCode& status) const U_OVERRIDE; private: FormattedRelativeDateTimeData *fData; UErrorCode fErrorCode; explicit FormattedRelativeDateTime(FormattedRelativeDateTimeData *results) : fData(results), fErrorCode(U_ZERO_ERROR) {} explicit FormattedRelativeDateTime(UErrorCode errorCode) : fData(nullptr), fErrorCode(errorCode) {} friend class RelativeDateTimeFormatter; }; /** * Formats simple relative dates. There are two types of relative dates that * it handles: * <ul> * <li>relative dates with a quantity e.g "in 5 days"</li> * <li>relative dates without a quantity e.g "next Tuesday"</li> * </ul> * <p> * This API is very basic and is intended to be a building block for more * fancy APIs. The caller tells it exactly what to display in a locale * independent way. While this class automatically provides the correct plural * forms, the grammatical form is otherwise as neutral as possible. It is the * caller's responsibility to handle cut-off logic such as deciding between * displaying "in 7 days" or "in 1 week." This API supports relative dates * involving one single unit. This API does not support relative dates * involving compound units, * e.g "in 5 days and 4 hours" nor does it support parsing. * <p> * This class is mostly thread safe and immutable with the following caveats: * 1. The assignment operator violates Immutability. It must not be used * concurrently with other operations. * 2. Caller must not hold onto adopted pointers. * <p> * This class is not intended for public subclassing. * <p> * Here are some examples of use: * <blockquote> * <pre> * UErrorCode status = U_ZERO_ERROR; * UnicodeString appendTo; * RelativeDateTimeFormatter fmt(status); * // Appends "in 1 day" * fmt.format( * 1, UDAT_DIRECTION_NEXT, UDAT_RELATIVE_DAYS, appendTo, status); * // Appends "in 3 days" * fmt.format( * 3, UDAT_DIRECTION_NEXT, UDAT_RELATIVE_DAYS, appendTo, status); * // Appends "3.2 years ago" * fmt.format( * 3.2, UDAT_DIRECTION_LAST, UDAT_RELATIVE_YEARS, appendTo, status); * // Appends "last Sunday" * fmt.format(UDAT_DIRECTION_LAST, UDAT_ABSOLUTE_SUNDAY, appendTo, status); * // Appends "this Sunday" * fmt.format(UDAT_DIRECTION_THIS, UDAT_ABSOLUTE_SUNDAY, appendTo, status); * // Appends "next Sunday" * fmt.format(UDAT_DIRECTION_NEXT, UDAT_ABSOLUTE_SUNDAY, appendTo, status); * // Appends "Sunday" * fmt.format(UDAT_DIRECTION_PLAIN, UDAT_ABSOLUTE_SUNDAY, appendTo, status); * * // Appends "yesterday" * fmt.format(UDAT_DIRECTION_LAST, UDAT_ABSOLUTE_DAY, appendTo, status); * // Appends "today" * fmt.format(UDAT_DIRECTION_THIS, UDAT_ABSOLUTE_DAY, appendTo, status); * // Appends "tomorrow" * fmt.format(UDAT_DIRECTION_NEXT, UDAT_ABSOLUTE_DAY, appendTo, status); * // Appends "now" * fmt.format(UDAT_DIRECTION_PLAIN, UDAT_ABSOLUTE_NOW, appendTo, status); * * </pre> * </blockquote> * <p> * In the future, we may add more forms, such as abbreviated/short forms * (3 secs ago), and relative day periods ("yesterday afternoon"), etc. * * The RelativeDateTimeFormatter class is not intended for public subclassing. * * @stable ICU 53 */ class U_I18N_API RelativeDateTimeFormatter : public UObject { public: /** * Create RelativeDateTimeFormatter with default locale. * @stable ICU 53 */ RelativeDateTimeFormatter(UErrorCode& status); /** * Create RelativeDateTimeFormatter with given locale. * @stable ICU 53 */ RelativeDateTimeFormatter(const Locale& locale, UErrorCode& status); /** * Create RelativeDateTimeFormatter with given locale and NumberFormat. * * @param locale the locale * @param nfToAdopt Constructed object takes ownership of this pointer. * It is an error for caller to delete this pointer or change its * contents after calling this constructor. * @param status Any error is returned here. * @stable ICU 53 */ RelativeDateTimeFormatter( const Locale& locale, NumberFormat *nfToAdopt, UErrorCode& status); /** * Create RelativeDateTimeFormatter with given locale, NumberFormat, * and capitalization context. * * @param locale the locale * @param nfToAdopt Constructed object takes ownership of this pointer. * It is an error for caller to delete this pointer or change its * contents after calling this constructor. Caller may pass NULL for * this argument if they want default number format behavior. * @param style the format style. The UDAT_RELATIVE bit field has no effect. * @param capitalizationContext A value from UDisplayContext that pertains to * capitalization. * @param status Any error is returned here. * @stable ICU 54 */ RelativeDateTimeFormatter( const Locale& locale, NumberFormat *nfToAdopt, UDateRelativeDateTimeFormatterStyle style, UDisplayContext capitalizationContext, UErrorCode& status); /** * Copy constructor. * @stable ICU 53 */ RelativeDateTimeFormatter(const RelativeDateTimeFormatter& other); /** * Assignment operator. * @stable ICU 53 */ RelativeDateTimeFormatter& operator=( const RelativeDateTimeFormatter& other); /** * Destructor. * @stable ICU 53 */ virtual ~RelativeDateTimeFormatter(); /** * Formats a relative date with a quantity such as "in 5 days" or * "3 months ago" * * This method returns a String. To get more information about the * formatting result, use formatToValue(). * * @param quantity The numerical amount e.g 5. This value is formatted * according to this object's NumberFormat object. * @param direction NEXT means a future relative date; LAST means a past * relative date. If direction is anything else, this method sets * status to U_ILLEGAL_ARGUMENT_ERROR. * @param unit the unit e.g day? month? year? * @param appendTo The string to which the formatted result will be * appended * @param status ICU error code returned here. * @return appendTo * @stable ICU 53 */ UnicodeString& format( double quantity, UDateDirection direction, UDateRelativeUnit unit, UnicodeString& appendTo, UErrorCode& status) const; /** * Formats a relative date with a quantity such as "in 5 days" or * "3 months ago" * * This method returns a FormattedRelativeDateTime, which exposes more * information than the String returned by format(). * * @param quantity The numerical amount e.g 5. This value is formatted * according to this object's NumberFormat object. * @param direction NEXT means a future relative date; LAST means a past * relative date. If direction is anything else, this method sets * status to U_ILLEGAL_ARGUMENT_ERROR. * @param unit the unit e.g day? month? year? * @param status ICU error code returned here. * @return The formatted relative datetime * @stable ICU 64 */ FormattedRelativeDateTime formatToValue( double quantity, UDateDirection direction, UDateRelativeUnit unit, UErrorCode& status) const; /** * Formats a relative date without a quantity. * * This method returns a String. To get more information about the * formatting result, use formatToValue(). * * @param direction NEXT, LAST, THIS, etc. * @param unit e.g SATURDAY, DAY, MONTH * @param appendTo The string to which the formatted result will be * appended. If the value of direction is documented as not being fully * supported in all locales then this method leaves appendTo unchanged if * no format string is available. * @param status ICU error code returned here. * @return appendTo * @stable ICU 53 */ UnicodeString& format( UDateDirection direction, UDateAbsoluteUnit unit, UnicodeString& appendTo, UErrorCode& status) const; /** * Formats a relative date without a quantity. * * This method returns a FormattedRelativeDateTime, which exposes more * information than the String returned by format(). * * If the string is not available in the requested locale, the return * value will be empty (calling toString will give an empty string). * * @param direction NEXT, LAST, THIS, etc. * @param unit e.g SATURDAY, DAY, MONTH * @param status ICU error code returned here. * @return The formatted relative datetime * @stable ICU 64 */ FormattedRelativeDateTime formatToValue( UDateDirection direction, UDateAbsoluteUnit unit, UErrorCode& status) const; /** * 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". * * This method returns a String. To get more information about the * formatting result, use formatNumericToValue(). * * @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 * @stable ICU 57 */ UnicodeString& formatNumeric( double offset, URelativeDateTimeUnit unit, UnicodeString& appendTo, UErrorCode& status) const; /** * 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". * * This method returns a FormattedRelativeDateTime, which exposes more * information than the String returned by formatNumeric(). * * @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 status ICU error code returned here. * @return The formatted relative datetime * @stable ICU 64 */ FormattedRelativeDateTime formatNumericToValue( double offset, URelativeDateTimeUnit unit, 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. * * This method returns a String. To get more information about the * formatting result, use formatToValue(). * * @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 * @stable ICU 57 */ UnicodeString& format( 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. * * This method returns a FormattedRelativeDateTime, which exposes more * information than the String returned by format(). * * @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 status ICU error code returned here. * @return The formatted relative datetime * @stable ICU 64 */ FormattedRelativeDateTime formatToValue( double offset, URelativeDateTimeUnit unit, UErrorCode& status) const; /** * 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 * default calendar in this locale. * * @param relativeDateString the relative date, e.g 'yesterday' * @param timeString the time e.g '3:45' * @param appendTo concatenated date and time appended here * @param status ICU error code returned here. * @return appendTo * @stable ICU 53 */ UnicodeString& combineDateAndTime( const UnicodeString& relativeDateString, const UnicodeString& timeString, UnicodeString& appendTo, UErrorCode& status) const; /** * Returns the NumberFormat this object is using. * * @stable ICU 53 */ const NumberFormat& getNumberFormat() const; /** * Returns the capitalization context. * * @stable ICU 54 */ UDisplayContext getCapitalizationContext() const; /** * Returns the format style. * * @stable ICU 54 */ UDateRelativeDateTimeFormatterStyle getFormatStyle() const; private: const RelativeDateTimeCacheData* fCache; const SharedNumberFormat *fNumberFormat; const SharedPluralRules *fPluralRules; UDateRelativeDateTimeFormatterStyle fStyle; UDisplayContext fContext; const SharedBreakIterator *fOptBreakIterator; Locale fLocale; void init( NumberFormat *nfToAdopt, BreakIterator *brkIter, UErrorCode &status); UnicodeString& adjustForContext(UnicodeString &) const; UBool checkNoAdjustForContext(UErrorCode& status) const; template<typename F, typename... Args> UnicodeString& doFormat( F callback, UnicodeString& appendTo, UErrorCode& status, Args... args) const; template<typename F, typename... Args> FormattedRelativeDateTime doFormatToValue( F callback, UErrorCode& status, Args... args) const; void formatImpl( double quantity, UDateDirection direction, UDateRelativeUnit unit, FormattedRelativeDateTimeData& output, UErrorCode& status) const; void formatAbsoluteImpl( UDateDirection direction, UDateAbsoluteUnit unit, FormattedRelativeDateTimeData& output, UErrorCode& status) const; void formatNumericImpl( double offset, URelativeDateTimeUnit unit, FormattedRelativeDateTimeData& output, UErrorCode& status) const; void formatRelativeImpl( double offset, URelativeDateTimeUnit unit, FormattedRelativeDateTimeData& output, UErrorCode& status) const; }; U_NAMESPACE_END #endif /* !UCONFIG_NO_BREAK_ITERATION */ #endif /* !UCONFIG_NO_FORMATTING */ #endif /* U_SHOW_CPLUSPLUS_API */ #endif /* __RELDATEFMT_H */