| 171 | TValue Value; |
| 172 | TString Tmp; |
| 173 | bool Load(IInputStream& in, const bool allowEmptyKey, const bool noValues) { |
| 174 | while (in.ReadLine(Tmp)) { |
| 175 | if (!Tmp) { |
| 176 | // there is a special case for TrieSet with empty keys allowed |
| 177 | if (!(noValues && allowEmptyKey)) { |
| 178 | continue; |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | const size_t sep = Tmp.find('\t'); |
| 183 | if (sep != TString::npos) { |
| 184 | if (0 == sep && !allowEmptyKey) { |
| 185 | continue; |
| 186 | } |
| 187 | Key = TKeyReader()(Tmp.data(), sep); |
| 188 | Value = TValueReader()(Tmp.data() + sep + 1, Tmp.size() - sep - 1); |
| 189 | } else if (noValues) { |
| 190 | RemoveIfLast<TString>(Tmp, '\n'); |
| 191 | Key = TKeyReader()(Tmp.data(), Tmp.size()); |
| 192 | Value = TValue(); |
| 193 | } |
| 194 | return true; |
| 195 | } |
| 196 | return false; |
| 197 | } |
| 198 | }; |
| 199 | |
| 200 | template <class TTKey, class TTKeyChar, class T, |
no test coverage detected