| 59 | |
| 60 | template <class Scanner> |
| 61 | bool JsonParser<Scanner>::IsTidy() { |
| 62 | // Check if there are no unclosed arrays or objects. |
| 63 | bool no_unclosed_elements = array_depth_ == 0 && object_depth_ == 0; |
| 64 | |
| 65 | // Check if there are no field or row in handling. |
| 66 | bool no_handling_field_or_row = current_field_idx_ == -1 && !row_initialized_; |
| 67 | |
| 68 | // Check if there are no any fields found, i.e. all false in 'field_found_'. |
| 69 | bool no_fields_found = field_found_.size() == 0 || |
| 70 | (field_found_[0] == false && |
| 71 | !memcmp(field_found_.data(), field_found_.data() + 1, field_found_.size() - 1)); |
| 72 | |
| 73 | // Return true if all conditions are met, indicating that the parser is tidy |
| 74 | return no_unclosed_elements && no_handling_field_or_row && no_fields_found; |
| 75 | } |
| 76 | |
| 77 | template <class Scanner> |
| 78 | bool JsonParser<Scanner>::MoveToNextJson() { |
no test coverage detected