| 138 | } |
| 139 | |
| 140 | Status FindLast(std::string_view block, int64_t* out_pos) override { |
| 141 | const size_t block_length = block.size(); |
| 142 | size_t consumed_length = 0; |
| 143 | while (consumed_length < block_length) { |
| 144 | rj::MemoryStream ms(reinterpret_cast<const char*>(block.data()), block.size()); |
| 145 | using InputStream = rj::EncodedInputStream<rj::UTF8<>, rj::MemoryStream>; |
| 146 | auto length = ConsumeWholeObject(InputStream(ms)); |
| 147 | if (length == string_view::npos || length == 0) { |
| 148 | // found incomplete object or block is empty |
| 149 | break; |
| 150 | } |
| 151 | consumed_length += length; |
| 152 | block = block.substr(length); |
| 153 | } |
| 154 | if (consumed_length == 0) { |
| 155 | *out_pos = -1; |
| 156 | } else { |
| 157 | consumed_length += ConsumeWhitespace(block); |
| 158 | DCHECK_LE(consumed_length, block_length); |
| 159 | *out_pos = static_cast<int64_t>(consumed_length); |
| 160 | } |
| 161 | return Status::OK(); |
| 162 | } |
| 163 | |
| 164 | Status FindNth(std::string_view partial, std::string_view block, int64_t count, |
| 165 | int64_t* out_pos, int64_t* num_found) override { |
nothing calls this directly
no test coverage detected