Zipios++
zipoutputstreambuf.h
Go to the documentation of this file.
1#ifndef ZIPOUTPUTSTREAMBUF_H
2#define ZIPOUTPUTSTREAMBUF_H
3
4#include "zipios++/zipios-config.h"
5
6#include <vector>
7
8#include <zlib.h>
9
10#include "zipios++/fcoll.h"
12#include "zipios++/ziphead.h"
13
14namespace zipios {
15
18public:
19
20 enum CompressionLevels { NO_COMPRESSION = Z_NO_COMPRESSION,
21 BEST_SPEED = Z_BEST_SPEED,
22 BEST_COMPRESSION = Z_BEST_COMPRESSION,
23 DEFAULT_COMPRESSION = Z_DEFAULT_COMPRESSION } ;
24
30 explicit ZipOutputStreambuf( streambuf *outbuf, bool del_outbuf = false ) ;
31
34 void closeEntry() ;
35
37 void close() ;
38
43 void finish() ;
44
50 void putNextEntry( const ZipCDirEntry &entry ) ;
51
53 void setComment( const string &comment ) ;
54
56 void setLevel( int level ) ;
57
60 void setMethod( StorageMethod method ) ;
61
63 virtual ~ZipOutputStreambuf() ;
64
65protected:
66 virtual int overflow( int c = EOF ) ;
67 virtual int sync() ;
68
69 void setEntryClosedState() ;
70 void updateEntryHeaderInfo() ;
71
72 // Should/could be moved to zipheadio.h ?!
73 static void writeCentralDirectory( const vector< ZipCDirEntry > &entries,
75 ostream &os ) ;
76
77
78
79private:
80 string _zip_comment ;
81 vector< ZipCDirEntry > _entries ;
82 bool _open_entry ;
83 bool _open ;
84 StorageMethod _method ;
85 int _level ;
86};
87
88
89} // namespace
90
91
92
93#endif
94
99/*
100 Zipios++ - a small C++ library that provides easy access to .zip files.
101 Copyright (C) 2000 Thomas Søndergaard
102
103 This library is free software; you can redistribute it and/or
104 modify it under the terms of the GNU Lesser General Public
105 License as published by the Free Software Foundation; either
106 version 2 of the License, or (at your option) any later version.
107
108 This library is distributed in the hope that it will be useful,
109 but WITHOUT ANY WARRANTY; without even the implied warranty of
110 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
111 Lesser General Public License for more details.
112
113 You should have received a copy of the GNU Lesser General Public
114 License along with this library; if not, write to the Free Software
115 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
116*/
DeflateOutputStreambuf is an output stream filter, that deflates the data that is written to it befor...
The end of the Central directory structure.
Definition ziphead.h:159
Specialization of ZipLocalEntry, that add fields for storing the extra information,...
Definition ziphead.h:102
ZipOutputStreambuf is a zip output streambuf filter.
void setMethod(StorageMethod method)
Sets the compression method to be used.
virtual ~ZipOutputStreambuf()
Destructor.
void closeEntry()
Closes the current entry, and positions the stream read pointer at the beginning of the next entry (i...
void setLevel(int level)
Sets the compression level to be used for subsequent entries.
void finish()
Closes the current entry (if one is open), then writes the Zip Central Directory Structure closing th...
void putNextEntry(const ZipCDirEntry &entry)
Begins writing the next entry.
void setComment(const string &comment)
Sets the global comment for the Zip archive.
Header file that defines DeflateOutputStreambuf.
Header file that defines FileCollection.
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
Definition fileentry.h:25
Header file containing classes and functions for reading the central directory and local header field...