6 #ifndef ACE_TIME_ZONE_MANAGER_H
7 #define ACE_TIME_ZONE_MANAGER_H
10 #include <AceSorting.h>
11 #include "../zoneinfo/ZoneInfo.h"
12 #include "../zoneinfo/ZoneRegistrar.h"
13 #include "ZoneProcessorCache.h"
14 #include "TimeZoneData.h"
16 #include "BasicZone.h"
17 #include "ExtendedZone.h"
47 case TimeZoneData::kTypeError:
49 case TimeZoneData::kTypeManual:
58 uint16_t zoneRegistrySize()
const {
return 0; }
85 typename ZI,
typename ZRR,
86 typename ZP,
typename Z
94 const ZI* zoneInfo = mZoneRegistrar.getZoneInfoForName(name);
100 const ZI* zoneInfo = mZoneRegistrar.getZoneInfoForId(
id);
109 const ZI* zoneInfo = mZoneRegistrar.getZoneInfoForIndex(index);
119 case TimeZoneData::kTypeError:
121 case TimeZoneData::kTypeManual:
125 case TimeZoneData::kTypeZoneId:
138 return mZoneRegistrar.findIndexForName(name);
146 return mZoneRegistrar.findIndexForId(
id);
154 return mZoneRegistrar.zoneRegistrySize();
166 ZP* processor = mZoneProcessorCache.getZoneProcessor(
167 (uintptr_t) zoneInfo);
176 const ZI* zoneInfo = this->mZoneRegistrar.getZoneInfoForName(name);
177 if (! zoneInfo)
return nullptr;
178 return this->mZoneProcessorCache.getZoneProcessor((uintptr_t) zoneInfo);
183 const ZI* zoneInfo = this->mZoneRegistrar.getZoneInfoForIndex(index);
192 mZoneProcessorCache.resetZoneProcessors();
204 const ZI*
const* zoneRegistry,
208 mZoneProcessorCache(zoneProcessorCache)
216 const ZRR mZoneRegistrar;
227 basic::ZoneRegistrar,
235 const basic::ZoneInfo*
const* zoneRegistry,
257 extended::ZoneRegistrar,
258 ExtendedZoneProcessor,
265 const extended::ZoneInfo*
const* zoneRegistry,
An implementation of the ZoneManager which uses a registry of basic::ZoneInfo records.
A specific implementation of BasicZoneProcessorTemplate that uses ZoneXxxBrokers which read from zone...
A thin wrapper around a basic::ZoneInfo data structure to provide a stable API access to some useful ...
An implementation of the ZoneManager which uses a registry of extended::ZoneInfo records.
A specific implementation of ExtendedZoneProcessorTemplate that uses ZoneXxxBrokers which read from z...
A thin wrapper around an extended::ZoneInfo data structure to provide a stable API access to some use...
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 forError()
Return a TimeZone representing an error condition.
static TimeZone forZoneInfo(const basic::ZoneInfo *zoneInfo, BasicZoneProcessor *zoneProcessor)
Convenience factory method to create from a zoneInfo and an associated BasicZoneProcessor.
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...
TimeZone createForTimeZoneData(const TimeZoneData &d)
Create a TimeZone from the TimeZoneData created by TimeZone::toTimeZoneData().
TimeZone createForZoneId(uint32_t id)
Create a TimeZone for the given 32-bit zoneId.
void resetZoneProcessors()
Reset the transition cache of the zone processors in the cache.
Z getZoneForIndex(uint16_t index) const
Return the Zone wrapper object for the given index.
TimeZone createForZoneName(const char *name)
Create a TimeZone for the given zone name (e.g.
uint16_t indexForZoneName(const char *name) const
Find the registry index for the given time zone name.
TimeZone createForZoneInfo(const ZI *zoneInfo)
Create a TimeZone from an explicit ZoneInfo reference.
uint16_t indexForZoneId(uint32_t id) const
Find the registry index for the given time zone id.
ZP * getZoneProcessor(const char *name)
Return the ZoneProcessor for given zone name.
uint16_t zoneRegistrySize() const
Return the number of elements in the Zone and Fat Link registry.
ZoneManagerTemplate(uint16_t zoneRegistrySize, const ZI *const *zoneRegistry, ZoneProcessorCacheBaseTemplate< ZP > &zoneProcessorCache)
Constructor.
TimeZone createForZoneIndex(uint16_t index)
Create a TimeZone for the given index in the ZoneInfo registry that was used to create this ZoneManag...
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.
Concrete template instantiation of ZoneRegistrarTemplate for basic::ZoneInfo, which can be used with ...
Concrete template instantiation of ZoneRegistrarTemplate for extended::ZoneInfo, which can be used wi...
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.