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

Function ValidateWebsite

libs/indexer/validate_and_format_contacts.cpp:407–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407bool ValidateWebsite(string const & site)
408{
409 if (site.empty())
410 return true;
411
412 auto const startPos = GetProtocolNameLength(site);
413
414 // check lengt and leave room for addition of 'http://'
415 if (strings::CountChar(site) > (IsProtocolSpecified(site) ? kMaximumOsmChars : kMaximumOsmChars - 7))
416 return false;
417
418 if (startPos >= site.size())
419 return false;
420
421 // Site should contain at least one dot but not at the beginning/end.
422 if ('.' == site[startPos] || '.' == site.back())
423 return false;
424
425 if (string::npos == site.find('.'))
426 return false;
427
428 if (string::npos != site.find(".."))
429 return false;
430
431 return true;
432}
433
434bool ValidateFacebookPage(string const & page)
435{

Callers 15

ValidateAndFormat_vkFunction · 0.85
ValidateFacebookPageFunction · 0.85
ValidateInstagramPageFunction · 0.85
ValidateTwitterPageFunction · 0.85
ValidateVkPageFunction · 0.85
ValidateLinePageFunction · 0.85

Calls 7

GetProtocolNameLengthFunction · 0.85
CountCharFunction · 0.85
IsProtocolSpecifiedFunction · 0.85
backMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.68