| 415 | } |
| 416 | |
| 417 | bool 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 | |
| 444 | size_t CodeLength(const std::string &code) { |
| 445 | std::string clean_code = clean_code_chars(code); |
no test coverage detected