AceTime
1.11.1
Date and time classes for Arduino that support timezones from the TZ Database.
src
ace_time
ExtendedZone.h
1
/*
2
* MIT License
3
* Copyright (c) 2019 Brian T. Park
4
*/
5
6
#ifndef ACE_TIME_EXTENDED_ZONE_H
7
#define ACE_TIME_EXTENDED_ZONE_H
8
9
#include <AceCommon.h>
// KString
10
#include "internal/ZoneInfo.h"
11
#include "
internal/ExtendedBrokers.h
"
12
13
class
Print;
14
15
namespace
ace_time {
16
23
class
ExtendedZone
{
24
public
:
29
ExtendedZone
(
const
extended::ZoneInfo* zoneInfo):
30
mZoneInfoBroker(zoneInfo) {}
31
37
ExtendedZone
(
const
extended::ZoneInfoBroker
& zoneInfo):
38
mZoneInfoBroker(zoneInfo) {}
39
40
// Use default copy constructor and assignment operator
41
ExtendedZone
(
const
ExtendedZone
&) =
default
;
42
ExtendedZone
& operator=(
const
ExtendedZone
&) =
default
;
43
45
bool
isNull
()
const
{
return
mZoneInfoBroker.isNull(); }
46
48
void
printNameTo
(Print& printer)
const
;
49
55
void
printShortNameTo
(Print& printer)
const
;
56
58
uint32_t
zoneId
()
const
{
59
return
mZoneInfoBroker.zoneId();
60
}
61
63
int16_t
stdOffsetMinutes
()
const
{
64
uint8_t numEras = mZoneInfoBroker.numEras();
65
extended::ZoneEraBroker
zeb = mZoneInfoBroker.era(numEras - 1);
66
return
zeb.offsetMinutes();
67
}
68
70
ace_common::KString
kname
()
const
{
71
const
auto
* name =
isNull
() ? nullptr : mZoneInfoBroker.name();
72
const
internal::ZoneContext
* zoneContext = mZoneInfoBroker.zoneContext();
73
return
ace_common::KString(
74
name, zoneContext->
fragments
, zoneContext->
numFragments
);
75
}
76
77
private
:
78
const
extended::ZoneInfoBroker
mZoneInfoBroker;
79
};
80
81
}
82
83
#endif
ace_time::ExtendedZone::zoneId
uint32_t zoneId() const
Return the zoneId of the current zoneInfo.
Definition:
ExtendedZone.h:58
ace_time::ExtendedZone::printShortNameTo
void printShortNameTo(Print &printer) const
Print the short pretty zone name to the printer.
Definition:
ExtendedZone.cpp:27
ace_time::internal::ZoneContext
Metadata about the zone database.
Definition:
ZoneContext.h:16
ace_time::ExtendedZone
A thin wrapper around an extended::ZoneInfo data structure to provide a stable API access to some use...
Definition:
ExtendedZone.h:23
ace_time::ExtendedZone::ExtendedZone
ExtendedZone(const extended::ZoneInfoBroker &zoneInfo)
Constructor from an extended::ZoneInfoBroker, used by ExtendedZoneProcessor.
Definition:
ExtendedZone.h:37
ace_time::ExtendedZone::stdOffsetMinutes
int16_t stdOffsetMinutes() const
Return the STDOFF of the last ZoneEra.
Definition:
ExtendedZone.h:63
ace_time::internal::ZoneContext::fragments
const char *const * fragments
Zone Name fragment list.
Definition:
ZoneContext.h:47
ace_time::extended::ZoneInfoBroker
Data broker for accessing ZoneInfo.
Definition:
ExtendedBrokers.h:318
ace_time::ExtendedZone::printNameTo
void printNameTo(Print &printer) const
Print the full zone name to printer.
Definition:
ExtendedZone.cpp:20
ace_time::ExtendedZone::isNull
bool isNull() const
Return true if zoneInfo is null.
Definition:
ExtendedZone.h:45
ExtendedBrokers.h
ace_time::extended::ZoneEraBroker
Data broker for accessing ZoneEra.
Definition:
ExtendedBrokers.h:218
ace_time::ExtendedZone::kname
ace_common::KString kname() const
Return the name as a KString.
Definition:
ExtendedZone.h:70
ace_time::ExtendedZone::ExtendedZone
ExtendedZone(const extended::ZoneInfo *zoneInfo)
Constructor from a raw extended::ZoneInfo* pointer, intended for manual inspection of a ZoneInfo reco...
Definition:
ExtendedZone.h:29
ace_time::internal::ZoneContext::numFragments
uint8_t numFragments
Number of fragments.
Definition:
ZoneContext.h:44
Generated by
1.8.17