GnuCash 7574033+
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 786 of file gnc-timezone.cpp.

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

◆ get()

TZ_Ptr TimeZoneProvider::get ( int year) const
noexcept

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

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

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: