FreeCAD

Форк
0
/
gzipoutputstream.cpp 
79 строк · 2.0 Кб
1

2
#include "zipios-config.h"
3

4
#include "meta-iostreams.h"
5

6
#include "gzipoutputstreambuf.h"
7
#include "gzipoutputstream.h"
8

9
using std::ostream;
10

11
namespace zipios {
12

13
GZIPOutputStream::GZIPOutputStream( std::ostream &os )
14
  : ostream( nullptr ),
15
    ofs( nullptr )
16
{
17
  ozf = new GZIPOutputStreambuf( os.rdbuf() ) ;
18

19
  init( ozf ) ;
20
}
21

22
GZIPOutputStream::GZIPOutputStream( const std::string &filename )
23
  : ostream( nullptr ),
24
    ofs( nullptr )
25
{
26
  ofs = new std::ofstream( filename.c_str(), std::ios::out | std::ios::binary ) ;
27
  ozf = new GZIPOutputStreambuf( ofs->rdbuf() ) ;
28
  init( ozf ) ;
29
}
30

31
void GZIPOutputStream::setFilename( const string &filename ) {
32
  ozf->setFilename(filename);
33
}
34

35
void GZIPOutputStream::setComment( const string &comment ) {
36
  ozf->setComment(comment);
37
}
38

39
void GZIPOutputStream::close() {
40
  ozf->close() ;
41
  if ( ofs )
42
    ofs->close() ;
43
}
44

45

46
void GZIPOutputStream::finish() {
47
  ozf->finish() ;
48
}
49

50

51
GZIPOutputStream::~GZIPOutputStream() {
52
  // It's ok to call delete with a Null pointer.
53
  delete ozf ;
54
  delete ofs ;
55
}
56

57
} // namespace
58

59
/** \file
60
    Implementation of GZIPOutputStream.
61
*/
62

63
/*
64
  Zipios++ - a small C++ library that provides easy access to .zip files.
65
  Copyright (C) 2000  Thomas Søndergaard
66

67
  This library is free software; you can redistribute it and/or
68
  modify it under the terms of the GNU Lesser General Public
69
  License as published by the Free Software Foundation; either
70
  version 2 of the License, or (at your option) any later version.
71

72
  This library is distributed in the hope that it will be useful,
73
  but WITHOUT ANY WARRANTY; without even the implied warranty of
74
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
75
  Lesser General Public License for more details.
76

77
  You should have received a copy of the GNU Lesser General Public
78
  License along with this library; if not, write to the Free Software
79
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
80
*/
81

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.