ICU 57.1  57.1
basictz.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 * Copyright (C) 2007-2013, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 *******************************************************************************
6 */
7 #ifndef BASICTZ_H
8 #define BASICTZ_H
9 
15 #include "unicode/utypes.h"
16 
17 #if !UCONFIG_NO_FORMATTING
18 
19 #include "unicode/timezone.h"
20 #include "unicode/tzrule.h"
21 #include "unicode/tztrans.h"
22 
24 
25 // forward declarations
26 class UVector;
27 
35 public:
40  virtual ~BasicTimeZone();
41 
50  virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0;
51 
60  virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0;
61 
82  virtual UBool hasEquivalentTransitions(const BasicTimeZone& tz, UDate start, UDate end,
83  UBool ignoreDstAmount, UErrorCode& ec) const;
84 
93  virtual int32_t countTransitionRules(UErrorCode& status) const = 0;
94 
111  virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
112  const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const = 0;
113 
140  virtual void getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
141  AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) const;
142 
143 
144 #ifndef U_HIDE_INTERNAL_API
149  enum {
150  kStandard = 0x01,
151  kDaylight = 0x03,
152  kFormer = 0x04,
153  kLatter = 0x0C
154  };
155 #endif /* U_HIDE_INTERNAL_API */
156 
161  virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
162  int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const;
163 
164 protected:
165 
166 #ifndef U_HIDE_INTERNAL_API
171  enum {
172  kStdDstMask = kDaylight,
173  kFormerLatterMask = kLatter
174  };
175 #endif /* U_HIDE_INTERNAL_API */
176 
182 
189 
195  BasicTimeZone(const BasicTimeZone& source);
196 
204  void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, UVector*& transitionRules,
205  UErrorCode& status) const;
206 };
207 
209 
210 #endif /* #if !UCONFIG_NO_FORMATTING */
211 
212 #endif // BASICTZ_H
213 
214 //eof
AnnualTimeZoneRule is a class used for representing a time zone rule which takes effect annually.
Definition: tzrule.h:376
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:34
virtual ~BasicTimeZone()
Destructor.
BasicTimeZone(const BasicTimeZone &source)
Copy constructor.
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 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.
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 int32_t countTransitionRules(UErrorCode &status) const =0
Returns the number of TimeZoneRules which represents time transitions, for this time zone,...
BasicTimeZone(const UnicodeString &id)
Construct a timezone with a given ID.
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 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 UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition &result) const =0
Gets the most recent time zone transition before the base time.
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...
InitialTimeZoneRule represents a time zone rule representing a time zone effective from the beginning...
Definition: tzrule.h:198
TimeZoneRule is a class representing a rule for time zone.
Definition: tzrule.h:32
TimeZoneTransition is a class representing a time zone transition.
Definition: tztrans.h:31
TimeZone represents a time zone offset, and also figures out daylight savings.
Definition: timezone.h:129
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:294
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:234
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:476
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:358
double UDate
Date and Time data type.
Definition: utypes.h:201
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129