Public Member Functions

gzofstream Class Reference

Gzipped file output stream class. More...

#include <zfstream.h>

Inheritance diagram for gzofstream:
Inheritance graph
[legend]
Collaboration diagram for gzofstream:
Collaboration graph
[legend]

Public Member Functions

 gzofstream (const char *name, int io_mode=ios::out)
 gzofstream (int fd, int io_mode=ios::out)
 gzofstream (const char *name, std::ios_base::openmode mode=std::ios_base::out)
 Construct stream on gzipped file to be opened.
 gzofstream (int fd, std::ios_base::openmode mode=std::ios_base::out)
 Construct stream on already open gzipped file.
gzfilebufrdbuf () const
bool is_open ()
 Check if file is open.
void open (const char *name, std::ios_base::openmode mode=std::ios_base::out)
 Open gzipped file.
void attach (int fd, std::ios_base::openmode mode=std::ios_base::out)
 Attach to already open gzipped file.
void close ()
 Close gzipped file.

Detailed Description

Gzipped file output stream class.

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

Definition at line 80 of file zfstream.h.


Constructor & Destructor Documentation

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

Construct stream on gzipped file to be opened.

Parameters:
nameFile name.
modeOpen mode flags (forced to contain ios::out).
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).

Member Function Documentation

void 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().

void close (  )

Close gzipped file.

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

Reimplemented from gzfilestream_common.

bool is_open (  ) [inline]

Check if file is open.

Returns:
True if file is open.

Definition at line 359 of file zfstream.h.

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

Open gzipped file.

Parameters:
nameFile name.
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.

gzfilebuf* rdbuf (  ) const [inline]

Obtain underlying stream buffer.

Definition at line 351 of file zfstream.h.


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