Rename zone_vector to m_zone_vector.

To comply with coding spec.
This commit is contained in:
John Ralls 2018-04-27 13:23:33 -07:00
parent 3e41bb011d
commit f6855bc0f8
2 changed files with 22 additions and 22 deletions

View File

@ -214,10 +214,10 @@ TimeZoneProvider::load_windows_dynamic_tz (HKEY key, time_zone_names names)
} }
tz = zone_from_regtzi (regtzi, names); tz = zone_from_regtzi (regtzi, names);
if (year == first) if (year == first)
zone_vector.push_back (std::make_pair(0, tz)); m_zone_vector.push_back (std::make_pair(0, tz));
zone_vector.push_back (std::make_pair(year, tz)); m_zone_vector.push_back (std::make_pair(year, tz));
} }
zone_vector.push_back (std::make_pair(max_year, tz)); m_zone_vector.push_back (std::make_pair(max_year, tz));
} }
catch (std::invalid_argument) catch (std::invalid_argument)
{ {
@ -242,7 +242,7 @@ TimeZoneProvider::load_windows_classic_tz (HKEY key, time_zone_names names)
if (RegQueryValueExA (key, "TZI", NULL, NULL, if (RegQueryValueExA (key, "TZI", NULL, NULL,
(LPBYTE) &regtzi, &size) == ERROR_SUCCESS) (LPBYTE) &regtzi, &size) == ERROR_SUCCESS)
{ {
zone_vector.push_back( m_zone_vector.push_back(
std::make_pair(max_year, zone_from_regtzi (regtzi, names))); std::make_pair(max_year, zone_from_regtzi (regtzi, names)));
} }
} }
@ -267,11 +267,11 @@ TimeZoneProvider::load_windows_default_tz()
auto dlt_name = utf_to_utf<char>(tzi.DaylightName, auto dlt_name = utf_to_utf<char>(tzi.DaylightName,
tzi.DaylightName + sizeof(tzi.DaylightName)); tzi.DaylightName + sizeof(tzi.DaylightName));
time_zone_names names (std_name, std_name, dlt_name, dlt_name); time_zone_names names (std_name, std_name, dlt_name, dlt_name);
zone_vector.push_back(std::make_pair(max_year, zone_from_regtzi(regtzi, names))); m_zone_vector.push_back(std::make_pair(max_year, zone_from_regtzi(regtzi, names)));
} }
TimeZoneProvider::TimeZoneProvider (const std::string& identifier) : TimeZoneProvider::TimeZoneProvider (const std::string& identifier) :
zone_vector () m_zone_vector ()
{ {
HKEY key; HKEY key;
const std::string reg_key = const std::string reg_key =
@ -632,13 +632,13 @@ TimeZoneProvider::parse_file(const std::string& tzname)
//Initial case //Initial case
if (last_time.is_not_a_date_time()) if (last_time.is_not_a_date_time())
{ {
zone_vector.push_back(zone_no_dst(this_year - 1, last_info)); m_zone_vector.push_back(zone_no_dst(this_year - 1, last_info));
zone_vector.push_back(zone_no_dst(this_year, this_info)); m_zone_vector.push_back(zone_no_dst(this_year, this_info));
} }
// No change in is_dst means a permanent zone change. // No change in is_dst means a permanent zone change.
else if (last_info->info.isdst == this_info->info.isdst) else if (last_info->info.isdst == this_info->info.isdst)
{ {
zone_vector.push_back(zone_no_dst(this_year, this_info)); m_zone_vector.push_back(zone_no_dst(this_year, this_info));
} }
/* If there have been no transitions in at least a year /* If there have been no transitions in at least a year
* then we need to create a no-DST rule with last_info to * then we need to create a no-DST rule with last_info to
@ -647,9 +647,9 @@ TimeZoneProvider::parse_file(const std::string& tzname)
else if (this_time - last_time > one_year) else if (this_time - last_time > one_year)
{ {
auto year = last_time.date().year(); auto year = last_time.date().year();
if (zone_vector.back().first == year) if (m_zone_vector.back().first == year)
year = year + 1; // no operator ++ or +=, sigh. year = year + 1; // no operator ++ or +=, sigh.
zone_vector.push_back(zone_no_dst(year, last_info)); m_zone_vector.push_back(zone_no_dst(year, last_info));
} }
/* It's been less than a year, so it's probably a DST /* It's been less than a year, so it's probably a DST
* cycle. This consumes two transitions so we want only * cycle. This consumes two transitions so we want only
@ -663,7 +663,7 @@ TimeZoneProvider::parse_file(const std::string& tzname)
{ {
last_rule = new_rule; last_rule = new_rule;
auto year = last_time.date().year(); auto year = last_time.date().year();
zone_vector.push_back(zone_from_rule(year, new_rule)); m_zone_vector.push_back(zone_from_rule(year, new_rule));
} }
} }
} }
@ -678,9 +678,9 @@ TimeZoneProvider::parse_file(const std::string& tzname)
* period then the zone rescinded DST and we need a final no-dstzone. * period then the zone rescinded DST and we need a final no-dstzone.
*/ */
if (last_time.is_not_a_date_time()) if (last_time.is_not_a_date_time())
zone_vector.push_back(zone_no_dst(max_year, last_info)); m_zone_vector.push_back(zone_no_dst(max_year, last_info));
else if (last_time.date().year() < parser.last_year) else if (last_time.date().year() < parser.last_year)
zone_vector.push_back(zone_no_dst(last_time.date().year(), last_info)); m_zone_vector.push_back(zone_no_dst(last_time.date().year(), last_info));
} }
bool bool
@ -695,7 +695,7 @@ TimeZoneProvider::construct(const std::string& tzname)
try try
{ {
TZ_Ptr zone(new PTZ(tzname)); TZ_Ptr zone(new PTZ(tzname));
zone_vector.push_back(std::make_pair(max_year, zone)); m_zone_vector.push_back(std::make_pair(max_year, zone));
} }
catch(std::exception& err) catch(std::exception& err)
{ {
@ -705,7 +705,7 @@ TimeZoneProvider::construct(const std::string& tzname)
return true; return true;
} }
TimeZoneProvider::TimeZoneProvider(const std::string& tzname) : zone_vector {} TimeZoneProvider::TimeZoneProvider(const std::string& tzname) : m_zone_vector {}
{ {
if(construct(tzname)) if(construct(tzname))
return; return;
@ -722,7 +722,7 @@ TimeZoneProvider::TimeZoneProvider(const std::string& tzname) : zone_vector {}
{ {
DEBUG("/etc/localtime invalid, resorting to GMT."); DEBUG("/etc/localtime invalid, resorting to GMT.");
TZ_Ptr zone(new PTZ("UTC0")); TZ_Ptr zone(new PTZ("UTC0"));
zone_vector.push_back(std::make_pair(max_year, zone)); m_zone_vector.push_back(std::make_pair(max_year, zone));
} }
} }
#endif #endif
@ -731,11 +731,11 @@ TimeZoneProvider::TimeZoneProvider(const std::string& tzname) : zone_vector {}
TZ_Ptr TZ_Ptr
TimeZoneProvider::get(int year) const noexcept TimeZoneProvider::get(int year) const noexcept
{ {
if (zone_vector.empty()) if (m_zone_vector.empty())
return TZ_Ptr(new PTZ("UTC0")); return TZ_Ptr(new PTZ("UTC0"));
auto iter = find_if(zone_vector.rbegin(), zone_vector.rend(), auto iter = find_if(m_zone_vector.rbegin(), m_zone_vector.rend(),
[=](TZ_Entry e) { return e.first <= year; }); [=](TZ_Entry e) { return e.first <= year; });
if (iter == zone_vector.rend()) if (iter == m_zone_vector.rend())
return zone_vector.front().second; return m_zone_vector.front().second;
return iter->second; return iter->second;
} }

View File

@ -60,7 +60,7 @@ public:
private: private:
void parse_file(const std::string& tzname); void parse_file(const std::string& tzname);
bool construct(const std::string& tzname); bool construct(const std::string& tzname);
TZ_Vector zone_vector; TZ_Vector m_zone_vector;
#if PLATFORM(WINDOWS) #if PLATFORM(WINDOWS)
void load_windows_dynamic_tz(HKEY, time_zone_names); void load_windows_dynamic_tz(HKEY, time_zone_names);
void load_windows_classic_tz(HKEY, time_zone_names); void load_windows_classic_tz(HKEY, time_zone_names);