SimGear - Simulator Construction Tools
sg_gzifstream Class Reference

#include <sgstream.hxx>

Inheritance diagram for sg_gzifstream:
gzifstream_base simgear::gzContainerReader

Public Member Functions

 sg_gzifstream ()
 
 sg_gzifstream (const SGPath &name, ios_openmode io_mode=ios_in|ios_binary, bool use_exact_name=false)
 
 sg_gzifstream (int fd, ios_openmode io_mode=ios_in|ios_binary)
 
z_off_t approxOffset ()
 
void attach (int fd, ios_openmode io_mode=ios_in|ios_binary)
 
void close ()
 
bool is_open ()
 
void open (const SGPath &name, ios_openmode io_mode=ios_in|ios_binary, bool use_exact_name=false)
 

Private Member Functions

 sg_gzifstream (const sg_gzifstream &)
 
void operator= (const sg_gzifstream &)
 

Private Attributes

gzfilebuf gzbuf
 

Related Functions

(Note that these are not member functions.)

std::istream & skipcomment (std::istream &in)
 
std::istream & skipeol (std::istream &in)
 
std::istream & skipws (std::istream &in)
 

Detailed Description

An envelope class for gzifstream.

Definition at line 50 of file sgstream.hxx.

Constructor & Destructor Documentation

sg_gzifstream::sg_gzifstream ( )

Default constructor

Definition at line 38 of file sgstream.cxx.

sg_gzifstream::sg_gzifstream ( const SGPath name,
ios_openmode  io_mode = ios_in | ios_binary,
bool  use_exact_name = false 
)

Constructor that attempts to open a file.

Parameters
namename of file
io_modefile open mode(s) "or'd" together
use_exact_nameif false, try to add or remove a ".gz" extension in case the indicated file can't be opened

Definition at line 47 of file sgstream.cxx.

sg_gzifstream::sg_gzifstream ( int  fd,
ios_openmode  io_mode = ios_in|ios_binary 
)

Constructor that attaches itself to an existing file descriptor.

Parameters
fdfile descriptor
io_modefile open mode(s) "or'd" together

Definition at line 58 of file sgstream.cxx.

sg_gzifstream::sg_gzifstream ( const sg_gzifstream )
private

Member Function Documentation

z_off_t sg_gzifstream::approxOffset ( )
Returns
the current offset in the file being read or written. The offset corresponds to compressed data if the file is compressed, and is influenced by buffering performed in zlib, hence the "approx" qualifier. It should be suitable for progress indicators and such, though.

Definition at line 106 of file sgstream.cxx.

void sg_gzifstream::attach ( int  fd,
ios_openmode  io_mode = ios_in|ios_binary 
)

Attach to an existing file descriptor.

Parameters
fdfile descriptor
io_modefile open mode(s) "or'd" together

Definition at line 100 of file sgstream.cxx.

void sg_gzifstream::close ( void  )
inline

Close the stream.

Definition at line 95 of file sgstream.hxx.

bool sg_gzifstream::is_open ( )
inline
Returns
true if the file is successfully opened, false otherwise.

Definition at line 98 of file sgstream.hxx.

Referenced by SGStarData::load(), simgear::ReaderWriterSTG::_ModelBin::read(), and SGInterpTable::SGInterpTable().

void sg_gzifstream::open ( const SGPath name,
ios_openmode  io_mode = ios_in|ios_binary,
bool  use_exact_name = false 
)

Attempt to open a file.

Parameters
namename of file
io_modefile open mode(s) "or'd" together
use_exact_nameif false, try to add or remove a ".gz" extension in case the indicated file can't be opened

Definition at line 75 of file sgstream.cxx.

Referenced by sg_gzifstream().

void sg_gzifstream::operator= ( const sg_gzifstream )
private

Friends And Related Function Documentation

std::istream & skipcomment ( std::istream &  in)
related

An istream manipulator that skips comments and white space. Ignores comments that start with '#'.

Parameters
ininput stream

Definition at line 147 of file sgstream.cxx.

std::istream & skipeol ( std::istream &  in)
related

An istream manipulator that skips to end of line.

Parameters
ininput stream

Definition at line 115 of file sgstream.cxx.

Referenced by main(), and skipcomment().

std::istream & skipws ( std::istream &  in)
related

An istream manipulator that skips over white space.

Parameters
ininput stream

Definition at line 133 of file sgstream.cxx.

Referenced by skipcomment().

Member Data Documentation

gzfilebuf gzifstream_base::gzbuf
inherited

Definition at line 154 of file gzfstream.hxx.

Referenced by approxOffset(), attach(), close(), is_open(), open(), and sg_gzifstream().


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