blob: 2312b9033b762914a132f1a2b01d9a6dbc5e6541 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#pragma once
#include "storage/index.hpp"
#include <functional>
#include <string>
#include <vector>
namespace storage
{
struct DownloaderSearchResult
{
DownloaderSearchResult(TCountryId const & countryId, string const & matchedName)
: m_countryId(countryId), m_matchedName(matchedName)
{
}
bool operator==(DownloaderSearchResult const & rhs) const
{
return m_countryId == rhs.m_countryId && m_matchedName == rhs.m_matchedName;
}
bool operator<(DownloaderSearchResult const & rhs) const
{
if (m_countryId != rhs.m_countryId)
return m_countryId < rhs.m_countryId;
return m_matchedName < rhs.m_matchedName;
}
TCountryId m_countryId;
/// \brief |m_matchedName| is a name of found feature in case of searching in World.mwm
/// and is a local name of mwm (group or leaf) in case of searching in country tree.
std::string m_matchedName;
};
struct DownloaderSearchResults
{
DownloaderSearchResults() : m_endMarker(false) {}
std::vector<DownloaderSearchResult> m_results;
std::string m_query;
/// \brief |m_endMarker| == true if it's the last call of TOnResults callback for the search.
/// Otherwise |m_endMarker| == false.
bool m_endMarker;
};
struct DownloaderSearchParams
{
using OnResults = std::function<void(DownloaderSearchResults const &)>;
OnResults m_onResults;
std::string m_query;
std::string m_inputLocale;
};
inline std::string DebugPrint(DownloaderSearchResult const & r)
{
return "(" + r.m_countryId + " " + r.m_matchedName + ")";
}
} // namespace storage
|