Kelsidavis-WoWee/tools/editor/cli_catalog_stats.hpp
Kelsi 69857eea18 feat(editor): add --catalog-stats for single-file deep size analysis
Reports header bytes (magic + version + nameLen + name +
entryCount) vs entry-section bytes, average entry size, total
file size, the catalog's name string length, and the first
entry's id field. Useful for sizing analysis: "which catalogs
are biggest, where do the bytes go, what's the per-entry
overhead".

Goes deeper than --info-magic which just reports the magic +
version + name + count. The byte breakdown distinguishes:
  - headerBytes        — fixed-cost header
  - catalogNameBytes   — variable-length catalog label
  - entrySectionBytes  — total size of all entries combined
  - averageEntryBytes  — entrySectionBytes / entryCount

Only the first entry's id is sampled because entries have
variable-length name+description strings — multi-sampling
produces garbage for most formats. The single sampled id is
reliable because it sits at exactly headerBytes offset.

JSON sidecar via --json. Format metadata (description / category)
is included from the format table when the magic is recognized;
unknown magics still get the size breakdown but no metadata.

This is the 18th cross-format utility; the second per-file
single-target one (alongside --info-magic). CLI flag count
1033 -> 1034.
2026-05-09 23:21:32 -07:00

11 lines
199 B
C++

#pragma once
namespace wowee {
namespace editor {
namespace cli {
bool handleCatalogStats(int& i, int argc, char** argv, int& outRc);
} // namespace cli
} // namespace editor
} // namespace wowee