zipios  2.2.0
Zipios – a small C++ library that provides 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-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 
35 #include "zipios/fileentry.hpp"
36 
37 
38 namespace zipios
39 {
40 
41 
42 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:
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
virtual void setCompressedSize(size_t size) override
Set the size when the file is compressed.
The zipios namespace includes the Zipios library definitions.
Definition: backbuffer.cpp:35
virtual size_t getHeaderSize() const override
Retrieve the size of the header.
An implementation of the FileEntry for Zip archives.
virtual pointer_t clone() const override
Create a clone of a ZipLocalEntry object.
virtual bool isDirectory() const override
Check whether the filename represents a directory.
ZipLocalEntry()
Create a default ZipLocalEntry objects.
virtual size_t getCompressedSize() const override
Retrieve the size of the file when compressed.
uint32_t crc32_t
Definition: fileentry.hpp:81
virtual void write(std::ostream &os) override
Write a ZipLocalEntry to os.
bool hasTrailingDataDescriptor() const
Is there a trailing data descriptor?
virtual void setCrc(crc32_t crc) override
Save the CRC of the entry.
A FileEntry represents an entry in a FileCollection.
Definition: fileentry.hpp:75
virtual void read(std::istream &is) override
Read one local entry from is.
uint16_t m_general_purpose_bitfield
static uint16_t const g_zip_format_version
virtual ~ZipLocalEntry() override
Clean up a ZipLocalEntry object.
virtual bool isEqual(FileEntry const &file_entry) const override
Compare two file entries for equality.
Define the zipios::FileEntry class.
std::shared_ptr< FileEntry > pointer_t
Definition: fileentry.hpp:78