Zipios++
zipoutputstream.h
Go to the documentation of this file.
1 #ifndef ZIPOUTPUTSTREAM_H
2 #define ZIPOUTPUTSTREAM_H
3 
4 #include "zipios++/zipios-config.h"
5 
6 #include "zipios++/meta-iostreams.h"
7 
8 #include <string>
9 
10 #include "zipios++/ziphead.h"
12 
13 namespace zipios {
14 
18 class ZipOutputStream : public std::ostream {
19 public:
20 
24  explicit ZipOutputStream( std::ostream &os ) ;
25 
28  explicit ZipOutputStream( const std::string &filename ) ;
29 
34  void closeEntry() ;
35 
40  void close() ;
41 
46  void finish() ;
47 
51  void putNextEntry( const ZipCDirEntry &entry ) ;
52 
56  void putNextEntry(const std::string& entryName);
57 
59  void setComment( const std::string& comment ) ;
60 
62  void setLevel( int level ) ;
63 
66  void setMethod( StorageMethod method ) ;
67 
69  virtual ~ZipOutputStream() ;
70 
71 private:
72  std::ofstream *ofs ;
73  ZipOutputStreambuf *ozf ;
74 };
75 
76 } // namespace.
77 
78 #endif
79 
84 /*
85  Zipios++ - a small C++ library that provides easy access to .zip files.
86  Copyright (C) 2000 Thomas Søndergaard
87 
88  This library is free software; you can redistribute it and/or
89  modify it under the terms of the GNU Lesser General Public
90  License as published by the Free Software Foundation; either
91  version 2 of the License, or (at your option) any later version.
92 
93  This library is distributed in the hope that it will be useful,
94  but WITHOUT ANY WARRANTY; without even the implied warranty of
95  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
96  Lesser General Public License for more details.
97 
98  You should have received a copy of the GNU Lesser General Public
99  License along with this library; if not, write to the Free Software
100  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
101 */
zipios::ZipOutputStream::setComment
void setComment(const std::string &comment)
Sets the global comment for the Zip archive.
Definition: zipoutputstream.cpp:59
zipios::StorageMethod
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
Definition: fileentry.h:25
zipios::ZipOutputStream::putNextEntry
void putNextEntry(const ZipCDirEntry &entry)
Definition: zipoutputstream.cpp:50
zipios::ZipOutputStream::setLevel
void setLevel(int level)
Sets the compression level to be used for subsequent entries.
Definition: zipoutputstream.cpp:64
zipios::ZipOutputStream::closeEntry
void closeEntry()
Closes the current entry updates its header with the relevant size information and positions the stre...
Definition: zipoutputstream.cpp:33
zipios::ZipOutputStream::close
void close()
Calls finish and if the ZipOutputStream was created with a filename as a parameter that file is close...
Definition: zipoutputstream.cpp:38
zipios::ZipCDirEntry
Specialization of ZipLocalEntry, that add fields for storing the extra information,...
Definition: ziphead.h:102
ziphead.h
zipios::ZipOutputStream::finish
void finish()
Closes the current entry (if one is open), then writes the Zip Central Directory Structure closing th...
Definition: zipoutputstream.cpp:45
zipios::ZipOutputStream
Definition: zipoutputstream.h:18
zipios::ZipOutputStream::ZipOutputStream
ZipOutputStream(std::ostream &os)
ZipOutputStream constructor.
Definition: zipoutputstream.cpp:13
zipios::ZipOutputStreambuf
ZipOutputStreambuf is a zip output streambuf filter.
Definition: zipoutputstreambuf.h:17
zipios::ZipOutputStream::setMethod
void setMethod(StorageMethod method)
Sets the compression method to be used.
Definition: zipoutputstream.cpp:69
zipoutputstreambuf.h
zipios::ZipOutputStream::~ZipOutputStream
virtual ~ZipOutputStream()
Destructor.
Definition: zipoutputstream.cpp:74