GnuCash de0bfde+
Loading...
Searching...
No Matches
TimeZoneProvider Class Reference

Public Member Functions

 TimeZoneProvider (const std::string &tzname)
 TimeZoneProvider (const TimeZoneProvider &)=delete
 TimeZoneProvider (const TimeZoneProvider &&)=delete
TimeZoneProvider operator= (const TimeZoneProvider &)=delete
TimeZoneProvider operator= (const TimeZoneProvider &&)=delete
TZ_Ptr get (int year) const noexcept
void dump () const noexcept

Static Public Attributes

static const unsigned int min_year = 1400
static const unsigned int max_year = 9999

Detailed Description

Definition at line 45 of file gnc-timezone.hpp.

Constructor & Destructor Documentation

◆ TimeZoneProvider()

TimeZoneProvider::TimeZoneProvider ( )
inline

Definition at line 49 of file gnc-timezone.hpp.

49: TimeZoneProvider (static_cast<std::string>("")) {}

Member Function Documentation

◆ dump()

void TimeZoneProvider::dump ( ) const
noexcept

Definition at line 789 of file gnc-timezone.cpp.

790{
791 for (const auto& zone : m_zone_vector)
792 std::cout << zone.first << ": " << zone.second->to_posix_string() << "\n";
793}

◆ get()

TZ_Ptr TimeZoneProvider::get ( int year) const
noexcept

Definition at line 777 of file gnc-timezone.cpp.

778{
779 if (m_zone_vector.empty())
780 return TZ_Ptr(new PTZ("UTC0"));
781 auto iter = find_if(m_zone_vector.rbegin(), m_zone_vector.rend(),
782 [=](TZ_Entry e) { return e.first <= year; });
783 if (iter == m_zone_vector.rend())
784 return m_zone_vector.front().second;
785 return iter->second;
786}

Field Documentation

◆ max_year

const unsigned int TimeZoneProvider::max_year = 9999
static

Definition at line 58 of file gnc-timezone.hpp.

◆ min_year

const unsigned int TimeZoneProvider::min_year = 1400
static

Definition at line 57 of file gnc-timezone.hpp.


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