Zipios++
Main Page
Classes
Files
File List
src
zipoutputstream.cpp
Go to the documentation of this file.
1
2
#include "zipios++/zipios-config.h"
3
4
#include "zipios++/meta-iostreams.h"
5
6
#include "
zipios++/zipoutputstreambuf.h
"
7
#include "
zipios++/zipoutputstream.h
"
8
9
using
std::ostream;
10
11
namespace
zipios {
12
13
ZipOutputStream::ZipOutputStream
( std::ostream &os )
14
: ostream( 0 ),
15
// SGIs basic_ifstream calls istream with 0, but calls basic_ios constructor first??
16
ofs( 0 )
17
{
18
ozf =
new
ZipOutputStreambuf
( os.rdbuf() ) ;
19
20
init( ozf ) ;
21
}
22
23
24
ZipOutputStream::ZipOutputStream
(
const
std::string &filename )
25
: ostream( 0 ),
26
ofs( 0 )
27
{
28
ofs =
new
std::ofstream( filename.c_str(), std::ios::out | std::ios::binary ) ;
29
ozf =
new
ZipOutputStreambuf
( ofs->rdbuf() ) ;
30
this->init( ozf ) ;
31
}
32
33
void
ZipOutputStream::closeEntry
() {
34
ozf->
closeEntry
() ;
35
}
36
37
38
void
ZipOutputStream::close
() {
39
ozf->
close
() ;
40
if
( ofs )
41
ofs->close() ;
42
}
43
44
45
void
ZipOutputStream::finish
() {
46
ozf->
finish
() ;
47
}
48
49
50
void
ZipOutputStream::putNextEntry
(
const
ZipCDirEntry
&entry ) {
51
ozf->
putNextEntry
( entry ) ;
52
}
53
54
void
ZipOutputStream::putNextEntry
(
const
std::string& entryName) {
55
putNextEntry
(
ZipCDirEntry
(entryName));
56
}
57
58
59
void
ZipOutputStream::setComment
(
const
std::string &comment ) {
60
ozf->
setComment
( comment ) ;
61
}
62
63
64
void
ZipOutputStream::setLevel
(
int
level ) {
65
ozf->
setLevel
( level ) ;
66
}
67
68
69
void
ZipOutputStream::setMethod
( StorageMethod method ) {
70
ozf->
setMethod
( method ) ;
71
}
72
73
74
ZipOutputStream::~ZipOutputStream
() {
75
// It's ok to call delete with a Null pointer.
76
delete
ozf ;
77
delete
ofs ;
78
}
79
80
}
// namespace
81
86
/*
87
Zipios++ - a small C++ library that provides easy access to .zip files.
88
Copyright (C) 2000 Thomas Søndergaard
89
90
This library is free software; you can redistribute it and/or
91
modify it under the terms of the GNU Lesser General Public
92
License as published by the Free Software Foundation; either
93
version 2 of the License, or (at your option) any later version.
94
95
This library is distributed in the hope that it will be useful,
96
but WITHOUT ANY WARRANTY; without even the implied warranty of
97
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
98
Lesser General Public License for more details.
99
100
You should have received a copy of the GNU Lesser General Public
101
License along with this library; if not, write to the Free Software
102
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
103
*/
Generated by
1.8.1.1