Files
comaps/storage/downloader_search_params.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

58 lines
1.3 KiB
C++

#pragma once
#include "storage/storage_defines.hpp"
#include <functional>
#include <string>
#include <vector>
namespace storage
{
struct DownloaderSearchResult
{
DownloaderSearchResult(CountryId const & countryId, std::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;
}
CountryId m_countryId;
std::string m_matchedName;
};
struct DownloaderSearchResults
{
DownloaderSearchResults() : m_endMarker(false) {}
std::vector<DownloaderSearchResult> m_results;
std::string m_query;
// |m_endMarker| is true iff it's the last call of OnResults callback for the search.
bool m_endMarker;
};
struct DownloaderSearchParams
{
std::string m_query;
std::string m_inputLocale;
using OnResults = std::function<void(DownloaderSearchResults)>;
OnResults m_onResults;
};
inline std::string DebugPrint(DownloaderSearchResult const & r)
{
return "(" + r.m_countryId + " " + r.m_matchedName + ")";
}
} // namespace storage