[new downloader] Implementing method Storage::GetNodeStatuses() for quick getting statuses.

This commit is contained in:
Vladimir Byko-Ianko 2016-03-04 18:25:31 +03:00 committed by Sergey Yershov
parent aca1e1000b
commit 0d7951141b
2 changed files with 26 additions and 1 deletions

View file

@ -1331,6 +1331,19 @@ void Storage::GetNodeAttrs(TCountryId const & countryId, NodeAttrs & nodeAttrs)
}
}
void Storage::GetNodeStatuses(TCountryId const & countryId, NodeStatuses & nodeStatuses) const
{
ASSERT_THREAD_CHECKER(m_threadChecker, ());
TCountryTreeNode const * const node = m_countries.FindFirst(countryId);
CHECK(node, ());
StatusAndError statusAndErr = GetNodeStatus(*node);
nodeStatuses.m_status = statusAndErr.status;
nodeStatuses.m_error = statusAndErr.error;
nodeStatuses.m_groupNode = (node->ChildrenCount() != 0);
}
void Storage::SetCallbackForClickOnDownloadMap(TDownloadFn & downloadFn)
{
ASSERT_THREAD_CHECKER(m_threadChecker, ());

View file

@ -92,6 +92,15 @@ struct NodeAttrs
bool m_present;
};
/// \brief Statuses for a node in the country tree.
/// It's applicable for expandable and not expandable node id.
struct NodeStatuses
{
NodeStatus m_status;
NodeErrorCode m_error;
bool m_groupNode;
};
/// This class is used for downloading, updating and deleting maps.
class Storage
{
@ -286,9 +295,12 @@ public:
/// and World.mwm and WorldCoasts.mwm.
bool IsNodeDownloaded(TCountryId const & countryId) const;
/// \brief Gets all the attributes for a node by its countryId.
/// \brief Gets all the attributes for a node by its |countryId|.
/// \param |nodeAttrs| is filled with attributes in this method.
void GetNodeAttrs(TCountryId const & countryId, NodeAttrs & nodeAttrs) const;
/// \brief Gets a short list of node attributes by its |countriId|.
/// \note This method works quicklier than GetNodeAttrs().
void GetNodeStatuses(TCountryId const & countryId, NodeStatuses & nodeStatuses) const;
string GetNodeLocalName(TCountryId const & countryId) const { return m_countryNameGetter(countryId); }