scc
2026.07
SystemC components library
bzip2_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_BZIP2_STREAMBUF_H_
18
#define _UTIL_BZIP2_STREAMBUF_H_
19
20
#include <bzlib.h>
21
#include <cctype>
22
#include <climits>
23
#include <iostream>
24
#include <string>
25
#include <sys/stat.h>
26
#include <vector>
27
28
namespace
util
{
29
// ============================================================
30
// BZIP2
31
// ============================================================
32
class
bzip2_streambuf :
public
std::streambuf {
33
public
:
34
explicit
bzip2_streambuf(
const
std::string& path);
35
36
~bzip2_streambuf()
override
;
37
38
protected
:
39
int_type underflow()
override
;
40
41
private
:
42
FILE* file_;
43
BZFILE* bz_;
44
int
bzerror_;
45
std::vector<char> buffer_;
46
};
47
48
class
bzip2_stream :
public
std::istream {
49
public
:
50
bzip2_stream() =
delete
;
51
explicit
bzip2_stream(
const
std::string& path)
52
: std::istream(&buf_)
53
, buf_(path) {
54
rdbuf(&buf_);
55
}
56
57
private
:
58
bzip2_streambuf
buf_;
59
};
60
61
}
// namespace util
62
#endif
// _UTIL_BZIP2_STREAMBUF_H_
util::bzip2_streambuf
Definition
bzip2_streambuf.h:32
util
SCC common utilities.
Definition
bit_field.h:30
src
common
util
bzip2_streambuf.h
Generated by
1.15.0