ICU 63.1  63.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 !UCONFIG_NO_FORMATTING
20 
21 #include "unicode/timezone.h"
22 #include "unicode/tzrule.h"
23 #include "unicode/tztrans.h"
24 
26 
27 // forward declarations
28 class UVector;
29 
37 public:
42  virtual ~BasicTimeZone();
43 
52  virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0;
53 
62  virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0;
63 
84  virtual UBool hasEquivalentTransitions(const BasicTimeZone& tz, UDate start, UDate end,
85  UBool ignoreDstAmount, UErrorCode& ec) const;
86 
95  virtual int32_t countTransitionRules(UErrorCode& status) const = 0;
96 
113  virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
114  const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const = 0;
115 
142  virtual void getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
143  AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) const;
144 
145 
146 #ifndef U_HIDE_INTERNAL_API
147 
151  enum {
152  kStandard = 0x01,
153  kDaylight = 0x03,
154  kFormer = 0x04,
155  kLatter = 0x0C
156  };
157 #endif /* U_HIDE_INTERNAL_API */
158 
163  virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
164  int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const;
165 
166 protected:
167 
168 #ifndef U_HIDE_INTERNAL_API
169 
173  enum {
174  kStdDstMask = kDaylight,
175  kFormerLatterMask = kLatter
176  };
177 #endif /* U_HIDE_INTERNAL_API */
178 
184 
191 
197  BasicTimeZone(const BasicTimeZone& source);
198 
206  void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, UVector*& transitionRules,
207  UErrorCode& status) const;
208 };
209 
211 
212 #endif /* #if !UCONFIG_NO_FORMATTING */
213 
214 #endif // BASICTZ_H
215 
216 //eof
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:301
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:225
icu::BasicTimeZone::BasicTimeZone
BasicTimeZone(const BasicTimeZone &source)
Copy constructor.
icu::BasicTimeZone
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:36
icu::TimeZoneRule
TimeZoneRule is a class representing a rule for time zone.
Definition: tzrule.h:34
icu::TimeZone
TimeZone represents a time zone offset, and also figures out daylight savings.
Definition: timezone.h:131
icu::BasicTimeZone::~BasicTimeZone
virtual ~BasicTimeZone()
Destructor.
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:290
timezone.h
C++ API: TimeZone object.
icu::BasicTimeZone::getNextTransition
virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition &result) const =0
Gets the first time zone transition after the base time.
icu::AnnualTimeZoneRule
AnnualTimeZoneRule is a class used for representing a time zone rule which takes effect annually.
Definition: tzrule.h:378
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:401
tztrans.h
C++ API: Time zone transition.
icu::BasicTimeZone::getTimeZoneRulesAfter
void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule *&initial, UVector *&transitionRules, UErrorCode &status) const
Gets the set of TimeZoneRule instances applicable to the specified time and after.
icu::InitialTimeZoneRule
InitialTimeZoneRule represents a time zone rule representing a time zone effective from the beginning...
Definition: tzrule.h:200
icu::BasicTimeZone::countTransitionRules
virtual int32_t countTransitionRules(UErrorCode &status) const =0
Returns the number of TimeZoneRules which represents time transitions, for this time zone,...
icu::BasicTimeZone::hasEquivalentTransitions
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.
icu::TimeZoneTransition
TimeZoneTransition is a class representing a time zone transition.
Definition: tztrans.h:33
icu::BasicTimeZone::getOffsetFromLocal
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.
UDate
double UDate
Date and Time data type.
Definition: utypes.h:203
icu::BasicTimeZone::BasicTimeZone
BasicTimeZone()
Default constructor.
tzrule.h
C++ API: Time zone rule classes.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:138
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:137
icu::BasicTimeZone::BasicTimeZone
BasicTimeZone(const UnicodeString &id)
Construct a timezone with a given ID.
icu::BasicTimeZone::getPreviousTransition
virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition &result) const =0
Gets the most recent time zone transition before the base time.
icu::BasicTimeZone::getTimeZoneRules
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...
icu::BasicTimeZone::getSimpleRulesNear
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.