14#ifdef CSVZALL_HAVE_COMPRESSED_INPUT
22std::string
ReadZipEntry(
const std::string&
path,
const std::string& requested_entry);
24#ifdef CSVZALL_HAVE_COMPRESSED_INPUT
25class GzipStreambuf :
public std::streambuf {
27 explicit GzipStreambuf(
const std::string&
path);
28 ~GzipStreambuf()
override;
30 GzipStreambuf(
const GzipStreambuf&) =
delete;
31 GzipStreambuf& operator=(
const GzipStreambuf&) =
delete;
34 int_type underflow()
override;
37 gzFile file_ =
nullptr;
38 std::array<char, 64 * 1024>
buffer_{};
50template <
typename...
Args>
52 const std::string& zip_entry,
54#ifndef CSVZALL_HAVE_COMPRESSED_INPUT
58#ifdef CSVZALL_HAVE_COMPRESSED_INPUT
60 return csv::CSVReader(std::move(
stream), std::forward<Args>(
args)...);
62 throw std::runtime_error(
"gzip CSV input is disabled in this build");
66#ifdef CSVZALL_HAVE_COMPRESSED_INPUT
68 return csv::CSVReader(std::move(
stream), std::forward<Args>(
args)...);
70 throw std::runtime_error(
"ZIP CSV input is disabled in this build");
74 return csv::CSVReader(
path, std::forward<Args>(
args)...);
77template <
typename...
Args>
Definition chart_spec.hpp:100
std::string ReadZipEntry(const std::string &path, const std::string &requested_entry)
Definition gzip_stream.cpp:257
bool IsZipPath(std::string_view path)
Definition gzip_stream.cpp:253
bool IsGzipPath(std::string_view path)
Definition gzip_stream.cpp:249
csv::CSVReader OpenCsvReader(const std::string &path, const std::string &zip_entry, Args &&... args)
Definition gzip_stream.hpp:51