Line data Source code
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-2019 Made to Order Software Corporation
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 :
26 : /** \file
27 : * \brief Declare the zipios::ZipLocalEntry class used to handle Zip entries.
28 : *
29 : * This header file contains the zipios::ZipLocalEntry, which is used
30 : * to handle entries in a Zip archive.
31 : *
32 : * \sa zipios::ZipCDirEntry
33 : */
34 :
35 : #include "zipios/fileentry.hpp"
36 :
37 :
38 : namespace zipios
39 : {
40 :
41 :
42 1073 : class ZipLocalEntry : public FileEntry
43 : {
44 : public:
45 : // Zip file format version
46 : static uint16_t const g_zip_format_version = 20; // 2.0
47 :
48 : ZipLocalEntry();
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 :
65 : protected:
66 : uint16_t m_extract_version = g_zip_format_version;
67 : uint16_t m_general_purpose_bitfield = 0;
68 : bool m_is_directory = false;
69 : size_t m_compressed_size = 0;
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
|