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 */
Header file that defines ZipOutputStreambuf.
ZipOutputStream(std::ostream &os)
ZipOutputStream constructor.
void setMethod(StorageMethod method)
Sets the compression method to be used.
Header file containing classes and functions for reading the central directory and local header field...
Specialization of ZipLocalEntry, that add fields for storing the extra information, that is only present in the entries in the zip central directory and not in the local entry headers.
Definition: ziphead.h:102
virtual ~ZipOutputStream()
Destructor.
void setComment(const std::string &comment)
Sets the global comment for the Zip archive.
ZipOutputStreambuf is a zip output streambuf filter.
void setLevel(int level)
Sets the compression level to be used for subsequent entries.
void putNextEntry(const ZipCDirEntry &entry)
void closeEntry()
Closes the current entry updates its header with the relevant size information and positions the stre...
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
Definition: fileentry.h:25
void close()
Calls finish and if the ZipOutputStream was created with a filename as a parameter that file is close...
void finish()
Closes the current entry (if one is open), then writes the Zip Central Directory Structure closing th...