X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fmisc%2Fzfstream.hxx;h=1dd3669e1b1853af6dcfccd72163689b0b975d9a;hb=5bab565cfe4c30d6cf08ecaba50af74d5e4f0c98;hp=f95457f3c204e1a89398810634154cde3f177312;hpb=d498199e8ae54cda37b20965ef5b69bdde464977;p=simgear.git diff --git a/simgear/misc/zfstream.hxx b/simgear/misc/zfstream.hxx index f95457f3..1dd3669e 100644 --- a/simgear/misc/zfstream.hxx +++ b/simgear/misc/zfstream.hxx @@ -1,5 +1,8 @@ -// A C++ I/O streams interface to the zlib gz* functions -// +/** + * \file zfstream.hxx + * A C++ I/O streams interface to the zlib gz* functions. + */ + // Written by Bernie Bright, 1998 // Based on zlib/contrib/iostream/ by Kevin Ruland // @@ -25,10 +28,6 @@ #ifndef _zfstream_hxx #define _zfstream_hxx -#ifdef HAVE_CONFIG_H -# include -#endif - #include #ifdef HAVE_ZLIB @@ -38,9 +37,9 @@ #endif // At least Irix needs this -#ifdef FG_HAVE_NATIVE_SGI_COMPILERS +#ifdef SG_HAVE_NATIVE_SGI_COMPILERS #include -FG_USING_STD(char_traits); +SG_USING_STD(char_traits); #endif #ifdef SG_HAVE_STD_INCLUDES @@ -59,10 +58,10 @@ FG_USING_STD(char_traits); # define ios_badbit ios_base::badbit # define ios_failbit ios_base::failbit -FG_USING_STD(streambuf); -FG_USING_STD(ios_base); -FG_USING_STD(streampos); -FG_USING_STD(streamoff); +SG_USING_STD(streambuf); +SG_USING_STD(ios_base); +SG_USING_STD(streampos); +SG_USING_STD(streamoff); #else @@ -81,7 +80,7 @@ FG_USING_STD(streamoff); #if defined(__GNUC__) && __GNUC_MINOR__ < 8 # define ios_binary ios::bin -#elif defined( FG_HAVE_NATIVE_SGI_COMPILERS ) +#elif defined( SG_HAVE_NATIVE_SGI_COMPILERS ) # define ios_binary 0 #else # define ios_binary ios::binary @@ -92,14 +91,13 @@ FG_USING_STD(streamoff); # define ios_badbit ios::badbit # define ios_failbit ios::failbit -# include +# include #endif // SG_HAVE_STD_INCLUDES -//----------------------------------------------------------------------------- -// -// -// +/** + * A C++ I/O streams interface to the zlib gz* functions. + */ class gzfilebuf : public streambuf { public: @@ -111,17 +109,41 @@ public: // typedef char_traits::off_type off_type; #endif + /** Constructor */ gzfilebuf(); + + /** Destructor */ virtual ~gzfilebuf(); + /** + * Open a stream + * @param name file name + * @param io_mode mdoe flags + * @return file stream + */ gzfilebuf* open( const char* name, ios_openmode io_mode ); + + /** + * Attach to an existing file descriptor + * @param file_descriptor file descriptor + * @param io_mode mode flags + * @return file stream + */ gzfilebuf* attach( int file_descriptor, ios_openmode io_mode ); + + /** Close stream */ gzfilebuf* close(); -// int setcompressionlevel( int comp_level ); -// int setcompressionstrategy( int comp_strategy ); + // int setcompressionlevel( int comp_level ); + // int setcompressionstrategy( int comp_strategy ); + + /** @return true if open, false otherwise */ bool is_open() const { return (file != NULL); } + + /** @return stream position */ virtual streampos seekoff( streamoff off, ios_seekdir way, int which ); + + /** sync the stream */ virtual int sync(); protected: @@ -155,10 +177,9 @@ private: void operator= ( const gzfilebuf& ); }; -//----------------------------------------------------------------------------- -// -// -// +/** + * document me + */ struct gzifstream_base { gzifstream_base() {}