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 
14 namespace zipios {
15 
18 public:
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 
65 protected:
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 
79 private:
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 */