| 144 | } |
| 145 | |
| 146 | bool ReadRegionData(std::string const & countryName, RegionData & data) |
| 147 | { |
| 148 | // When there is a match for a complete countryName, simply relay the call. |
| 149 | if (ReadRegionDataImpl(countryName, data)) |
| 150 | return true; |
| 151 | |
| 152 | // If not, cut parts of a country name from the tail. E.g. "Russia_Moscow" -> "Russia". |
| 153 | auto p = countryName.find_last_of('_'); |
| 154 | while (p != std::string::npos) |
| 155 | { |
| 156 | if (ReadRegionDataImpl(countryName.substr(0, p), data)) |
| 157 | return true; |
| 158 | p = p > 0 ? countryName.find_last_of('_', p - 1) : std::string::npos; |
| 159 | } |
| 160 | return false; |
| 161 | } |
| 162 | } // namespace feature |
no test coverage detected