zipios 2.3.4
Zipios -- a small C++ library providing easy access to .zip files.
zipfile.hpp
Go to the documentation of this file.
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-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
41
42
43namespace zipios
44{
45
46
47class ZipFile : public FileCollection
48{
49public:
50 static pointer_t openEmbeddedZipFile(std::string const & filename);
51
52 ZipFile();
53 ZipFile(std::string const & filename, offset_t s_off = 0, offset_t e_off = 0);
54 ZipFile(std::istream & is, offset_t s_off = 0, offset_t e_off = 0);
55 virtual pointer_t clone() const override;
56 virtual ~ZipFile() override;
57
59 std::string const & entry_name
60 , MatchPath matchpath = MatchPath::MATCH) override;
61 static void saveCollectionToArchive(
62 std::ostream & os
63 , FileCollection & collection
64 , std::string const & zip_comment = std::string());
65
66private:
67 void init(std::istream & is);
68
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
Base class for various file collections.
std::shared_ptr< FileCollection > pointer_t
std::shared_ptr< std::istream > stream_pointer_t
A shared pointer to an input stream.
A virtual class used to see in a file embedded in another.
The ZipFile class represents a collection of files.
Definition zipfile.hpp:48
static pointer_t openEmbeddedZipFile(std::string const &filename)
Open a zip archive that was previously appended to another file.
Definition zipfile.cpp:304
ZipFile()
Initialize a ZipFile object.
Definition zipfile.cpp:328
static void saveCollectionToArchive(std::ostream &os, FileCollection &collection, std::string const &zip_comment=std::string())
Create a Zip archive from the specified FileCollection.
Definition zipfile.cpp:578
virtual stream_pointer_t getInputStream(std::string const &entry_name, MatchPath matchpath=MatchPath::MATCH) override
Retrieve a pointer to a file in the Zip archive.
Definition zipfile.cpp:544
void init(std::istream &is)
Initialize the ZipFile from the specified input stream.
Definition zipfile.cpp:409
virtual ~ZipFile() override
Clean up the ZipFile object.
Definition zipfile.cpp:504
virtual pointer_t clone() const override
Create a clone of this ZipFile.
Definition zipfile.cpp:493
VirtualSeeker m_vs
Definition zipfile.hpp:69
Define the zipios::FileCollection class.
The zipios namespace includes the Zipios library definitions.
std::streamoff offset_t
Define the zipios::VirtualSeeker class.