Visualization Library 2.0.0-b5
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
Gzipped file stream buffer class. More...
#include <zfstream.h>
Public Member Functions | |
gzfilebuf () | |
virtual | ~gzfilebuf () |
gzfilebuf * | open (const char *name, int io_mode) |
gzfilebuf * | attach (int file_descriptor, int io_mode) |
gzfilebuf * | close () |
int | setcompressionlevel (int comp_level) |
int | setcompressionstrategy (int comp_strategy) |
int | is_open () const |
virtual streampos | seekoff (streamoff, ios::seek_dir, int) |
virtual int | sync () |
gzfilebuf () | |
virtual | ~gzfilebuf () |
int | setcompression (int comp_level, int comp_strategy=Z_DEFAULT_STRATEGY) |
Set compression level and strategy on the fly. More... | |
bool | is_open () const |
Check if file is open. More... | |
gzfilebuf * | open (const char *name, std::ios_base::openmode mode) |
Open gzipped file. More... | |
gzfilebuf * | attach (int fd, std::ios_base::openmode mode) |
Attach to already open gzipped file. More... | |
gzfilebuf * | close () |
Close gzipped file. More... | |
Protected Member Functions | |
virtual int | underflow () |
virtual int | overflow (int=EOF) |
bool | open_mode (std::ios_base::openmode mode, char *c_mode) const |
Convert ios open mode int to mode string used by zlib. More... | |
virtual std::streamsize | showmanyc () |
Number of characters available in stream buffer. More... | |
virtual int_type | underflow () |
Fill get area from gzipped file. More... | |
virtual int_type | overflow (int_type c=traits_type::eof()) |
Write put area to gzipped file. More... | |
virtual std::streambuf * | setbuf (char_type *p, std::streamsize n) |
Installs external stream buffer. More... | |
virtual int | sync () |
Flush stream buffer to file. More... | |
Gzipped file stream buffer class.
This class implements basic_filebuf for gzipped files. It doesn't yet support seeking (allowed by zlib but slow/limited), putback and read/write access (tricky). Otherwise, it attempts to be a drop-in replacement for the standard file streambuf.
Definition at line 8 of file zfstream.h.
gzfilebuf::gzfilebuf | ( | ) |
Definition at line 4 of file zfstream.cpp.
|
virtual |
Definition at line 10 of file zfstream.cpp.
gzfilebuf::gzfilebuf | ( | ) |
|
virtual |
Definition at line 60 of file zfstream.cpp.
References gzdopen(), is_open(), NULL, and out().
Referenced by gzifstream::attach(), gzofstream::attach(), is_open(), gzifstream::is_open(), and gzofstream::is_open().
Attach to already open gzipped file.
fd | File descriptor. |
mode | Open mode flags. |
this
on success, NULL on failure. Definition at line 79 of file zfstream.cc.
References close(), gzclose(), gzdopen(), is_open(), NULL, open_mode(), out(), and sync().
gzfilebuf * gzfilebuf::close | ( | ) |
Definition at line 102 of file zfstream.cpp.
References gzclose(), is_open(), NULL, and sync().
Referenced by attach(), gzifstream::close(), gzofstream::close(), is_open(), gzifstream::is_open(), gzofstream::is_open(), and ~gzfilebuf().
gzfilebuf* gzfilebuf::close | ( | ) |
Close gzipped file.
this
on success, NULL on failure.
|
inline |
Definition at line 22 of file zfstream.h.
References EOF, NULL, overflow(), seekoff(), sync(), and underflow().
Referenced by attach(), close(), open(), overflow(), showmanyc(), sync(), and underflow().
|
inline |
Check if file is open.
Definition at line 57 of file zfstream.h.
References attach(), close(), NULL, open(), open_mode(), overflow(), setbuf(), showmanyc(), sync(), and underflow().
Definition at line 18 of file zfstream.cpp.
References gzopen(), is_open(), NULL, and out().
Referenced by is_open(), gzifstream::is_open(), gzofstream::is_open(), gzifstream::open(), and gzofstream::open().
Open gzipped file.
name | File name. |
mode | Open mode flags. |
this
on success, NULL on failure. Definition at line 51 of file zfstream.cc.
References gzopen(), is_open(), NULL, open_mode(), and out().
|
protected |
Convert ios open mode int to mode string used by zlib.
Definition at line 131 of file zfstream.cc.
References out(), and vl::trunc().
|
protectedvirtual |
Write put area to gzipped file.
c | Extra character to add to buffer contents. |
This actually writes characters in stream buffer to gzipped file. With unbuffered output this is done one character at a time.
Definition at line 214 of file zfstream.cc.
|
virtual |
|
protectedvirtual |
Installs external stream buffer.
p | Pointer to char buffer. |
n | Size of external buffer. |
this
on success, NULL on failure.Call setbuf(0,0) to enable unbuffered output.
Definition at line 266 of file zfstream.cc.
References gzifstream::gzifstream(), NULL, overflow(), SMALLBUFSIZE, and sync().
Referenced by is_open().
int gzfilebuf::setcompression | ( | int | comp_level, |
int | comp_strategy = Z_DEFAULT_STRATEGY |
||
) |
Set compression level and strategy on the fly.
comp_level | Compression level (see zlib.h for allowed values) |
comp_strategy | Compression strategy (see zlib.h for allowed values) |
Unfortunately, these parameters cannot be modified separately, as the previous zfstream version assumed. Since the strategy is seldom changed, it can default and setcompression(level) then becomes like the old setcompressionlevel(level).
Definition at line 43 of file zfstream.cc.
References gzsetparams().
Referenced by setcompression().
Definition at line 116 of file zfstream.cpp.
References gzsetparams().
Referenced by setcompressionlevel().
Definition at line 122 of file zfstream.cpp.
References gzsetparams().
Referenced by setcompressionstrategy().
|
protectedvirtual |
Number of characters available in stream buffer.
This indicates number of characters in get area of stream buffer. These characters can be read without accessing the gzipped file.
Definition at line 169 of file zfstream.cc.
References gzread(), is_open(), and underflow().
Referenced by is_open().
|
virtual |
|
protectedvirtual |
Flush stream buffer to file.
This calls underflow(EOF) to do the job.
|
protectedvirtual |
Definition at line 135 of file zfstream.cpp.
References EOF, and is_open().
Referenced by is_open(), and showmanyc().
|
protectedvirtual |
Fill get area from gzipped file.
This actually reads characters from gzipped file to stream buffer. Always buffered.
Visualization Library 2.0.0-b5 Reference Documentation
Updated on Mon Feb 10 2020 02:45:01.
© Copyright Michele Bosi. All rights reserved.