3 * zlib input file stream wrapper.
6 // Written by Bernie Bright, 1998
8 // Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Library General Public
12 // License as published by the Free Software Foundation; either
13 // version 2 of the License, or (at your option) any later version.
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Library General Public License for more details.
20 // You should have received a copy of the GNU General Public License
21 // along with this program; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 # error This library requires C++
34 #include <simgear/compiler.h>
36 #if defined( SG_HAVE_STD_INCLUDES )
38 #elif defined ( __BORLANDC__ )
46 #include <simgear/misc/zfstream.hxx>
49 SG_USING_STD(istream);
53 * An envelope class for gzifstream.
55 class sg_gzifstream : private gzifstream_base, public istream
58 /** Default constructor */
62 * Constructor that attempt to open a file with and without
64 * @param name name of file
65 * @param io_mode file open mode(s) "or'd" together
67 sg_gzifstream( const string& name,
68 ios_openmode io_mode = ios_in | ios_binary );
71 * Constructor that attaches itself to an existing file descriptor.
72 * @param fd file descriptor
73 * @param io_mode file open mode(s) "or'd" together
75 sg_gzifstream( int fd, ios_openmode io_mode = ios_in|ios_binary );
78 * Attempt to open a file with and without ".gz" extension.
79 * @param name name of file
80 * @param io_mode file open mode(s) "or'd" together
82 void open( const string& name,
83 ios_openmode io_mode = ios_in|ios_binary );
86 * Attach to an existing file descriptor.
87 * @param fd file descriptor
88 * @param io_mode file open mode(s) "or'd" together
90 void attach( int fd, ios_openmode io_mode = ios_in|ios_binary );
95 void close() { gzbuf.close(); }
97 /** @return true if the file is successfully opened, false otherwise. */
98 bool is_open() { return gzbuf.is_open(); }
102 sg_gzifstream( const sg_gzifstream& );
103 void operator= ( const sg_gzifstream& );
107 * \relates sg_gzifstream
108 * An istream manipulator that skips to end of line.
109 * @param in input stream
111 istream& skipeol( istream& in );
114 * \relates sg_gzifstream
115 * An istream manipulator that skips over white space.
116 * @param in input stream
118 istream& skipws( istream& in );
121 * \relates sg_gzifstream
122 * An istream manipulator that skips comments and white space.
123 * Ignores comments that start with '#'.
124 * @param in input stream
126 istream& skipcomment( istream& in );
129 #endif /* _SGSTREAM_HXX */