From 143a3b24a9794404c4250dd699c559a637b08ccf Mon Sep 17 00:00:00 2001 From: vng Date: Thu, 11 Jun 2015 15:57:12 +0300 Subject: [PATCH] Review fixes. --- map/active_maps_layout.cpp | 4 ++-- map/active_maps_layout.hpp | 15 +++++++++++---- storage/storage.hpp | 2 ++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/map/active_maps_layout.cpp b/map/active_maps_layout.cpp index de295ca8ba..e4fce36dd1 100644 --- a/map/active_maps_layout.cpp +++ b/map/active_maps_layout.cpp @@ -9,12 +9,12 @@ namespace storage bool ActiveMapsLayout::Item::IsEqual(TIndex const & index) const { - return (find(m_index.begin(), m_index.end(), index) != m_index.end()); + return (find(m_indexes.begin(), m_indexes.end(), index) != m_indexes.end()); } bool ActiveMapsLayout::Item::IsEqual(Item const & item) const { - for (TIndex const & i : m_index) + for (TIndex const & i : m_indexes) if (item.IsEqual(i)) return true; return false; diff --git a/map/active_maps_layout.hpp b/map/active_maps_layout.hpp index 3c55568577..8c3ae584ac 100644 --- a/map/active_maps_layout.hpp +++ b/map/active_maps_layout.hpp @@ -103,21 +103,28 @@ private: class Item { - buffer_vector m_index; + /// Usually, this vector has size = 1 and sometimes = 2. + buffer_vector m_indexes; + public: template Item(TCont const & cont, TStatus status, TMapOptions options, TMapOptions downloadRequest) - : m_index(cont.begin(), cont.end()), m_status(status), + : m_indexes(cont.begin(), cont.end()), m_status(status), m_options(options), m_downloadRequest(downloadRequest) { - ASSERT(!m_index.empty(), ()); + ASSERT(!m_indexes.empty(), ()); } + /// Use this functions to compare Items by input TIndex. + //@{ bool IsEqual(TIndex const & index) const; bool IsEqual(Item const & item) const; - TIndex const & Index() const { return m_index[0]; } + //@} + + /// Get any key TIndex for the correspondent Item. + TIndex const & Index() const { return m_indexes[0]; } TStatus m_status; TMapOptions m_options; diff --git a/storage/storage.hpp b/storage/storage.hpp index 342e7b61a6..60c1f5461d 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -119,6 +119,8 @@ namespace storage Country const & CountryByIndex(TIndex const & index) const; TIndex FindIndexByFile(string const & name) const; + /// @todo Temporary function to gel all associated indexes for the country file name. + /// Will be removed in future after refactoring. vector FindAllIndexesByFile(string const & name) const; void GetGroupAndCountry(TIndex const & index, string & group, string & country) const;