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

Method ValidateHouseNumber

libs/indexer/editable_map_object.cpp:484–506  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

482
483// static
484bool EditableMapObject::ValidateHouseNumber(string const & houseNumber)
485{
486 // TODO(mgsergio): Use LooksLikeHouseNumber!
487
488 if (houseNumber.empty())
489 return true;
490
491 strings::UniString us = strings::MakeUniString(houseNumber);
492 // TODO: Improve this basic limit - it was choosen by @Zverik.
493 auto constexpr kMaxHouseNumberLength = 15;
494 if (us.size() > kMaxHouseNumberLength)
495 return false;
496
497 // TODO: Should we allow arabic numbers like U+0661 ١ Arabic-Indic Digit One?
498 strings::NormalizeDigits(us);
499 for (auto const c : us)
500 {
501 // Valid house numbers contain at least one digit.
502 if (strings::IsASCIIDigit(c))
503 return true;
504 }
505 return false;
506}
507
508bool EditableMapObject::CheckHouseNumberWhenIsAddress() const
509{

Callers

nothing calls this directly

Calls 5

MakeUniStringFunction · 0.85
NormalizeDigitsFunction · 0.85
IsASCIIDigitFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected