zipios 2.3.4
Zipios -- a small C++ library providing easy access to .zip files.
ziplocalentry.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef ZIPLOCALENTRY_HPP
3#define ZIPLOCALENTRY_HPP
4
5/*
6 Zipios -- a small C++ library that provides easy access to .zip files.
7
8 Copyright (C) 2000-2007 Thomas Sondergaard
9 Copyright (c) 2015-2022 Made to Order Software Corp. All Rights Reserved
10
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Lesser General Public
13 License as published by the Free Software Foundation; either
14 version 2.1 of the License, or (at your option) any later version.
15
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public
22 License along with this library; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
35#include "zipios/fileentry.hpp"
36
37
38namespace zipios
39{
40
41
43{
44public:
45 // Zip file format version
46 static uint16_t const g_zip_format_version = 20; // 2.0
47
49 ZipLocalEntry(FileEntry const & src);
50 virtual pointer_t clone() const override;
51 virtual ~ZipLocalEntry() override;
52
53 virtual size_t getCompressedSize() const override;
54 virtual size_t getHeaderSize() const override;
55 virtual bool isDirectory() const override;
56 virtual bool isEqual(FileEntry const & file_entry) const override;
57 virtual void setCompressedSize(size_t size) override;
58 virtual void setCrc(crc32_t crc) override;
59
60 bool hasTrailingDataDescriptor() const;
61
62 virtual void read(std::istream & is) override;
63 virtual void write(std::ostream & os) override;
64
65protected:
68 bool m_is_directory = false;
70};
71
72
73} // zipios namespace
74
75// Local Variables:
76// mode: cpp
77// indent-tabs-mode: nil
78// c-basic-offset: 4
79// tab-width: 4
80// End:
81
82// vim: ts=4 sw=4 et
83#endif
A FileEntry represents an entry in a FileCollection.
Definition fileentry.hpp:76
std::shared_ptr< FileEntry > pointer_t
Definition fileentry.hpp:78
An implementation of the FileEntry for Zip archives.
virtual pointer_t clone() const override
Create a clone of a ZipLocalEntry object.
virtual void setCrc(crc32_t crc) override
Save the CRC of the entry.
virtual void setCompressedSize(size_t size) override
Set the size when the file is compressed.
virtual ~ZipLocalEntry() override
Clean up a ZipLocalEntry object.
virtual void read(std::istream &is) override
Read one local entry from is.
virtual bool isDirectory() const override
Check whether the filename represents a directory.
uint16_t m_general_purpose_bitfield
virtual void write(std::ostream &os) override
Write a ZipLocalEntry to os.
ZipLocalEntry()
Create a default ZipLocalEntry objects.
virtual bool isEqual(FileEntry const &file_entry) const override
Compare two file entries for equality.
virtual size_t getHeaderSize() const override
Retrieve the size of the header.
bool hasTrailingDataDescriptor() const
Is there a trailing data descriptor?
virtual size_t getCompressedSize() const override
Retrieve the size of the file when compressed.
static uint16_t const g_zip_format_version
Define the zipios::FileEntry class.
The zipios namespace includes the Zipios library definitions.