| 88 | // Calls |fn| for each pair of |lang| and |utf8s| stored in this multilang string. |
| 89 | template <typename Fn> |
| 90 | void ForEach(Fn && fn) const |
| 91 | { |
| 92 | size_t i = 0; |
| 93 | size_t const sz = m_s.size(); |
| 94 | base::ControlFlowWrapper<Fn> wrapper(std::forward<Fn>(fn)); |
| 95 | while (i < sz) |
| 96 | { |
| 97 | size_t const next = GetNextIndex(i); |
| 98 | localisation::LanguageIndex const languageIndex = m_s[i] & kLangCodeMask; |
| 99 | if (localisation::ConvertLanguageIndexToLanguageCode(languageIndex) != localisation::kReservedLanguageCode && |
| 100 | wrapper(languageIndex, std::string_view(m_s).substr(i + 1, next - i - 1)) == base::ControlFlow::Break) |
| 101 | { |
| 102 | break; |
| 103 | } |
| 104 | i = next; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | /* |
| 109 | /// Used for ordered languages, if you want to do something with priority of that order. |