1 // zlib input file stream wrapper.
3 // Written by Bernie Bright, 1998
5 // Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 # error This library requires C++
34 #include <simgear/compiler.h>
36 #if defined( FG_HAVE_STD_INCLUDES )
38 #elif defined ( FG_HAVE_NATIVE_SGI_COMPILERS )
39 # include <CC/stream.h>
40 #elif defined ( __BORLANDC__ )
48 #include <simgear/zfstream.hxx>
52 #ifndef FG_HAVE_NATIVE_SGI_COMPILERS
53 FG_USING_STD(istream);
57 //-----------------------------------------------------------------------------
59 // Envelope class for gzifstream.
61 class fg_gzifstream : private gzifstream_base, public istream
67 // Attempt to open a file with and without ".gz" extension.
68 fg_gzifstream( const string& name,
69 ios_openmode io_mode = ios_in | ios_binary );
72 fg_gzifstream( int fd, ios_openmode io_mode = ios_in|ios_binary );
74 // Attempt to open a file with and without ".gz" extension.
75 void open( const string& name,
76 ios_openmode io_mode = ios_in|ios_binary );
78 void attach( int fd, ios_openmode io_mode = ios_in|ios_binary );
80 void close() { gzbuf.close(); }
82 bool is_open() { return gzbuf.is_open(); }
86 fg_gzifstream( const fg_gzifstream& );
87 void operator= ( const fg_gzifstream& );
90 // istream manipulator that skips to end of line.
91 istream& skipeol( istream& in );
93 // istream manipulator that skips over white space.
94 istream& skipws( istream& in );
96 // istream manipulator that skips comments and white space.
97 // A comment starts with '#'.
98 istream& skipcomment( istream& in );
101 #endif /* _FGSTREAM_HXX */