Get number of downloaded countries (files) from Storage.

This commit is contained in:
Alex Zolotarev 2015-08-06 21:46:07 +03:00
parent 094410e506
commit 0601d889b7
2 changed files with 11 additions and 3 deletions

View file

@ -149,7 +149,7 @@ void Storage::RegisterAllLocalMaps()
}
}
void Storage::GetLocalMaps(vector<CountryFile> & maps)
void Storage::GetLocalMaps(vector<CountryFile> & maps) const
{
for (auto const & p : m_localFiles)
{
@ -160,6 +160,11 @@ void Storage::GetLocalMaps(vector<CountryFile> & maps)
maps.push_back(p.second->GetCountryFile());
}
size_t Storage::GetDownloadedFilesCount() const
{
return m_localFiles.size();
}
CountriesContainerT const & NodeFromIndex(CountriesContainerT const & root, TIndex const & index)
{
// complex logic to avoid [] out_of_bounds exceptions

View file

@ -48,6 +48,7 @@ private:
using TLocalFilePtr = shared_ptr<platform::LocalCountryFile>;
map<TIndex, list<TLocalFilePtr>> m_localFiles;
// Our World.mwm and WorldCoasts.mwm are fake countries, together with any custom mwm in data folder.
map<platform::CountryFile, TLocalFilePtr> m_localFilesForFakeCountries;
/// used to correctly calculate total country download progress with more than 1 file
@ -114,8 +115,10 @@ public:
// *NOTE* storage will forget all already known local maps.
void RegisterAllLocalMaps();
// Returns list of all local maps, including fake countries.
void GetLocalMaps(vector<platform::CountryFile> & maps);
// Returns list of all local maps, including fake countries (World*.mwm).
void GetLocalMaps(vector<platform::CountryFile> & maps) const;
// Returns number of downloaded maps (files), excluding fake countries (World*.mwm).
size_t GetDownloadedFilesCount() const;
/// @return unique identifier that should be used with Unsubscribe function
int Subscribe(TChangeCountryFunction const & change, TProgressFunction const & progress);