extractor
現状のヘッダーのまま、試しにラッパーを被せてインタフェースを統一して、簡単な展開プログラムを作ってみました。
extract.cpp
フォーマットはlzh/zip/tar/tar.gz/tar.bz2/tgz/tbzに対応しています。
ヘッダの情報はこれにまとめました。
// TR2のものとほぼ同じ enum file_type { regular_file, hard_link_file, // これが特殊 symlink_file, block_file, character_file, directory_file, fifo_file, socket_file, type_unknown }; struct timestamp { boost::int64_t seconds; boost::uint32_t nanoseconds; }; struct entry { file_type type; boost::filesystem::path path; boost::filesystem::path link_path; boost::optional<boost::uintmax_t> compressed_size; boost::optional<boost::uintmax_t> file_size; boost::optional<boost::uint16_t> crc16_checksum; boost::optional<boost::uint32_t> crc32_checksum; boost::optional<timestamp> last_write_time; boost::optional<timestamp> last_access_time; boost::optional<timestamp> last_change_time; boost::optional<timestamp> creation_time; boost::optional<boost::uint16_t> attributes; boost::optional<boost::uint16_t> permission; boost::optional<boost::intmax_t> uid; boost::optional<boost::intmax_t> gid; std::string user_name; std::string group_name; std::string comment; };
チェックサムが2つ存在するのが変な感じです。
チェックサムは削っても良いかもしれません。
type,attributes,permissionは一部情報が重複しているので、分解/統合をすべきですかね。
値をセットするときはネイティブなデータなので楽なんですけど。