ICU 53.1  53.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
reldatefmt.h
Go to the documentation of this file.
1 /*
2 *****************************************************************************
3 * Copyright (C) 2014, International Business Machines Corporation and
4 * others.
5 * All Rights Reserved.
6 *****************************************************************************
7 *
8 * File RELDATEFMT.H
9 *****************************************************************************
10 */
11 
12 #ifndef __RELDATEFMT_H
13 #define __RELDATEFMT_H
14 
15 #include "unicode/utypes.h"
16 
22 #if !UCONFIG_NO_FORMATTING
23 
24 #include "unicode/locid.h"
25 
26 #ifndef U_HIDE_DRAFT_API
27 
33 typedef enum UDateRelativeUnit {
34 
40 
46 
52 
58 
64 
70 
76 
83 
88 typedef enum UDateAbsoluteUnit {
89 
90  // Days of week have to remain together and in order from Sunday to
91  // Saturday.
97 
103 
109 
115 
121 
127 
133 
139 
145 
151 
157 
163 
170 
176 typedef enum UDateDirection {
177 
183 
189 
195 
201 
207 
213 
220 
221 
223 
224 class RelativeDateTimeCacheData;
225 class SharedNumberFormat;
226 class SharedPluralRules;
227 class NumberFormat;
228 
300 public:
301 
307 
312  RelativeDateTimeFormatter(const Locale& locale, UErrorCode& status);
313 
325  const Locale& locale, NumberFormat *nfToAdopt, UErrorCode& status);
326 
332 
337  RelativeDateTimeFormatter& operator=(
338  const RelativeDateTimeFormatter& other);
339 
344  virtual ~RelativeDateTimeFormatter();
345 
361  UnicodeString& format(
362  double quantity,
363  UDateDirection direction,
364  UDateRelativeUnit unit,
365  UnicodeString& appendTo,
366  UErrorCode& status) const;
367 
380  UnicodeString& format(
381  UDateDirection direction,
382  UDateAbsoluteUnit unit,
383  UnicodeString& appendTo,
384  UErrorCode& status) const;
385 
398  UnicodeString& combineDateAndTime(
399  const UnicodeString& relativeDateString,
400  const UnicodeString& timeString,
401  UnicodeString& appendTo,
402  UErrorCode& status) const;
403 
409  const NumberFormat& getNumberFormat() const;
410 
411 private:
412  const RelativeDateTimeCacheData* cache;
413  const SharedNumberFormat *numberFormat;
414  const SharedPluralRules *pluralRules;
415  void init(const Locale &, NumberFormat *nfToAdopt, UErrorCode &status);
416 };
417 
419 
420 #endif /* U_HIDE_DRAFT_API */
421 
422 #endif /* !UCONFIG_NO_FORMATTING */
423 #endif
Count of items in this enum.
Definition: reldatefmt.h:168
Abstract base class for all number formats.
Definition: numfmt.h:172
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:358
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
UDateDirection
Represents a direction for an absolute unit e.g "Next Tuesday" or "Last Tuesday". ...
Definition: reldatefmt.h:176
Plain, which means the absence of a qualifier.
Definition: reldatefmt.h:212
Formats simple relative dates.
Definition: reldatefmt.h:299
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
Count of items in this enum.
Definition: reldatefmt.h:218
UDateAbsoluteUnit
Represents an absolute unit.
Definition: reldatefmt.h:88
C++ API: Locale ID object.
Basic definitions for ICU, for both C and C++ APIs.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:245
Count of items in this enum.
Definition: reldatefmt.h:81
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
UDateRelativeUnit
Represents the unit for formatting a relative date.
Definition: reldatefmt.h:33
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:185