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

Function IsFull

3party/open-location-code/openlocationcode.cc:417–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415}
416
417bool IsFull(const std::string &code) {
418 if (!IsValid(code)) {
419 return false;
420 }
421 // If it's short, it's not full.
422 if (IsShort(code)) {
423 return false;
424 }
425 // Work out what the first latitude character indicates for latitude.
426 size_t firstLatValue = get_alphabet_position(code.at(0));
427 firstLatValue *= internal::kEncodingBase;
428 if (firstLatValue >= internal::kLatitudeMaxDegrees * 2) {
429 // The code would decode to a latitude of >= 90 degrees.
430 return false;
431 }
432 if (code.size() > 1) {
433 // Work out what the first longitude character indicates for longitude.
434 size_t firstLngValue = get_alphabet_position(code.at(1));
435 firstLngValue *= internal::kEncodingBase;
436 if (firstLngValue >= internal::kLongitudeMaxDegrees * 2) {
437 // The code would decode to a longitude of >= 180 degrees.
438 return false;
439 }
440 }
441 return true;
442}
443
444size_t CodeLength(const std::string &code) {
445 std::string clean_code = clean_code_chars(code);

Callers 9

SearchPlusCodeMethod · 0.85
EmplaceMethod · 0.85
HasBitMethod · 0.85
PopCountMethod · 0.85
UnionMethod · 0.85
IntersectMethod · 0.85
TakeMethod · 0.85
HashMethod · 0.85
ShortenFunction · 0.85

Calls 5

IsShortFunction · 0.85
get_alphabet_positionFunction · 0.85
atMethod · 0.80
IsValidFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected