Rename Link to link

This commit is contained in:
Howard Hinnant 2016-05-28 20:20:28 -04:00
parent 67c31d794e
commit b0a23f2cff
2 changed files with 15 additions and 15 deletions

10
tz.cpp
View File

@ -1904,9 +1904,9 @@ operator<<(std::ostream& os, const time_zone& z)
return os; return os;
} }
// Link // link
Link::Link(const std::string& s) link::link(const std::string& s)
{ {
using namespace date; using namespace date;
std::istringstream in(s); std::istringstream in(s);
@ -1916,7 +1916,7 @@ Link::Link(const std::string& s)
} }
std::ostream& std::ostream&
operator<<(std::ostream& os, const Link& x) operator<<(std::ostream& os, const link& x)
{ {
using namespace date; using namespace date;
detail::save_stream _(os); detail::save_stream _(os);
@ -2146,7 +2146,7 @@ init_tzdb()
} }
else if (word == "Link") else if (word == "Link")
{ {
db.links.push_back(Link(line)); db.links.push_back(link(line));
continue_zone = false; continue_zone = false;
} }
else if (word == "Leap") else if (word == "Leap")
@ -2230,7 +2230,7 @@ locate_zone(const std::string& tz_name)
if (zi == db.zones.end() || zi->name() != tz_name) if (zi == db.zones.end() || zi->name() != tz_name)
{ {
auto li = std::lower_bound(db.links.begin(), db.links.end(), tz_name, auto li = std::lower_bound(db.links.begin(), db.links.end(), tz_name,
[](const Link& z, const std::string& nm) [](const link& z, const std::string& nm)
{ {
return z.name() < nm; return z.name() < nm;
}); });

20
tz.h
View File

@ -494,27 +494,27 @@ time_zone::to_sys_impl(local_time<Duration> tp, choose, std::true_type) const
return sys_time<Duration>{tp.time_since_epoch()} - i.first.offset; return sys_time<Duration>{tp.time_since_epoch()} - i.first.offset;
} }
class Link class link
{ {
private: private:
std::string name_; std::string name_;
std::string target_; std::string target_;
public: public:
explicit Link(const std::string& s); explicit link(const std::string& s);
const std::string& name() const {return name_;} const std::string& name() const {return name_;}
const std::string& target() const {return target_;} 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 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 std::ostream& operator<<(std::ostream& os, const Link& x); friend std::ostream& operator<<(std::ostream& os, const link& x);
}; };
inline bool operator!=(const Link& x, const Link& y) {return !(x == y);} 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 !(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);} inline bool operator>=(const link& x, const link& y) {return !(x < y);}
class Leap class Leap
{ {
@ -682,7 +682,7 @@ struct TZ_DB
{ {
std::string version; std::string version;
std::vector<time_zone> zones; std::vector<time_zone> zones;
std::vector<Link> links; std::vector<link> links;
std::vector<Leap> leaps; std::vector<Leap> leaps;
std::vector<Rule> rules; std::vector<Rule> rules;
#if TIMEZONE_MAPPING #if TIMEZONE_MAPPING