ICU 69.1  69.1
basictz.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 * Copyright (C) 2007-2013, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 *******************************************************************************
8 */
9 #ifndef BASICTZ_H
10 #define BASICTZ_H
11 
17 #include "unicode/utypes.h"
18 
19 #if U_SHOW_CPLUSPLUS_API
20 
21 #if !UCONFIG_NO_FORMATTING
22 
23 #include "unicode/timezone.h"
24 #include "unicode/tzrule.h"
25 #include "unicode/tztrans.h"
26 
27 U_NAMESPACE_BEGIN
28 
29 // forward declarations
30 class UVector;
31 
39 public:
44  virtual ~BasicTimeZone();
45 
52  virtual BasicTimeZone* clone() const = 0;
53 
62  virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0;
63 
72  virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0;
73 
94  virtual UBool hasEquivalentTransitions(const BasicTimeZone& tz, UDate start, UDate end,
95  UBool ignoreDstAmount, UErrorCode& ec) const;
96 
105  virtual int32_t countTransitionRules(UErrorCode& status) const = 0;
106 
123  virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
124  const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const = 0;
125 
152  virtual void getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
153  AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) const;
154 
155 #ifndef U_FORCE_HIDE_DRAFT_API
156 
160  virtual void getOffsetFromLocal(
161  UDate date, UTimeZoneLocalOption nonExistingTimeOpt,
162  UTimeZoneLocalOption duplicatedTimeOpt, int32_t& rawOffset,
163  int32_t& dstOffset, UErrorCode& status) const;
164 
165 #endif /* U_FORCE_HIDE_DRAFT_API */
166 
167 #ifndef U_HIDE_INTERNAL_API
168 
172  enum {
173  kStandard = 0x01,
174  kDaylight = 0x03,
175  kFormer = 0x04, /* UCAL_TZ_LOCAL_FORMER */
176  kLatter = 0x0C /* UCAL_TZ_LOCAL_LATTER */
177  };
178 
183  void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
184  int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const;
185 #endif /* U_HIDE_INTERNAL_API */
186 
187 protected:
188 
189 #ifndef U_HIDE_INTERNAL_API
190 
194  enum {
195  kStdDstMask = kDaylight,
196  kFormerLatterMask = kLatter
197  };
198 #endif /* U_HIDE_INTERNAL_API */
199 
204  BasicTimeZone();
205 
211  BasicTimeZone(const UnicodeString &id);
212 
218  BasicTimeZone(const BasicTimeZone& source);
219 
224  BasicTimeZone& operator=(const BasicTimeZone&) = default;
225 
233  void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, UVector*& transitionRules,
234  UErrorCode& status) const;
235 };
236 
237 U_NAMESPACE_END
238 
239 #endif /* #if !UCONFIG_NO_FORMATTING */
240 
241 #endif /* U_SHOW_CPLUSPLUS_API */
242 
243 #endif // BASICTZ_H
244 
245 //eof
UTimeZoneLocalOption
Options used by ucal_getTimeZoneOffsetFromLocal and BasicTimeZone::getOffsetFromLocal() to specify ho...
Definition: ucal.h:1627
TimeZone & operator=(const TimeZone &right)
Default assignment operator.
C++ API: TimeZone object.
double UDate
Date and Time data type.
Definition: utypes.h:203
TimeZone represents a time zone offset, and also figures out daylight savings.
Definition: timezone.h:133
C++ API: Time zone transition.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:301
TimeZoneRule is a class representing a rule for time zone.
Definition: tzrule.h:36
InitialTimeZoneRule represents a time zone rule representing a time zone effective from the beginning...
Definition: tzrule.h:202
virtual TimeZone * clone() const =0
Clones TimeZone objects polymorphically.
TimeZoneTransition is a class representing a time zone transition.
Definition: tztrans.h:35
C++ API: Time zone rule classes.
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:38
AnnualTimeZoneRule is a class used for representing a time zone rule which takes effect annually...
Definition: tzrule.h:380
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
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:295
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269