diff --git a/include/date/tz.h b/include/date/tz.h index 5fc7297..483f0e2 100644 --- a/include/date/tz.h +++ b/include/date/tz.h @@ -964,27 +964,29 @@ time_zone::to_sys_impl(local_time tp, choose, std::true_type) const #if !USE_OS_TZDB -class link +class time_zone_link { private: std::string name_; std::string target_; public: - DATE_API explicit link(const std::string& s); + DATE_API explicit time_zone_link(const std::string& s); const std::string& name() const {return name_;} const std::string& target() const {return target_;} - friend bool operator==(const link& x, const link& y) {return x.name_ == y.name_;} - friend bool operator< (const link& x, const link& y) {return x.name_ < y.name_;} + friend bool operator==(const time_zone_link& x, const time_zone_link& y) {return x.name_ == y.name_;} + friend bool operator< (const time_zone_link& x, const time_zone_link& y) {return x.name_ < y.name_;} - friend DATE_API std::ostream& operator<<(std::ostream& os, const link& x); + friend DATE_API std::ostream& operator<<(std::ostream& os, const time_zone_link& x); }; -inline bool operator!=(const link& x, const link& y) {return !(x == y);} -inline bool operator> (const link& x, const link& y) {return y < x;} -inline bool operator<=(const link& x, const link& y) {return !(y < x);} -inline bool operator>=(const link& x, const link& y) {return !(x < y);} +using link = time_zone_link; + +inline bool operator!=(const time_zone_link& x, const time_zone_link& y) {return !(x == y);} +inline bool operator> (const time_zone_link& x, const time_zone_link& y) {return y < x;} +inline bool operator<=(const time_zone_link& x, const time_zone_link& y) {return !(y < x);} +inline bool operator>=(const time_zone_link& x, const time_zone_link& y) {return !(x < y);} #endif // !USE_OS_TZDB @@ -1155,16 +1157,16 @@ struct timezone_mapping struct tzdb { - std::string version = "unknown"; - std::vector zones; + std::string version = "unknown"; + std::vector zones; #if !USE_OS_TZDB - std::vector links; + std::vector links; #endif #if !MISSING_LEAP_SECONDS - std::vector leap_seconds; + std::vector leap_seconds; #endif #if !USE_OS_TZDB - std::vector rules; + std::vector rules; #endif #ifdef _WIN32 std::vector mappings; diff --git a/src/tz.cpp b/src/tz.cpp index 91c8a54..087c02a 100644 --- a/src/tz.cpp +++ b/src/tz.cpp @@ -2720,9 +2720,9 @@ init_tzdb() #else // !USE_OS_TZDB -// link +// time_zone_link -link::link(const std::string& s) +time_zone_link::time_zone_link(const std::string& s) { using namespace date; std::istringstream in(s); @@ -2732,7 +2732,7 @@ link::link(const std::string& s) } std::ostream& -operator<<(std::ostream& os, const link& x) +operator<<(std::ostream& os, const time_zone_link& x) { using namespace date; detail::save_ostream _(os); @@ -3438,7 +3438,7 @@ init_tzdb() } else if (word == "Link") { - db->links.push_back(link(line)); + db->links.push_back(time_zone_link(line)); continue_zone = false; } else if (word == "Leap") @@ -3521,9 +3521,9 @@ tzdb::locate_zone(const std::string& tz_name) const #if !USE_OS_TZDB auto li = std::lower_bound(links.begin(), links.end(), tz_name, #if HAS_STRING_VIEW - [](const link& z, const std::string_view& nm) + [](const time_zone_link& z, const std::string_view& nm) #else - [](const link& z, const std::string& nm) + [](const time_zone_link& z, const std::string& nm) #endif { return z.name() < nm;