Sese Framework
2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
ArchiveReader.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/archive/Config.h
>
23
#include <
sese/io/InputStream.h
>
24
25
#include <functional>
26
#include <filesystem>
27
28
namespace
sese::archive
{
29
31
class
ArchiveReader
{
32
public
:
33
using
ExtractCallback
= std::function<bool(
const
std::filesystem::path &base_path,
Config::EntryType
type,
io::InputStream
*
input
,
size_t
readable)>;
34
40
static
bool
extract
(
const
std::filesystem::path &src_path,
const
std::filesystem::path &dest_path,
const
std::string &pwd = {});
41
44
explicit
ArchiveReader
(
io::InputStream
*
input
);
45
46
virtual
~ArchiveReader
();
47
51
[[nodiscard]]
int
setPassword
(
const
std::string &pwd)
const
;
52
56
[[nodiscard]]
int
setOptions
(
const
std::string &opt)
const
;
57
61
bool
extract
(
const
ExtractCallback
&
callback
);
62
65
[[nodiscard]]
int
getError
()
const
;
66
69
[[nodiscard]]
const
char
*
getErrorString
()
const
;
70
71
static
int
openCallback
(
void
*
a
,
ArchiveReader
*archive_this);
72
73
static
int64_t
readCallback
(
void
*
a
,
ArchiveReader
*archive_this,
const
void
**
buffer
);
74
75
static
int
closeCallback
(
void
*
a
,
ArchiveReader
*archive_this);
76
77
protected
:
78
char
buffer
[4096]{};
79
void
*
archive
{};
80
io::InputStream
*
input
{};
81
};
82
}
sese
archive
ArchiveReader.h
Generated on Tue Jan 7 2025 15:49:05 for Sese Framework by
1.11.0