Added CheckFailedCountries method.

This commit is contained in:
Ilya Grechuhin 2016-04-25 13:28:33 +03:00
parent d876587dcf
commit fc8ead20e5
2 changed files with 14 additions and 2 deletions

View file

@ -89,7 +89,7 @@ void GetQueuedCountries(Storage::TQueue const & queue, TCountriesSet & resultCou
resultCountries.insert(country.GetCountryId());
}
MapFilesDownloader::TProgress Storage::GetOverallProgress(TCountriesVec const & countries)
MapFilesDownloader::TProgress Storage::GetOverallProgress(TCountriesVec const & countries) const
{
MapFilesDownloader::TProgress overallProgress = {0, 0};
for (auto const & country : countries)
@ -1132,6 +1132,16 @@ string Storage::GetFileDownloadPath(TCountryId const & countryId, MapOptions fil
return platform::GetFileDownloadPath(GetCurrentDataVersion(), m_dataDir, GetCountryFile(countryId), file);
}
bool Storage::CheckFailedCountries(TCountriesVec const & countries) const
{
for (auto const & country : countries)
{
if (m_failedCountries.count(country))
return true;
}
return false;
}
TCountryId const Storage::GetRootId() const
{
return m_countries.GetRoot().Value().Name();

View file

@ -319,6 +319,8 @@ public:
inline bool IsAutoRetryDownloadFailed() const { return m_autoRetryCounter == 0; }
bool CheckFailedCountries(TCountriesVec const & countries) const;
/// \brief Returns root country id of the country tree.
TCountryId const GetRootId() const;
@ -468,7 +470,7 @@ public:
/// Returns information about selected counties downloading progress.
/// |countries| - watched CountryId, ONLY leaf expected.
MapFilesDownloader::TProgress GetOverallProgress(TCountriesVec const &countries);
MapFilesDownloader::TProgress GetOverallProgress(TCountriesVec const &countries) const;
Country const & CountryLeafByCountryId(TCountryId const & countryId) const;
Country const & CountryByCountryId(TCountryId const & countryId) const;