How se-team14-mini-project/file-compression-tool works
This is a C++17 command-line utility for lossless single-file compression and decompression using a custom Huffman-based .huf format, with archive inspection and safety checks. The main workflow is CLI command dispatch → controller orchestration → file validation, Huffman processing, archive serialization or parsing, and safe output publication. Metadata validation and decoded-file integrity checking are distinct safeguards; info inspects metadata without decoding. The README documents the planned component hand-offs, while excerpts show selected calls and validation behavior; links based only on the documented architecture cite the README.
Main entry points: controller.cpp Operation controller · main.cpp Command dispatch · archive.cpp Archive read/write · interfaces.h Shared format contract
Components 14
CLI
- Command dispatch
src/main.cpp
Compression workflow
- Operation controller
src/controller.cpp - Frequency analysis
src/huffman.cpp - Tree and codes
src/huffman.cpp - Bit codec
src/huffman.cpp
Archive format
- Archive read/write
src/archive.cpp - Shared format contract
include/interfaces.h
Validation and safety
- File checks
src/file_io.cpp - Metadata validation
src/validation.cpp - Output path safety
src/validation.cpp - Decoded-file verification
src/validation.cpp - CRC32 handling
src/controller.cpp - Safe output publish
src/controller.cpp
Other components
- User
Connections 18
- User → Command dispatch: runs command
README.md - Command dispatch → Operation controller: dispatches operations
src/main.cpp - Command dispatch → Operation controller: requests archive info
src/main.cpp - Operation controller → File checks: checks files
README.md - Operation controller → Output path safety: validates output
README.md - Operation controller → Frequency analysis: counts bytes
src/controller.cpp - Frequency analysis → Tree and codes: builds Huffman model
README.md - Operation controller → Tree and codes: builds tree and codes
README.md - Operation controller → Bit codec: encodes or decodes
src/controller.cpp - Operation controller → Archive read/write: writes or reads archive
README.md - Archive read/write → Metadata validation: checks structure
src/archive.cpp - Operation controller → Metadata validation: validates metadata
README.md - Operation controller → Decoded-file verification: verifies restored file
README.md - Operation controller → CRC32 handling: checks checksum
README.md - Operation controller → Safe output publish: publishes output
src/controller.cpp - Archive read/write → Shared format contract: uses format declarations
README.md - Operation controller → Shared format contract: uses shared declarations
README.md - Command dispatch → Shared format contract: uses result types
README.md