GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
gzifstream Class Reference

Gzipped file input stream class. More...

#include "zfstream.h"

Inheritance diagram for gzifstream:
Collaboration diagram for gzifstream:

Public Member Functions

 gzifstream ()
 
 gzifstream (const char *name, std::ios_base::openmode mode=std::ios_base::in)
 Construct stream on gzipped file to be opened. More...
 
 gzifstream (int fd, std::ios_base::openmode mode=std::ios_base::in)
 Construct stream on already open gzipped file. More...
 
void attach (int fd, std::ios_base::openmode mode=std::ios_base::in)
 Attach to already open gzipped file. More...
 
void close ()
 Close gzipped file. More...
 
bool is_open ()
 Check if file is open. More...
 
void open (const char *name, std::ios_base::openmode mode=std::ios_base::in)
 Open gzipped file. More...
 
gzfilebufrdbuf () const
 Obtain underlying stream buffer. More...
 

Private Attributes

gzfilebuf sb
 Underlying stream buffer. More...
 

Detailed Description

Gzipped file input stream class.

This class implements ifstream for gzipped files. Seeking and putback is not supported yet.

Definition at line 281 of file zfstream.h.

Constructor & Destructor Documentation

◆ gzifstream() [1/3]

gzifstream::gzifstream ( )

Definition at line 523 of file zfstream.cc.

References sb.

◆ gzifstream() [2/3]

gzifstream::gzifstream ( const char *  name,
std::ios_base::openmode  mode = std::ios_base::in 
)
explicit

Construct stream on gzipped file to be opened.

Parameters
nameFilename.
modeOpen mode flags (forced to contain ios::in).

Definition at line 528 of file zfstream.cc.

References open(), and sb.

◆ gzifstream() [3/3]

gzifstream::gzifstream ( int  fd,
std::ios_base::openmode  mode = std::ios_base::in 
)
explicit

Construct stream on already open gzipped file.

Parameters
fdFile descriptor.
modeOpen mode flags (forced to contain ios::in).

Definition at line 536 of file zfstream.cc.

References attach(), and sb.

Member Function Documentation

◆ attach()

void gzifstream::attach ( int  fd,
std::ios_base::openmode  mode = std::ios_base::in 
)

Attach to already open gzipped file.

Parameters
fdFile descriptor.
modeOpen mode flags (forced to contain ios::in).

Stream will be in state good() if attach succeeded; otherwise in state fail().

Definition at line 555 of file zfstream.cc.

References gzfilebuf::attach(), and sb.

Referenced by gzifstream().

◆ close()

void gzifstream::close ( void  )

Close gzipped file.

Stream will be in state fail() if close failed.

Definition at line 565 of file zfstream.cc.

References gzfilebuf::close(), and sb.

Referenced by octave::load_save_system::get_file_format(), and octave::load_save_system::load().

◆ is_open()

bool gzifstream::is_open ( void  )
inline

Check if file is open.

Returns
True if file is open.

Definition at line 317 of file zfstream.h.

References gzfilebuf::is_open(), and sb.

◆ open()

void gzifstream::open ( const char *  name,
std::ios_base::openmode  mode = std::ios_base::in 
)

Open gzipped file.

Parameters
nameFilename.
modeOpen mode flags (forced to contain ios::in).

Stream will be in state good() if file opens successfully; otherwise in state fail(). This differs from the behavior of ifstream, which never sets the state to good() and therefore won't allow you to reuse the stream for a second file unless you manually clear() the state. The choice is a matter of convenience.

Definition at line 545 of file zfstream.cc.

References name, gzfilebuf::open(), and sb.

Referenced by gzifstream().

◆ rdbuf()

gzfilebuf* gzifstream::rdbuf ( void  ) const
inline

Obtain underlying stream buffer.

Definition at line 309 of file zfstream.h.

References sb.

Member Data Documentation

◆ sb

gzfilebuf gzifstream::sb
private

Underlying stream buffer.

Definition at line 359 of file zfstream.h.

Referenced by gzifstream(), attach(), close(), is_open(), open(), and rdbuf().


The documentation for this class was generated from the following files: