🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
CompressorImplTar.hpp
浏览该文件的文档.
1
21
22#pragma once
23
24#include "AstUtil/CompressorInterface.hpp"
25#include "AstUtil/FileSystem.hpp"
26#include "AstUtil/StringView.hpp"
27#include "AstUtil/ArchiverUtils.hpp"
28
29#include <string>
30
31AST_NAMESPACE_BEGIN
32
36class AST_UTIL_API CompressorImplTar : public CompressorInterface
37{
38public:
39 static CompressorImplTar& Instance();
40
41 CompressorImplTar() = default;
42 virtual ~CompressorImplTar() = default;
43
44 virtual errc_t compress(StringView source, StringView target, StringView curdir = {}) const override;
45 virtual bool canCompress(StringView source, StringView target) const override;
46
47private:
49 static errc_t writeFileEntry(FILE* dst, const std::string& name,
50 const std::string& filePath);
51
53 static errc_t writeDirectoryEntry(FILE* dst, const std::string& name);
54
56 static errc_t archiveDirectory(FILE* dst, const fs::path& dirPath,
57 const std::string& basePath);
58};
59
60AST_NAMESPACE_END
定义 CompressorImplTar.hpp:37
定义 CompressorInterface.hpp:36
virtual errc_t compress(StringView source, StringView target, StringView curdir={}) const =0
压缩文件或目录
virtual bool canCompress(StringView source, StringView target) const
检查该压缩实现是否能处理指定源文件/目录并生成目标格式
定义 CompressorInterface.cpp:26
定义 FileSystemSimple.hpp:67