ICU 67.1  67.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 
156 #ifndef U_HIDE_INTERNAL_API
161  enum {
162  kStandard = 0x01,
163  kDaylight = 0x03,
164  kFormer = 0x04,
165  kLatter = 0x0C
166  };
167 #endif /* U_HIDE_INTERNAL_API */
168 
173  virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
174  int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const;
175 
176 protected:
177 
178 #ifndef U_HIDE_INTERNAL_API
183  enum {
184  kStdDstMask = kDaylight,
185  kFormerLatterMask = kLatter
186  };
187 #endif /* U_HIDE_INTERNAL_API */
188 
194 
201 
207  BasicTimeZone(const BasicTimeZone& source);
208 
214 
222  void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, UVector*& transitionRules,
223  UErrorCode& status) const;
224 };
225 
226 U_NAMESPACE_END
227 
228 #endif /* #if !UCONFIG_NO_FORMATTING */
229 
230 #endif /* U_SHOW_CPLUSPLUS_API */
231 
232 #endif // BASICTZ_H
233 
234 //eof
AnnualTimeZoneRule is a class used for representing a time zone rule which takes effect annually.
Definition: tzrule.h:380
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:38
virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, int32_t &rawOffset, int32_t &dstOffset, UErrorCode &status) const
Get time zone offsets from local wall time.
BasicTimeZone(const UnicodeString &id)
Construct a timezone with a given ID.
void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule *&initial, UVector *&transitionRules, UErrorCode &status) const
Gets the set of TimeZoneRule instances applicable to the specified time and after.
virtual BasicTimeZone * clone() const =0
Clones this object polymorphically.
BasicTimeZone(const BasicTimeZone &source)
Copy constructor.
virtual ~BasicTimeZone()
Destructor.
virtual void getTimeZoneRules(const InitialTimeZoneRule *&initial, const TimeZoneRule *trsrules[], int32_t &trscount, UErrorCode &status) const =0
Gets the InitialTimeZoneRule and the set of TimeZoneRule which represent time transitions for this ti...
virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition &result) const =0
Gets the first time zone transition after the base time.
BasicTimeZone()
Default constructor.
virtual void getSimpleRulesNear(UDate date, InitialTimeZoneRule *&initial, AnnualTimeZoneRule *&std, AnnualTimeZoneRule *&dst, UErrorCode &status) const
Gets the set of time zone rules valid at the specified time.
virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition &result) const =0
Gets the most recent time zone transition before the base time.
virtual UBool hasEquivalentTransitions(const BasicTimeZone &tz, UDate start, UDate end, UBool ignoreDstAmount, UErrorCode &ec) const
Checks if the time zone has equivalent transitions in the time range.
virtual int32_t countTransitionRules(UErrorCode &status) const =0
Returns the number of TimeZoneRules which represents time transitions, for this time zone,...
BasicTimeZone & operator=(const BasicTimeZone &)=default
Copy assignment.
InitialTimeZoneRule represents a time zone rule representing a time zone effective from the beginning...
Definition: tzrule.h:202
TimeZoneRule is a class representing a rule for time zone.
Definition: tzrule.h:36
TimeZoneTransition is a class representing a time zone transition.
Definition: tztrans.h:35
TimeZone represents a time zone offset, and also figures out daylight savings.
Definition: timezone.h:133
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:295
C++ API: TimeZone object.
C++ API: Time zone rule classes.
C++ API: Time zone transition.
int8_t UBool
The ICU boolean type.
Definition: umachine.h:261
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:301
double UDate
Date and Time data type.
Definition: utypes.h:203