zip_reader.h Source File - ClanLib SDK
Description: zip_reader.h Source File

zip_reader.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 The ClanLib Team
4**
5** This software is provided 'as-is', without any express or implied
6** warranty. In no event will the authors be held liable for any damages
7** arising from the use of this software.
8**
9** Permission is granted to anyone to use this software for any purpose,
10** including commercial applications, and to alter it and redistribute it
11** freely, subject to the following restrictions:
12**
13** 1. The origin of this software must not be misrepresented; you must not
14** claim that you wrote the original software. If you use this software
15** in a product, an acknowledgment in the product documentation would be
16** appreciated but is not required.
17** 2. Altered source versions must be plainly marked as such, and must not be
18** misrepresented as being the original software.
19** 3. This notice may not be removed or altered from any source distribution.
20**
21** Note: Some of the libraries ClanLib may link to may have additional
22** requirements or restrictions.
23**
24** File Author(s):
25**
26** Magnus Norddahl
27*/
28
29#pragma once
30
31#include <memory>
32#include "../System/cl_platform.h"
33#include <vector>
34
35namespace clan
36{
39
40 class IODevice;
41 class ZipReader_Impl;
42
44 class ZipReader
45 {
46 public:
50 ZipReader(IODevice &input);
51
53
57 bool read_local_file_header(bool allow_data_descriptor = false);
58
60 std::string get_filename();
61
63 bool has_data_descriptor() const;
64
66 int64_t get_compressed_size() const;
67
69 int64_t get_uncompressed_size() const;
70
72 void set_data_descriptor_data(int64_t compressed_size, int64_t uncompressed_size, uint32_t crc32);
73
75 int64_t read_file_data(void *data, int64_t size, bool read_all = true);
76
77 private:
78 std::shared_ptr<ZipReader_Impl> impl;
79 };
80
82}
clan::IODevice
I/O Device interface.
Definition iodevice.h:50
clan::ZipReader::get_uncompressed_size
int64_t get_uncompressed_size() const
Returns the uncompressed size of the file entry.
clan::ZipReader::read_file_data
int64_t read_file_data(void *data, int64_t size, bool read_all=true)
Reads some file data from the zip file.
clan::ZipReader::set_data_descriptor_data
void set_data_descriptor_data(int64_t compressed_size, int64_t uncompressed_size, uint32_t crc32)
Informs the zip reader what the data descriptor contains.
clan::ZipReader::has_data_descriptor
bool has_data_descriptor() const
Returns true if the file entry is followed by a data descriptor.
clan::ZipReader::get_compressed_size
int64_t get_compressed_size() const
Returns the compressed size of the file entry.
clan::ZipReader::get_filename
std::string get_filename()
Returns the file name that was stored in the local file header.
clan::ZipReader::read_local_file_header
bool read_local_file_header(bool allow_data_descriptor=false)
Begins reading a file entry in the zip file.
clan::ZipReader::ZipReader
ZipReader(IODevice &input)
Constructs a ZipReader.
clan
Definition clanapp.h:36