Orcus
Toggle main menu visibility
Loading...
Searching...
No Matches
include
orcus
zip_archive.hpp
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
*/
7
8
#ifndef INCLUDED_ORCUS_ZIP_ARCHIVE_HPP
9
#define INCLUDED_ORCUS_ZIP_ARCHIVE_HPP
10
11
#include "env.hpp"
12
#include "exception.hpp"
13
14
#include <string_view>
15
#include <vector>
16
#include <memory>
17
#include <ostream>
18
#include <cstdint>
19
20
namespace
orcus {
21
25
struct
ORCUS_PSR_DLLPUBLIC zip_file_entry_header
26
{
27
uint32_t header_signature = 0;
28
uint16_t required_version = 0;
29
uint16_t flag = 0;
30
uint16_t compression_method = 0;
31
uint16_t last_modified_time = 0;
32
uint16_t last_modified_date = 0;
33
uint32_t crc32 = 0;
34
uint32_t compressed_size = 0;
35
uint32_t uncompressed_size = 0;
36
37
std::string filename;
38
std::vector<uint8_t> extra_field;
39
40
zip_file_entry_header();
41
zip_file_entry_header(
const
zip_file_entry_header& other);
42
zip_file_entry_header(zip_file_entry_header&& other);
43
~zip_file_entry_header();
44
45
zip_file_entry_header& operator=(
const
zip_file_entry_header& other);
46
zip_file_entry_header& operator=(zip_file_entry_header&& other);
47
};
48
49
ORCUS_PSR_DLLPUBLIC std::ostream& operator<<(std::ostream& os,
const
zip_file_entry_header
& header);
50
51
class
zip_archive_stream
;
52
53
class
ORCUS_PSR_DLLPUBLIC zip_archive
54
{
55
class
impl;
56
57
std::unique_ptr<impl> mp_impl;
58
59
public
:
60
zip_archive() =
delete
;
61
zip_archive(
const
zip_archive&) =
delete
;
62
zip_archive& operator= (
const
zip_archive) =
delete
;
63
64
zip_archive(
zip_archive_stream
* stream);
65
~zip_archive();
66
72
void
load
();
73
81
zip_file_entry_header
get_file_entry_header
(std::size_t index)
const
;
82
90
zip_file_entry_header
get_file_entry_header
(std::string_view name)
const
;
91
99
std::string_view
get_file_entry_name
(std::size_t index)
const
;
100
108
size_t
get_file_entry_count
()
const
;
109
121
std::vector<unsigned char>
read_file_entry
(std::string_view entry_name)
const
;
122
};
123
124
}
125
126
#endif
127
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
orcus::zip_archive_stream
Definition
zip_archive_stream.hpp:19
orcus::zip_archive::read_file_entry
std::vector< unsigned char > read_file_entry(std::string_view entry_name) const
orcus::zip_archive::load
void load()
orcus::zip_archive::get_file_entry_name
std::string_view get_file_entry_name(std::size_t index) const
orcus::zip_archive::get_file_entry_count
size_t get_file_entry_count() const
orcus::zip_archive::get_file_entry_header
zip_file_entry_header get_file_entry_header(std::string_view name) const
orcus::zip_archive::get_file_entry_header
zip_file_entry_header get_file_entry_header(std::size_t index) const
orcus::zip_file_entry_header
Definition
zip_archive.hpp:26
Generated on
for Orcus by
1.17.0