diff --git a/storage/storage.cpp b/storage/storage.cpp index 7df8dd63ca..2e36c7651d 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -1145,19 +1145,4 @@ void Storage::DoClickOnDownloadMap(TCountryId const & countryId) if (m_downloadMapOnTheMap) m_downloadMapOnTheMap(countryId); } - -void Storage::ForEachInSubtree(TCountryId const & root, TForEachFunction && toDo) const -{ - TCountriesContainer const * const rootNode = m_countries.Find(Country(root)); - if (rootNode == nullptr) - { - ASSERT(false, ("TCountryId =", root, "not found in m_countries.")); - return; - } - rootNode->ForEachInSubtree([&toDo](TCountriesContainer const & countryContainer) - { - Country const & value = countryContainer.Value(); - toDo(value.Name(), value.GetSubtreeMwmCounter() != 1 /* expandableNode. */); - }); -} } // namespace storage diff --git a/storage/storage.hpp b/storage/storage.hpp index adba9168ce..b03024298e 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -76,7 +76,6 @@ public: using TUpdate = function; using TChangeCountryFunction = function; using TProgressFunction = function; - using TForEachFunction = function; private: /// We support only one simultaneous request at the moment @@ -232,10 +231,6 @@ public: /// a list of available maps. They are all available countries expect for fully downloaded /// countries. That means all mwm of the countries have been downloaded. void GetCountyListToDownload(TCountriesVec & countryList) const; - /// \brief Calls |toDo| for each node for subtree with |root|. - /// For example ForEachInSubtree(GetRootId()) calls |toDo| for every node including - /// the result of GetRootId() call. - void ForEachInSubtree(TCountryId const & root, TForEachFunction && toDo) const; /// \brief Returns current version for mwms which are available on the server. inline int64_t GetCurrentDataVersion() const { return m_currentVersion; } @@ -285,6 +280,25 @@ public: /// \return false in case of error and true otherwise. bool UpdateAllAndChangeHierarchy(); + /// \brief Calls |toDo| for each node for subtree with |root|. + /// For example ForEachInSubtree(GetRootId()) calls |toDo| for every node including + /// the result of GetRootId() call. + template + void ForEachInSubtree(TCountryId const & root, ToDo && toDo) const + { + TCountriesContainer const * const rootNode = m_countries.Find(Country(root)); + if (rootNode == nullptr) + { + ASSERT(false, ("TCountryId =", root, "not found in m_countries.")); + return; + } + rootNode->ForEachInSubtree([&toDo](TCountriesContainer const & countryContainer) + { + Country const & value = countryContainer.Value(); + toDo(value.Name(), value.GetSubtreeMwmCounter() != 1 /* expandableNode. */); + }); + } + /// \brief Subscribe on change status callback. /// \returns a unique index of added status callback structure. size_t SubscribeStatusCallback(StatusCallback const & statusCallbacks);