6 #ifndef ACE_TIME_ZONE_MANAGER_H
7 #define ACE_TIME_ZONE_MANAGER_H
10 #include <AceSorting.h>
11 #include "../zoneinfo/infos.h"
12 #include "ZoneRegistrar.h"
13 #include "TimeOffset.h"
14 #include "ZoneProcessorCache.h"
15 #include "TimeZoneData.h"
47 case TimeZoneData::kTypeError:
49 case TimeZoneData::kTypeManual:
58 uint16_t zoneRegistrySize()
const {
return 0; }
80 template <
typename D,
typename ZP,
typename Z>
91 const typename D::ZoneInfo*
const* zoneRegistry,
95 mZoneProcessorCache(zoneProcessorCache)
102 const typename D::ZoneInfo* zoneInfo =
103 mZoneRegistrar.getZoneInfoForName(name);
109 const typename D::ZoneInfo* zoneInfo =
110 mZoneRegistrar.getZoneInfoForId(
id);
119 const typename D::ZoneInfo* zoneInfo =
120 mZoneRegistrar.getZoneInfoForIndex(index);
130 case TimeZoneData::kTypeError:
132 case TimeZoneData::kTypeManual:
136 case TimeZoneData::kTypeZoneId:
149 return mZoneRegistrar.findIndexForName(name);
157 return mZoneRegistrar.findIndexForId(
id);
165 return mZoneRegistrar.zoneRegistrySize();
177 ZP* processor = mZoneProcessorCache.getZoneProcessor(
178 (uintptr_t) zoneInfo);
187 const typename D::ZoneInfo* zoneInfo =
188 this->mZoneRegistrar.getZoneInfoForName(name);
189 if (! zoneInfo)
return nullptr;
190 return this->mZoneProcessorCache.getZoneProcessor((uintptr_t) zoneInfo);
195 const typename D::ZoneInfo* zoneInfo =
196 this->mZoneRegistrar.getZoneInfoForIndex(index);
214 using BasicZoneManager = ZoneManagerTemplate<
215 basic::Info, BasicZoneProcessor, BasicZone>;
221 using ExtendedZoneManager = ZoneManagerTemplate<
222 extended::Info, ExtendedZoneProcessor, ExtendedZone>;
228 using CompleteZoneManager = ZoneManagerTemplate<
229 complete::Info, CompleteZoneProcessor, CompleteZone>;
A simple version of ZoneManager that converts a manual TimeZoneData with fixed STD and DST offsets in...
TimeZone createForTimeZoneData(const TimeZoneData &d)
Create a TimeZone with fixed STD and DST offsets stored in the TimeZoneData which was created by Time...
static TimeOffset forMinutes(int16_t minutes)
Create TimeOffset from minutes from 00:00.
Class that describes a time zone.
static TimeZone forZoneInfo(const basic::Info::ZoneInfo *zoneInfo, BasicZoneProcessor *zoneProcessor)
Convenience factory method to create from a zoneInfo and an associated BasicZoneProcessor.
static TimeZone forError()
Return a TimeZone representing an error condition.
static TimeZone forTimeOffset(TimeOffset stdOffset, TimeOffset dstOffset=TimeOffset())
Factory method to create from a UTC offset and an optional DST offset.
A templatized implementation of ZoneManager that binds the ZoneRegistrar with the corresponding (Basi...
uint16_t indexForZoneName(const char *name) const
Find the registry index for the given time zone name.
ZoneManagerTemplate(uint16_t zoneRegistrySize, const typename D::ZoneInfo *const *zoneRegistry, ZoneProcessorCacheBaseTemplate< ZP > &zoneProcessorCache)
Constructor.
TimeZone createForTimeZoneData(const TimeZoneData &d)
Create a TimeZone from the TimeZoneData created by TimeZone::toTimeZoneData().
ZP * getZoneProcessor(const char *name)
Return the ZoneProcessor for given zone name.
uint16_t indexForZoneId(uint32_t id) const
Find the registry index for the given time zone id.
Z getZoneForIndex(uint16_t index) const
Return the Zone wrapper object for the given index.
TimeZone createForZoneId(uint32_t id)
Create a TimeZone for the given 32-bit zoneId.
TimeZone createForZoneInfo(const typename D::ZoneInfo *zoneInfo)
Create a TimeZone from an explicit ZoneInfo reference.
TimeZone createForZoneIndex(uint16_t index)
Create a TimeZone for the given index in the ZoneInfo registry that was used to create this ZoneManag...
TimeZone createForZoneName(const char *name)
Create a TimeZone for the given zone name (e.g.
uint16_t zoneRegistrySize() const
Return the number of elements in the Zone and Fat Link registry.
Base class for ManualZoneManager, BasicZoneManager, and ExtendedZoneManager to keep ZoneManager::kInv...
static const uint16_t kInvalidIndex
Registry index which is not valid.
The template class of BasicZoneProcessorCacheBase or ExtendedZoneProcessorCacheBase.
Class that allows looking up the ZoneInfo from its TZDB identifier (e.g.
Data structure that captures the internal state of a TimeZone object with enough information so that ...
uint32_t zoneId
Both TimeZone::kTypeBasic and TimeZone::kTypeExtended are mapped to a TimeZoneData::kTypeZoneId.