• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 *******************************************************************************
3 * Copyright (C) 2011, International Business Machines Corporation and         *
4 * others. All Rights Reserved.                                                *
5 *******************************************************************************
6 */
7 #ifndef __TZFMT_H
8 #define __TZFMT_H
9 
10 #include "unicode/utypes.h"
11 
12 #if !UCONFIG_NO_FORMATTING
13 
14 #include "unicode/uobject.h"
15 #include "unicode/uloc.h"
16 #include "unicode/unistr.h"
17 #include "unicode/format.h"
18 #include "unicode/timezone.h"
19 #include "tznames.h"
20 
21 U_CDECL_BEGIN
22 
23 typedef enum UTimeZoneFormatStyle {
24     UTZFMT_STYLE_LOCATION,
25     UTZFMT_STYLE_GENERIC_LONG,
26     UTZFMT_STYLE_GENERIC_SHORT,
27     UTZFMT_STYLE_SPECIFIC_LONG,
28     UTZFMT_STYLE_SPECIFIC_SHORT,
29     UTZFMT_STYLE_SPECIFIC_SHORT_COMMONLY_USED
30 } UTimeZoneFormatStyle;
31 
32 typedef enum UTimeZoneTimeType {
33     UTZFMT_TIME_TYPE_UNKNOWN,
34     UTZFMT_TIME_TYPE_STANDARD,
35     UTZFMT_TIME_TYPE_DAYLIGHT
36 } UTimeZoneTimeType;
37 
38 U_CDECL_END
39 
40 U_NAMESPACE_BEGIN
41 
42 class TimeZoneNames;
43 
44 class U_I18N_API TimeZoneFormat : public UMemory {
45 public:
46     virtual ~TimeZoneFormat();
47 
48     static TimeZoneFormat* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status);
49 
50     virtual const TimeZoneNames* getTimeZoneNames() const = 0;
51 
52     virtual UnicodeString& format(UTimeZoneFormatStyle style, const TimeZone& tz, UDate date,
53         UnicodeString& name, UTimeZoneTimeType* timeType = NULL) const = 0;
54 
55     virtual UnicodeString& parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos,
56         UnicodeString& tzID, UTimeZoneTimeType* timeType = NULL) const = 0;
57 
58     TimeZone* parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos,
59         UTimeZoneTimeType* timeType = NULL) const;
60 };
61 
62 U_NAMESPACE_END
63 
64 #endif
65 #endif
66