zipios
2.2.0
Zipios – a small C++ library that provides easy access to .zip files.
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
zipoutputstream.cpp
Go to the documentation of this file.
1
/*
2
Zipios -- a small C++ library that provides easy access to .zip files.
3
4
Copyright (C) 2000-2007 Thomas Sondergaard
5
Copyright (C) 2015-2019 Made to Order Software Corporation
6
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either
10
version 2.1 of the License, or (at your option) any later version.
11
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
16
17
You should have received a copy of the GNU Lesser General Public
18
License along with this library; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
29
#include "
zipoutputstream.hpp
"
30
#include "
zipcentraldirectoryentry.hpp
"
31
32
#include <fstream>
33
34
35
namespace
zipios
36
{
37
54
ZipOutputStream::ZipOutputStream
(std::ostream& os)
55
//: std::ostream()
56
: m_ozf(new
ZipOutputStreambuf
(os.rdbuf()))
57
{
58
init(
m_ozf
.get());
59
}
60
61
67
ZipOutputStream::~ZipOutputStream
()
68
{
69
}
70
71
76
void
ZipOutputStream::closeEntry
()
77
{
78
m_ozf
->closeEntry();
79
}
80
81
90
void
ZipOutputStream::close
()
91
{
92
m_ozf
->close();
93
}
94
95
103
void
ZipOutputStream::finish
()
104
{
105
m_ozf
->finish();
106
}
107
108
129
void
ZipOutputStream::putNextEntry
(
FileEntry::pointer_t
entry)
130
{
131
// if we do not yet have a ZipCentralDirectoryEntry object, create
132
// one from the input entry (the input entry is actually expected
133
// to be a DirectoryEntry!)
134
ZipCentralDirectoryEntry
* central_directory_entry(dynamic_cast<ZipCentralDirectoryEntry *>(entry.get()));
135
if
(central_directory_entry ==
nullptr
)
136
{
137
entry.reset(
new
ZipCentralDirectoryEntry
(*entry));
138
}
139
140
m_ozf
->putNextEntry(entry);
141
}
142
143
154
void
ZipOutputStream::setComment
(std::string
const
& comment)
155
{
156
m_ozf
->setComment(comment);
157
}
158
159
160
}
// zipios namespace
161
162
// Local Variables:
163
// mode: cpp
164
// indent-tabs-mode: nil
165
// c-basic-offset: 4
166
// tab-width: 4
167
// End:
168
169
// vim: ts=4 sw=4 et
zipios
The zipios namespace includes the Zipios library definitions.
Definition:
backbuffer.cpp:35
zipios::ZipOutputStream::closeEntry
void closeEntry()
Definition:
zipoutputstream.cpp:76
zipios::ZipOutputStream::ZipOutputStream
ZipOutputStream(std::ostream &os)
Initialize a ZipOutputStream object.
Definition:
zipoutputstream.cpp:54
zipios::ZipOutputStream::setComment
void setComment(std::string const &comment)
Set the global comment.
Definition:
zipoutputstream.cpp:154
zipios::ZipOutputStream::m_ozf
std::unique_ptr< ZipOutputStreambuf > m_ozf
Definition:
zipoutputstream.hpp:55
zipoutputstream.hpp
Define the zipios::ZipOutputStream class.
zipios::ZipOutputStream::close
void close()
Close the current stream.
Definition:
zipoutputstream.cpp:90
zipios::ZipOutputStream::putNextEntry
void putNextEntry(FileEntry::pointer_t entry)
Add an entry to the output stream.
Definition:
zipoutputstream.cpp:129
zipios::ZipOutputStream::~ZipOutputStream
virtual ~ZipOutputStream()
Clean up a ZipOutputStream object.
Definition:
zipoutputstream.cpp:67
zipios::ZipCentralDirectoryEntry
A specialization of ZipLocalEntry for.
Definition:
zipcentraldirectoryentry.hpp:43
zipcentraldirectoryentry.hpp
Declaration of the zipios::ZipCentralDirectoryEntry, which represents a directory Zip archive entry...
zipios::ZipOutputStreambuf
Handle the output buffer of a zip archive.
Definition:
zipoutputstreambuf.hpp:41
zipios::FileEntry::pointer_t
std::shared_ptr< FileEntry > pointer_t
Definition:
fileentry.hpp:78
zipios::ZipOutputStream::finish
void finish()
Finish up the output by flushing anything left.
Definition:
zipoutputstream.cpp:103
Generated on Wed Apr 10 2019 21:40:58 for zipios by
1.8.11