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

Function MatchFeatureByPostcode

libs/search/retrieval.cpp:231–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231bool MatchFeatureByPostcode(EditableMapObject const & emo, TokenSlice const & slice)
232{
233 auto const tokens = NormalizeAndTokenizeString(emo.GetPostcode());
234 if (slice.Size() > tokens.size())
235 return false;
236 for (size_t i = 0; i < slice.Size(); ++i)
237 {
238 if (slice.IsPrefix(i))
239 {
240 if (!StartsWith(tokens[i], slice.Get(i).GetOriginal()))
241 return false;
242 }
243 else if (tokens[i] != slice.Get(i).GetOriginal())
244 {
245 return false;
246 }
247 }
248 return true;
249}
250
251template <typename Value, typename DFA>
252Retrieval::ExtendedFeatures RetrieveAddressFeaturesImpl(Retrieval::TrieRoot<Value> const & root,

Callers 1

Calls 7

StartsWithFunction · 0.50
GetPostcodeMethod · 0.45
SizeMethod · 0.45
sizeMethod · 0.45
IsPrefixMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected