Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
gzip_streambuf.h
1#ifndef SOURCEMETA_CORE_GZIP_STREAMBUF_H_
2#define SOURCEMETA_CORE_GZIP_STREAMBUF_H_
3
4#ifndef SOURCEMETA_CORE_GZIP_EXPORT
5#include <sourcemeta/core/gzip_export.h>
6#endif
7
8#include <istream> // std::istream
9#include <memory> // std::unique_ptr
10#include <streambuf> // std::streambuf
11
12namespace sourcemeta::core {
13
17class SOURCEMETA_CORE_GZIP_EXPORT GZIPStreamBuffer : public std::streambuf {
18public:
20 GZIPStreamBuffer(std::istream &compressed_stream);
21 ~GZIPStreamBuffer() override;
22
23 GZIPStreamBuffer(const GZIPStreamBuffer &) = delete;
24 auto operator=(const GZIPStreamBuffer &) -> GZIPStreamBuffer & = delete;
26 auto operator=(GZIPStreamBuffer &&) -> GZIPStreamBuffer & = delete;
27
28protected:
30 auto underflow() -> int_type override;
31
32private:
33// Exporting symbols that depends on the standard C++ library is considered
34// safe.
35// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170&redirectedfrom=MSDN
36#if defined(_MSC_VER)
37#pragma warning(disable : 4251)
38#endif
39 struct Internal;
40 std::unique_ptr<Internal> internal;
41#if defined(_MSC_VER)
42#pragma warning(default : 4251)
43#endif
44};
45
46} // namespace sourcemeta::core
47
48#endif
GZIPStreamBuffer(std::istream &compressed_stream)
Construct a stream buffer over a compressed input stream.
auto underflow() -> int_type override
Refill the buffer with more decompressed data.