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"
17 #include "BasicZone.h"
18 #include "ExtendedZone.h"
19 #include "CompleteZone.h"
49 case TimeZoneData::kTypeError:
51 case TimeZoneData::kTypeManual:
60 uint16_t zoneRegistrySize()
const {
return 0; }
86 template <
typename ZI,
typename ZRR,
typename ZP,
typename Z>
97 const ZI*
const* zoneRegistry,
101 mZoneProcessorCache(zoneProcessorCache)
108 const ZI* zoneInfo = mZoneRegistrar.getZoneInfoForName(name);
114 const ZI* zoneInfo = mZoneRegistrar.getZoneInfoForId(
id);
123 const ZI* zoneInfo = mZoneRegistrar.getZoneInfoForIndex(index);
133 case TimeZoneData::kTypeError:
135 case TimeZoneData::kTypeManual:
139 case TimeZoneData::kTypeZoneId:
152 return mZoneRegistrar.findIndexForName(name);
160 return mZoneRegistrar.findIndexForId(
id);
168 return mZoneRegistrar.zoneRegistrySize();
180 ZP* processor = mZoneProcessorCache.getZoneProcessor(
181 (uintptr_t) zoneInfo);
190 const ZI* zoneInfo = this->mZoneRegistrar.getZoneInfoForName(name);
191 if (! zoneInfo)
return nullptr;
192 return this->mZoneProcessorCache.getZoneProcessor((uintptr_t) zoneInfo);
197 const ZI* zoneInfo = this->mZoneRegistrar.getZoneInfoForIndex(index);
207 const ZRR mZoneRegistrar;
215 using BasicZoneManager = ZoneManagerTemplate<
217 basic::ZoneRegistrar,
226 using ExtendedZoneManager = ZoneManagerTemplate<
228 extended::ZoneRegistrar,
229 ExtendedZoneProcessor,
237 using CompleteZoneManager = ZoneManagerTemplate<
239 complete::ZoneRegistrar,
240 CompleteZoneProcessor,
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.
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.
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.