basictz.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
* Copyright (C) 2007-2013, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
#ifndef BASICTZ_H
#define BASICTZ_H
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#if !UCONFIG_NO_FORMATTING
#include "unicode/timezone.h"
#include "unicode/tzrule.h"
#include "unicode/tztrans.h"
U_NAMESPACE_BEGIN
// forward declarations
class UVector;
class U_I18N_API BasicTimeZone: public TimeZone {
public:
virtual ~BasicTimeZone();
virtual BasicTimeZone* clone() const override = 0;
virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0;
virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0;
virtual UBool hasEquivalentTransitions(const BasicTimeZone& tz, UDate start, UDate end,
UBool ignoreDstAmount, UErrorCode& ec) const;
virtual int32_t countTransitionRules(UErrorCode& status) const = 0;
virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial,
const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const = 0;
virtual void getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) const;
virtual void getOffsetFromLocal(
UDate date, UTimeZoneLocalOption nonExistingTimeOpt,
UTimeZoneLocalOption duplicatedTimeOpt, int32_t& rawOffset,
int32_t& dstOffset, UErrorCode& status) const;
#ifndef U_HIDE_INTERNAL_API
enum {
kStandard = 0x01,
kDaylight = 0x03,
kFormer = 0x04, /* UCAL_TZ_LOCAL_FORMER */
kLatter = 0x0C /* UCAL_TZ_LOCAL_LATTER */
};
void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const;
#endif /* U_HIDE_INTERNAL_API */
protected:
#ifndef U_HIDE_INTERNAL_API
static constexpr int32_t kStdDstMask = kDaylight;
static constexpr int32_t kFormerLatterMask = kLatter;
#endif /* U_HIDE_INTERNAL_API */
BasicTimeZone();
BasicTimeZone(const UnicodeString &id);
BasicTimeZone(const BasicTimeZone& source);
BasicTimeZone& operator=(const BasicTimeZone&) = default;
void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, UVector*& transitionRules,
UErrorCode& status) const;
};
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_FORMATTING */
#endif /* U_SHOW_CPLUSPLUS_API */
#endif // BASICTZ_H
//eof
icu::AnnualTimeZoneRule
AnnualTimeZoneRule is a class used for representing a time zone rule which takes effect annually.
Definition: tzrule.h:366
icu::BasicTimeZone
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:38
icu::BasicTimeZone::BasicTimeZone
BasicTimeZone(const UnicodeString &id)
Construct a timezone with a given ID.
icu::BasicTimeZone::getOffsetFromLocal
virtual void getOffsetFromLocal(UDate date, UTimeZoneLocalOption nonExistingTimeOpt, UTimeZoneLocalOption duplicatedTimeOpt, int32_t &rawOffset, int32_t &dstOffset, UErrorCode &status) const
Get time zone offsets from local wall time.
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::BasicTimeZone::getOffsetFromLocal
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.
icu::BasicTimeZone::BasicTimeZone
BasicTimeZone(const BasicTimeZone &source)
Copy constructor.
icu::BasicTimeZone::~BasicTimeZone
virtual ~BasicTimeZone()
Destructor.
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::clone
virtual BasicTimeZone * clone() const override=0
Clones this object polymorphically.
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::BasicTimeZone::BasicTimeZone
BasicTimeZone()
Default constructor.
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.
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::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::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::operator=
BasicTimeZone & operator=(const BasicTimeZone &)=default
Copy assignment.
icu::InitialTimeZoneRule
InitialTimeZoneRule represents a time zone rule representing a time zone effective from the beginning...
Definition: tzrule.h:202
icu::TimeZoneRule
TimeZoneRule is a class representing a rule for time zone.
Definition: tzrule.h:36
icu::TimeZoneTransition
TimeZoneTransition is a class representing a time zone transition.
Definition: tztrans.h:35
icu::TimeZone
TimeZone represents a time zone offset, and also figures out daylight savings.
Definition: timezone.h:133
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
timezone.h
C++ API: TimeZone object.
tzrule.h
C++ API: Time zone rule classes.
tztrans.h
C++ API: Time zone transition.
UTimeZoneLocalOption
UTimeZoneLocalOption
Options used by ucal_getTimeZoneOffsetFromLocal and BasicTimeZone::getOffsetFromLocal() to specify ho...
Definition: ucal.h:1691
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
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
UDate
double UDate
Date and Time data type.
Definition: utypes.h:203