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 library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the
19 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 // Boston, MA 02111-1307, USA.
28 # error This library requires C++
35 #include <simgear/compiler.h>
37 #if defined( FG_HAVE_STD_INCLUDES )
39 #elif defined ( FG_HAVE_NATIVE_SGI_COMPILERS )
40 # include <CC/stream.h>
41 #elif defined ( __BORLANDC__ )
49 #include <simgear/misc/zfstream.hxx>
53 #ifndef FG_HAVE_NATIVE_SGI_COMPILERS
54 FG_USING_STD(istream);
58 //-----------------------------------------------------------------------------
60 // Envelope class for gzifstream.
62 class fg_gzifstream : private gzifstream_base, public istream
68 // Attempt to open a file with and without ".gz" extension.
69 fg_gzifstream( const string& name,
70 ios_openmode io_mode = ios_in | ios_binary );
73 fg_gzifstream( int fd, ios_openmode io_mode = ios_in|ios_binary );
75 // Attempt to open a file with and without ".gz" extension.
76 void open( const string& name,
77 ios_openmode io_mode = ios_in|ios_binary );
79 void attach( int fd, ios_openmode io_mode = ios_in|ios_binary );
81 void close() { gzbuf.close(); }
83 bool is_open() { return gzbuf.is_open(); }
87 fg_gzifstream( const fg_gzifstream& );
88 void operator= ( const fg_gzifstream& );
91 // istream manipulator that skips to end of line.
92 istream& skipeol( istream& in );
94 // istream manipulator that skips over white space.
95 istream& skipws( istream& in );
97 // istream manipulator that skips comments and white space.
98 // A comment starts with '#'.
99 istream& skipcomment( istream& in );
102 #endif /* _FGSTREAM_HXX */