Sese Framework  x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
ArchiveWriter.h
浏览该文件的文档.
1// Copyright 2024 libsese
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
19
20
21#pragma once
22
23#include <sese/io/InputStream.h>
25
26#include <filesystem>
27
28namespace sese::archive {
29
32 public:
36
37 virtual ~ArchiveWriter();
38
39 int setFilterGZip();
40
41 int setFilterBZip2();
42
43 int setFilterLZ4();
44
45 int setFilterLZip();
46
47 int setFilterZstd();
48
49 int setFilterXZ();
50
51 int setFilterLzma();
52
53 int setFilterLzop();
54
55 int setFilterGRZip();
56
57 int setFilterLRZip();
58
59 int setFilterNone();
60
61 int setFormatXar();
62
63 int setFormatTar();
64
65 int setFormatZip();
66
67 int setFormat7z();
68
69 int setFormatISO();
70
74 int setPassword(const std::string &pwd);
75
79 int setOptions(const std::string &opt);
80
83 int getError();
84
87 const char *getErrorString();
88
91 bool begin();
92
95 bool done();
96
100 bool addPath(const std::filesystem::path &path);
101
106 bool addPath(const std::filesystem::path &base, const std::filesystem::path &path);
107
109 bool addFile(const std::filesystem::path &file);
110
112 bool addFile(const std::filesystem::path &base, const std::filesystem::path &file);
113
115 bool addDirectory(const std::filesystem::path &dir);
116
118 bool addDirectory(const std::filesystem::path &base, const std::filesystem::path &dir);
119
125 bool addStream(const std::filesystem::path &path, io::InputStream *input, size_t len);
126
127 static int openCallback(void *archive, ArchiveWriter *archive_this);
128
129 static int64_t writeCallback(void *archive, ArchiveWriter *archive_this, const void *buffer, size_t len);
130
131 static int closeCallback(void *archive, ArchiveWriter *archive_this);
132
133 static int freeCallback(void *archive, ArchiveWriter *archive_this);
134
135 static const char *passphraseCallback(void *archive, ArchiveWriter *archive_this);
136
137 protected:
139 void *archive{};
140 };
141}