| 137 | |
| 138 | template <class Scanner> |
| 139 | Status JsonParser<Scanner>::CountJsonObjects(int max_rows, int* num_rows) { |
| 140 | JsonSkipper<CharStream> skipper(stream_); |
| 141 | while (*num_rows < max_rows) { |
| 142 | skipper.SkipNextObject(); |
| 143 | |
| 144 | if (UNLIKELY(skipper.HasError())) { |
| 145 | if (skipper.GetErrorCode() == kParseErrorDocumentEmpty) { |
| 146 | // See the comments at the corresponding location of the Parse(). |
| 147 | if (UNLIKELY(!stream_.Eos())) { |
| 148 | DCHECK_EQ(stream_.Peek(), '\0'); |
| 149 | stream_.Take(); |
| 150 | continue; |
| 151 | } |
| 152 | return Status::OK(); |
| 153 | } |
| 154 | RETURN_IF_ERROR(scanner_->HandleError(skipper.GetErrorCode(), stream_.Tell())); |
| 155 | |
| 156 | // See the comments at the corresponding location of the Parse(). |
| 157 | if (reader_.GetParseErrorCode() != kParseErrorObjectMissCommaOrCurlyBracket) { |
| 158 | MoveToNextJson(); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | ++(*num_rows); |
| 163 | if (UNLIKELY(scanner_->BreakParse())) break; |
| 164 | } |
| 165 | |
| 166 | return Status::OK(); |
| 167 | } |
| 168 | |
| 169 | template <class Scanner> |
| 170 | bool JsonParser<Scanner>::Key(const char* str, uint32_t len, bool copy) { |
no test coverage detected