scc
2026.07
SystemC components library
gzip_streambuf.h
1
/*******************************************************************************
2
* Copyright 2026 MINRES Technologies GmbH
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*******************************************************************************/
16
17
#ifndef _UTIL_GZIP_STREAMBUF_H_
18
#define _UTIL_GZIP_STREAMBUF_H_
19
20
#include <cctype>
21
#include <climits>
22
#include <fstream>
23
#include <istream>
24
#include <stdexcept>
25
#include <string>
26
#include <sys/stat.h>
27
#include <vector>
28
#include <zlib.h>
29
30
namespace
util
{
31
// ============================================================
32
// GZIP
33
// ============================================================
34
35
class
gzip_streambuf :
public
std::streambuf {
36
public
:
37
explicit
gzip_streambuf(
const
std::string& path);
38
39
~gzip_streambuf()
override
;
40
41
protected
:
42
int_type underflow()
override
;
43
44
private
:
45
gzFile gz_;
46
std::vector<char> buffer_;
47
};
48
49
class
gzip_stream :
public
std::istream {
50
public
:
51
gzip_stream() =
delete
;
52
explicit
gzip_stream(
const
std::string& path)
53
: std::istream(&buf_)
54
, buf_(path) {
55
rdbuf(&buf_);
56
}
57
58
private
:
59
gzip_streambuf
buf_;
60
};
61
62
}
// namespace util
63
#endif
// _UTIL_GZIP_STREAMBUF_H_
util::gzip_streambuf
Definition
gzip_streambuf.h:35
util
SCC common utilities.
Definition
bit_field.h:30
src
common
util
gzip_streambuf.h
Generated by
1.15.0