Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
ArchiveWriter.h
Go to the documentation of this file.
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#pragma once
21
22#include <sese/io/InputStream.h>
24
25#include <filesystem>
26
27namespace sese::archive {
28
31 public:
35
36 virtual ~ArchiveWriter();
37
38 int setFilterGZip();
39
40 int setFilterBZip2();
41
42 int setFilterLZ4();
43
44 int setFilterLZip();
45
46 int setFilterZstd();
47
48 int setFilterXZ();
49
50 int setFilterLzma();
51
52 int setFilterLzop();
53
54 int setFilterGRZip();
55
56 int setFilterLRZip();
57
58 int setFilterNone();
59
60 int setFormatXar();
61
62 int setFormatTar();
63
64 int setFormatZip();
65
66 int setFormat7z();
67
68 int setFormatISO();
69
73 int setPassword(const std::string &pwd);
74
78 int setOptions(const std::string &opt);
79
82 int getError();
83
86 const char *getErrorString();
87
90 bool begin();
91
94 bool done();
95
99 bool addPath(const std::filesystem::path &path);
100
105 bool addPath(const std::filesystem::path &base, const std::filesystem::path &path);
106
107 bool addFile(const std::filesystem::path &file);
108
109 bool addFile(const std::filesystem::path &base, const std::filesystem::path &file);
110
111 bool addDirectory(const std::filesystem::path &dir);
112
113 bool addDirectory(const std::filesystem::path &base, const std::filesystem::path &dir);
114
120 bool addStream(const std::filesystem::path &path, io::InputStream *input, size_t len);
121
122 static int openCallback(void *archive, ArchiveWriter *archive_this);
123
124 static int64_t writeCallback(void *archive, ArchiveWriter *archive_this, const void *buffer, size_t len);
125
126 static int closeCallback(void *archive, ArchiveWriter *archive_this);
127
128 static int freeCallback(void *archive, ArchiveWriter *archive_this);
129
130 static const char *passphraseCallback(void *archive, ArchiveWriter *archive_this);
131
132 protected:
134 void *archive{};
135 };
136}