~ubuntu-branches/ubuntu/maverick/freecad/maverick

« back to all changes in this revision

Viewing changes to src/Base/zipios/gzipoutputstreambuf.h

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-07-16 18:37:41 UTC
  • Revision ID: james.westby@ubuntu.com-20090716183741-oww9kcxqrk991i1n
Tags: upstream-0.8.2237
Import upstream version 0.8.2237

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef GZIPOUTPUTSTREAMBUF_H
 
2
#define GZIPOUTPUTSTREAMBUF_H
 
3
 
 
4
#include "zipios-config.h"
 
5
 
 
6
#include <vector>
 
7
 
 
8
#include <zlib.h>
 
9
 
 
10
#include "deflateoutputstreambuf.h"
 
11
 
 
12
namespace zipios {
 
13
 
 
14
/** GZIPOutputStreambuf is a zip output streambuf filter.  */
 
15
class BaseExport GZIPOutputStreambuf : public DeflateOutputStreambuf {
 
16
public:
 
17
 
 
18
  /** GZIPOutputStreambuf constructor. A newly constructed GZIPOutputStreambuf
 
19
      is ready to accept data.
 
20
      @param outbuf the streambuf to use for output.
 
21
      @param del_outbuf if true is specified outbuf will be deleted, when 
 
22
      the GZIPOutputStreambuf is destructed.  */
 
23
  explicit GZIPOutputStreambuf( streambuf *outbuf, bool del_outbuf = false ) ;
 
24
 
 
25
  void setFilename( const string &filename );
 
26
  void setComment( const string &comment );
 
27
 
 
28
  /** Calls finish. */
 
29
  void close() ;
 
30
 
 
31
  /** Finishes the compression. */
 
32
  void finish() ;
 
33
 
 
34
  /** Destructor. */
 
35
  virtual ~GZIPOutputStreambuf() ;
 
36
 
 
37
protected:
 
38
  virtual int overflow( int c = EOF ) ;
 
39
  virtual int sync() ;
 
40
 
 
41
private:
 
42
  void writeHeader();
 
43
  void writeTrailer();
 
44
  void writeInt(uint32 i);
 
45
  
 
46
  std::string _filename;
 
47
  std::string _comment;
 
48
  bool _open ;
 
49
};
 
50
 
 
51
 
 
52
} // namespace
 
53
 
 
54
 
 
55
 
 
56
#endif
 
57
 
 
58
/** \file
 
59
    Header file that defines ZipOutputStreambuf.
 
60
*/
 
61
 
 
62
/*
 
63
  Zipios++ - a small C++ library that provides easy access to .zip files.
 
64
  Copyright (C) 2000  Thomas S�ndergaard
 
65
  
 
66
  This library is free software; you can redistribute it and/or
 
67
  modify it under the terms of the GNU Lesser General Public
 
68
  License as published by the Free Software Foundation; either
 
69
  version 2 of the License, or (at your option) any later version.
 
70
  
 
71
  This library is distributed in the hope that it will be useful,
 
72
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
73
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
74
  Lesser General Public License for more details.
 
75
  
 
76
  You should have received a copy of the GNU Lesser General Public
 
77
  License along with this library; if not, write to the Free Software
 
78
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
79
*/