Welcome to mirror list, hosted at ThFree Co, Russian Federation.

taxi_places.cpp « partners_api - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2114f5b4c794d48261ab048fe82bbe13379343e1 (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
#include "partners_api/taxi_places.hpp"

#include <algorithm>

namespace taxi
{
bool Places::IsCountriesEmpty() const { return m_countries.empty(); }
bool Places::IsMwmsEmpty() const { return m_mwmIds.empty(); }

bool Places::Has(storage::CountryId const & id, std::string const & city) const
{
  auto const countryIt =
      std::find_if(m_countries.cbegin(), m_countries.cend(),
                   [&id](Country const & country) { return country.m_id == id; });

  if (countryIt == m_countries.cend())
    return false;

  auto const & cities = countryIt->m_cities;

  if (cities.empty())
    return true;

  auto const cityIt = std::find_if(cities.cbegin(), cities.cend(),
                                   [&city](std::string const & c) { return c == city; });

  return cityIt != cities.cend();
}

bool Places::Has(storage::CountryId const & mwmId) const
{
  return m_mwmIds.find(mwmId) != m_mwmIds.cend();
}
}  // namespace taxi