Line data Source code
1 : #pragma once
2 : #ifndef ZIPIOS_ZIPFILE_HPP
3 : #define ZIPIOS_ZIPFILE_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 Define the zipios::ZipFile class.
28 : *
29 : * This file defines the main class of the Zipios library. The
30 : * zipios::ZipFile class is the one used to read or write
31 : * Zip archives.
32 : *
33 : * Note that a Zip archive is a zipios::FileCollection. When reading,
34 : * you get zipios::FileEntry objects that are defined internally
35 : * such as the zipios::ZipCDirEntry. When writing, you get
36 : * zipios::FileEntry objects from a zipios::DirectoryCollection.
37 : */
38 :
39 : #include "zipios/filecollection.hpp"
40 : #include "zipios/virtualseeker.hpp"
41 :
42 :
43 : namespace zipios
44 : {
45 :
46 :
47 1 : class ZipFile : public FileCollection
48 : {
49 : public:
50 : static pointer_t openEmbeddedZipFile(std::string const & name);
51 :
52 : ZipFile();
53 : ZipFile(std::string const & filename, offset_t s_off = 0, offset_t e_off = 0);
54 : virtual pointer_t clone() const override;
55 : virtual ~ZipFile() override;
56 :
57 : virtual stream_pointer_t getInputStream(std::string const & entry_name, MatchPath matchpath = MatchPath::MATCH) override;
58 : static void saveCollectionToArchive(std::ostream & os, FileCollection & collection, std::string const & zip_comment = "");
59 :
60 : private:
61 : VirtualSeeker m_vs;
62 : };
63 :
64 :
65 : } // zipios namespace
66 :
67 : // Local Variables:
68 : // mode: cpp
69 : // indent-tabs-mode: nil
70 : // c-basic-offset: 4
71 : // tab-width: 4
72 : // End:
73 :
74 : // vim: ts=4 sw=4 et
75 : #endif
|