| 22 | |
| 23 | template <class C, class TDelim, typename TChr> |
| 24 | static inline void DoSplit0(C* res, const TBasicStringBuf<TChr> str, TDelim& d, size_t maxFields, int options) { |
| 25 | using TStringType = std::conditional_t<std::is_same<TChr, wchar16>::value, TUtf16String, TString>; |
| 26 | res->clear(); |
| 27 | |
| 28 | if (!str.data()) { |
| 29 | return; |
| 30 | } |
| 31 | |
| 32 | using TConsumer = TContainerConsumer<C>; |
| 33 | TConsumer cc(res); |
| 34 | |
| 35 | if (maxFields) { |
| 36 | TLimitingConsumer<TConsumer, const TChr> lc(maxFields, &cc); |
| 37 | |
| 38 | DoSplit1(lc, d, str, options); |
| 39 | |
| 40 | if (lc.Last) { |
| 41 | res->push_back(TStringType(lc.Last, str.data() + str.size() - lc.Last)); |
| 42 | } |
| 43 | } else { |
| 44 | DoSplit1(cc, d, str, options); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | template <typename TChr> |
| 49 | static void SplitStringImplT(TVector<std::conditional_t<std::is_same<TChr, wchar16>::value, TUtf16String, TString>>* res, |