| 1514 | |
| 1515 | template <ApiDumpFormat Format, typename T, typename DumpElement> |
| 1516 | void dump_pointer_array(const T *array, size_t len, const ApiDumpSettings &settings, const char *type_string, const char *name, |
| 1517 | const char *element_type, int indents, DumpElement dump_element) { |
| 1518 | if (array == NULL || len == 0) { |
| 1519 | dump_nullptr<Format>(settings, type_string, name, indents); |
| 1520 | return; |
| 1521 | } |
| 1522 | dump_array_start<Format>(array, len, settings, type_string, name, indents); |
| 1523 | for (size_t i = 0; i < len; ++i) { |
| 1524 | std::stringstream stream; |
| 1525 | if constexpr (Format == ApiDumpFormat::Text || Format == ApiDumpFormat::Html) { |
| 1526 | stream << name; |
| 1527 | } |
| 1528 | stream << "[" << i << "]"; |
| 1529 | std::string indexName = stream.str(); |
| 1530 | dump_element(array[i], settings, element_type, indexName.c_str(), indents + (Format == ApiDumpFormat::Json ? 2 : 1), |
| 1531 | array + i); |
| 1532 | if constexpr (Format == ApiDumpFormat::Json) { |
| 1533 | if (i < len - 1) settings.stream() << ','; |
| 1534 | settings.stream() << "\n"; |
| 1535 | } |
| 1536 | } |
| 1537 | dump_array_end<Format>(array, len, settings, indents); |
| 1538 | } |
| 1539 | |
| 1540 | template <ApiDumpFormat Format, typename T, typename DumpElement> |
| 1541 | void dump_double_pointer_array(const T *const *array, size_t len, const ApiDumpSettings &settings, const char *type_string, |