AceTime  3.0.0
Date and time classes for Arduino that support timezones from the TZ Database.
Public Member Functions | Static Public Member Functions | List of all members
ace_time::ZoneSorterByOffsetAndName< ZM > Class Template Reference

ZoneSorterByOffsetAndName, templatized on a ZoneManager (BasicZoneManager, ExtendedZoneManager, or CompleteZoneManager). More...

#include <ZoneSorterByOffsetAndName.h>

Public Member Functions

 ZoneSorterByOffsetAndName (const ZM &zoneManager)
 Constructor. More...
 
void fillIndexes (uint16_t indexes[], uint16_t size) const
 Fill the given array of indexes with index from [0, size). More...
 
void sortIndexes (uint16_t indexes[], uint16_t size) const
 Sort the given array of indexes by UTC offset, then by name.
 
void sortIds (uint32_t ids[], uint16_t size) const
 Sort the given array of zone ids by UTC offset, then by name.
 
void sortNames (const char *names[], uint16_t size) const
 Sort the given array of zone names by UTC offset, then by name.
 

Static Public Member Functions

template<typename Z >
static int compareZone (const Z &a, const Z &b)
 Return <0, 0, or >0 depending on whether Zone a is <, ==, or > than Zone b. More...
 

Detailed Description

template<typename ZM>
class ace_time::ZoneSorterByOffsetAndName< ZM >

ZoneSorterByOffsetAndName, templatized on a ZoneManager (BasicZoneManager, ExtendedZoneManager, or CompleteZoneManager).

Sorts the array of zones by UTC offset first, then by name.

Template Parameters
ZMZoneManager

Definition at line 22 of file ZoneSorterByOffsetAndName.h.

Constructor & Destructor Documentation

◆ ZoneSorterByOffsetAndName()

template<typename ZM >
ace_time::ZoneSorterByOffsetAndName< ZM >::ZoneSorterByOffsetAndName ( const ZM &  zoneManager)
inline

Constructor.

Parameters
zoneManagerinstance of the ZoneManager

Definition at line 28 of file ZoneSorterByOffsetAndName.h.

Member Function Documentation

◆ compareZone()

template<typename ZM >
template<typename Z >
static int ace_time::ZoneSorterByOffsetAndName< ZM >::compareZone ( const Z &  a,
const Z &  b 
)
inlinestatic

Return <0, 0, or >0 depending on whether Zone a is <, ==, or > than Zone b.

The comparison function is by the zone's last UTC offset in the zoneInfo database, then by name for zones which have the same UTC offset.

We cannot use auto as the parameter type (apparently, that's a C++14 feature), so we are forced to use template function.

Template Parameters
Zthe zone class (i.e. BasicZone, ExtendedZone, ComppleteZone)

Definition at line 90 of file ZoneSorterByOffsetAndName.h.

◆ fillIndexes()

template<typename ZM >
void ace_time::ZoneSorterByOffsetAndName< ZM >::fillIndexes ( uint16_t  indexes[],
uint16_t  size 
) const
inline

Fill the given array of indexes with index from [0, size).

The resulting indexes array can be sorted using sortIndexes().

Definition at line 36 of file ZoneSorterByOffsetAndName.h.


The documentation for this class was generated from the following file: