MCPcopy Create free account
hub / github.com/comaps/comaps / ForEachCountry

Method ForEachCountry

libs/search/geocoder.cpp:877–898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

875
876template <typename Fn>
877void Geocoder::ForEachCountry(ExtendedMwmInfos const & extendedInfos, Fn && fn)
878{
879 for (size_t i = 0; i < extendedInfos.m_infos.size(); ++i)
880 {
881 auto const & info = extendedInfos.m_infos[i].m_info;
882 if (info->GetType() != MwmInfo::COUNTRY && info->GetType() != MwmInfo::WORLD)
883 continue;
884 if (info->GetType() == MwmInfo::COUNTRY && m_params.m_mode == Mode::Downloader)
885 continue;
886
887 auto handle = m_dataSource.GetMwmHandleById(MwmSet::MwmId(info));
888 if (!handle.IsAlive())
889 continue;
890 auto & value = *handle.GetValue();
891 if (!value.HasSearchIndex() || !value.HasGeometryIndex())
892 continue;
893 bool const updatePreranker = i + 1 >= extendedInfos.m_firstBatchSize;
894 auto const & mwmType = extendedInfos.m_infos[i].m_type;
895 if (fn(make_unique<MwmContext>(std::move(handle), mwmType), updatePreranker) == base::ControlFlow::Break)
896 break;
897 }
898}
899
900void Geocoder::MatchCategories(BaseContext & ctx, bool aroundPivot)
901{

Callers 1

Calls 8

MwmIdClass · 0.85
HasSearchIndexMethod · 0.80
HasGeometryIndexMethod · 0.80
sizeMethod · 0.45
GetTypeMethod · 0.45
GetMwmHandleByIdMethod · 0.45
IsAliveMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected