diff options
author | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-16 13:28:07 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:56:32 +0300 |
commit | d49ebd87ffed2af9b967a50e1f4751b5a1015fb5 (patch) | |
tree | 3ead531e9c24ef3c78ac4f1658ce4edb1e7a4781 /storage/storage.hpp | |
parent | 2b23a2580edcf4bb63a87762bda18a58862c958a (diff) |
[new downloader] Fix calling callbacks for country being deleted
Diffstat (limited to 'storage/storage.hpp')
-rw-r--r-- | storage/storage.hpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/storage/storage.hpp b/storage/storage.hpp index 42cd918d8e..afc108f787 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -106,7 +106,9 @@ class Storage { public: struct StatusCallback; - using TUpdate = function<void(platform::LocalCountryFile const &)>; + using TLocalFilePtr = shared_ptr<platform::LocalCountryFile>; + using TUpdateCallback = function<void(storage::TCountryId const &, TLocalFilePtr const)>; + using TDeleteCallback = function<bool(storage::TCountryId const &, TLocalFilePtr const)>; using TChangeCountryFunction = function<void(TCountryId const &)>; using TProgressFunction = function<void(TCountryId const &, TLocalAndRemoteSize const &)>; using TQueue = list<QueuedCountry>; @@ -141,7 +143,6 @@ private: /// stores countries whose download has failed recently TCountriesSet m_failedCountries; - using TLocalFilePtr = shared_ptr<platform::LocalCountryFile>; map<TCountryId, list<TLocalFilePtr>> m_localFiles; // Our World.mwm and WorldCoasts.mwm are fake countries, together with any custom mwm in data @@ -171,8 +172,12 @@ private: //@} // This function is called each time all files requested for a - // country were successfully downloaded. - TUpdate m_update; + // country are successfully downloaded. + TUpdateCallback m_didDownload; + + // This function is called each time all files for a + // country are deleted. + TDeleteCallback m_willDelete; // If |m_dataDir| is not empty Storage will create version directories and download maps in // platform::WritableDir/|m_dataDir|/. Not empty |m_dataDir| can be used only for @@ -246,7 +251,7 @@ public: Storage(string const & referenceCountriesTxtJsonForTesting, unique_ptr<MapFilesDownloader> mapDownloaderForTesting); - void Init(TUpdate const & update); + void Init(TUpdateCallback const & didDownload, TDeleteCallback const & willDelete); /// @name Interface with clients (Android/iOS). /// \brief It represents the interface which can be used by clients (Android/iOS). |