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

Gzipped file output stream class. More...

#include "gzfstream.h"

Inheritance diagram for gzofstream:
Collaboration diagram for gzofstream:

Public Member Functions

 gzofstream ()
 
 gzofstream (const char *name, std::ios_base::openmode mode=std::ios_base::out)
 Construct stream on gzipped file to be opened. More...
 
 gzofstream (int fd, std::ios_base::openmode mode=std::ios_base::out)
 Construct stream on already open gzipped file. More...
 
void attach (int fd, std::ios_base::openmode mode=std::ios_base::out)
 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::out)
 Open gzipped file. More...
 
gzfilebufrdbuf () const
 Obtain underlying stream buffer. More...
 

Private Attributes

gzfilebuf m_sb
 Underlying stream buffer. More...
 

Detailed Description

Gzipped file output stream class.

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

Definition at line 368 of file gzfstream.h.

Constructor & Destructor Documentation

◆ gzofstream() [1/3]

gzofstream::gzofstream ( )

Definition at line 573 of file gzfstream.cc.

References m_sb.

◆ gzofstream() [2/3]

gzofstream::gzofstream ( const char *  name,
std::ios_base::openmode  mode = std::ios_base::out 
)
explicit

Construct stream on gzipped file to be opened.

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

Definition at line 578 of file gzfstream.cc.

References m_sb, and open().

◆ gzofstream() [3/3]

gzofstream::gzofstream ( int  fd,
std::ios_base::openmode  mode = std::ios_base::out 
)
explicit

Construct stream on already open gzipped file.

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

Definition at line 586 of file gzfstream.cc.

References attach(), and m_sb.

Member Function Documentation

◆ attach()

void gzofstream::attach ( int  fd,
std::ios_base::openmode  mode = std::ios_base::out 
)

Attach to already open gzipped file.

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

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

Definition at line 605 of file gzfstream.cc.

References gzfilebuf::attach(), and m_sb.

Referenced by gzofstream().

◆ close()

void gzofstream::close ( void  )

Close gzipped file.

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

Definition at line 615 of file gzfstream.cc.

References gzfilebuf::close(), and m_sb.

Referenced by load_save_system::dump_octave_core(), and load_save_system::save().

◆ is_open()

bool gzofstream::is_open ( void  )
inline

Check if file is open.

Returns
True if file is open.

Definition at line 404 of file gzfstream.h.

References gzfilebuf::is_open(), and m_sb.

◆ open()

void gzofstream::open ( const char *  name,
std::ios_base::openmode  mode = std::ios_base::out 
)

Open gzipped file.

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

Stream will be in state good() if file opens successfully; otherwise in state fail(). This differs from the behavior of ofstream, 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 595 of file gzfstream.cc.

References m_sb, and gzfilebuf::open().

Referenced by gzofstream().

◆ rdbuf()

gzfilebuf* gzofstream::rdbuf ( void  ) const
inline

Obtain underlying stream buffer.

Definition at line 396 of file gzfstream.h.

References m_sb.

Referenced by setcompression().

Member Data Documentation

◆ m_sb

gzfilebuf gzofstream::m_sb
private

Underlying stream buffer.

Definition at line 446 of file gzfstream.h.

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


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