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
gzipoutputstream.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
30
#include "
gzipoutputstream.hpp
"
31
32
#include <fstream>
33
34
35
namespace
zipios
36
{
37
63
GZIPOutputStream::GZIPOutputStream
(std::ostream& os,
FileEntry::CompressionLevel
compression_level)
64
//: std::ostream() -- auto-init
65
//, m_ofs(nullptr) -- auto-init
66
: m_ozf(new
GZIPOutputStreambuf
(os.rdbuf(), compression_level))
67
{
68
init(
m_ozf
.get());
69
}
70
71
82
GZIPOutputStream::GZIPOutputStream
(std::string
const
& filename,
FileEntry::CompressionLevel
compression_level)
83
: std::ostream(0)
84
,
m_ofs
(new std::ofstream(filename.c_str(), std::ios::out | std::ios::binary))
85
,
m_ozf
(new
GZIPOutputStreambuf
(
m_ofs
->rdbuf(), compression_level))
86
{
87
init(
m_ozf
.get());
88
}
89
90
95
GZIPOutputStream::~GZIPOutputStream
()
96
{
97
}
98
99
109
void
GZIPOutputStream::setFilename
(std::string
const
& filename)
110
{
111
m_ozf
->setFilename(filename);
112
}
113
114
123
void
GZIPOutputStream::setComment
(std::string
const
& comment)
124
{
125
m_ozf
->setComment(comment);
126
}
127
128
137
void
GZIPOutputStream::close
()
138
{
139
m_ozf
->close();
140
if
(
m_ofs
)
141
{
142
m_ofs
->close();
143
}
144
}
145
146
150
void
GZIPOutputStream::finish
()
151
{
152
m_ozf
->finish();
153
}
154
155
156
}
// zipios namespace
157
158
// Local Variables:
159
// mode: cpp
160
// indent-tabs-mode: nil
161
// c-basic-offset: 4
162
// tab-width: 4
163
// End:
164
165
// vim: ts=4 sw=4 et
zipios::GZIPOutputStream::m_ozf
std::unique_ptr< GZIPOutputStreambuf > m_ozf
Definition:
gzipoutputstream.hpp:56
zipios
The zipios namespace includes the Zipios library definitions.
Definition:
backbuffer.cpp:35
zipios::GZIPOutputStream::setFilename
void setFilename(std::string const &filename)
Set the filename of a stream.
Definition:
gzipoutputstream.cpp:109
zipios::GZIPOutputStream::~GZIPOutputStream
virtual ~GZIPOutputStream()
Destroy the output stream.
Definition:
gzipoutputstream.cpp:95
zipios::GZIPOutputStreambuf
Save the output stream buffer.
Definition:
gzipoutputstreambuf.hpp:41
zipios::GZIPOutputStream::setComment
void setComment(std::string const &comment)
Set a comment in the stream.
Definition:
gzipoutputstream.cpp:123
zipios::GZIPOutputStream::GZIPOutputStream
GZIPOutputStream(std::ostream &os, FileEntry::CompressionLevel compression_level)
Create a ZIP output stream object.
Definition:
gzipoutputstream.cpp:63
gzipoutputstream.hpp
This file defines zipios::GZIPOutputStream.
zipios::FileEntry::CompressionLevel
int CompressionLevel
The compression level to be used to save an entry.
Definition:
fileentry.hpp:85
zipios::GZIPOutputStream::close
void close()
Close the streams.
Definition:
gzipoutputstream.cpp:137
zipios::GZIPOutputStream::finish
void finish()
Finishes the stream.
Definition:
gzipoutputstream.cpp:150
zipios::GZIPOutputStream::m_ofs
std::unique_ptr< std::ofstream > m_ofs
Definition:
gzipoutputstream.hpp:55
Generated on Wed Apr 10 2019 21:40:58 for zipios by
1.8.11