| 406 | } |
| 407 | } |
| 408 | void ArrayStart(std::string array_name, size_t element_count = 0) { |
| 409 | switch (output_type) { |
| 410 | case (OutputType::text): { |
| 411 | out << std::string(static_cast<size_t>(get_top().indents), '\t') << array_name << ":"; |
| 412 | size_t underline_count = array_name.size() + 1; |
| 413 | if (element_count > 0) { |
| 414 | out << " count = " << element_count; |
| 415 | underline_count += 9 + std::to_string(element_count).size(); |
| 416 | } |
| 417 | out << "\n"; |
| 418 | PrintHeaderUnderlines(underline_count); |
| 419 | break; |
| 420 | } |
| 421 | case (OutputType::html): |
| 422 | out << std::string(static_cast<size_t>(get_top().indents), '\t'); |
| 423 | if (get_top().set_details_open || get_top().should_always_open) { |
| 424 | out << "<details open>"; |
| 425 | get_top().set_details_open = false; |
| 426 | } else { |
| 427 | out << "<details>"; |
| 428 | } |
| 429 | out << "<summary>" << array_name; |
| 430 | if (element_count > 0) { |
| 431 | out << ": count = <span class='val'>" << element_count << "</span>"; |
| 432 | } |
| 433 | out << "</summary>\n"; |
| 434 | break; |
| 435 | case (OutputType::json): |
| 436 | case (OutputType::vkconfig_output): |
| 437 | if (!get_top().is_first_item) { |
| 438 | out << ",\n"; |
| 439 | } else { |
| 440 | get_top().is_first_item = false; |
| 441 | } |
| 442 | out << std::string(static_cast<size_t>(get_top().indents), '\t'); |
| 443 | if (!get_top().is_array) { |
| 444 | out << "\"" << array_name << "\": "; |
| 445 | } |
| 446 | out << "[\n"; |
| 447 | break; |
| 448 | default: |
| 449 | break; |
| 450 | } |
| 451 | push_node(true); |
| 452 | } |
| 453 | void ArrayEnd() { |
| 454 | assert(get_top().is_array == true && "cannot call ArrayEnd while inside an Object"); |
| 455 | object_stack.pop(); |
no test coverage detected