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.
22 // (Log is kept at end of this file)
28 # error This library requires C++
37 #include "zfstream.hxx"
39 //-----------------------------------------------------------------------------
41 // Envelope class for gzifstream.
49 // Attempt to open a file with and without ".gz" extension.
50 fg_gzifstream( const string& name,
51 int io_mode = ios::in|ios::binary );
54 fg_gzifstream( int fd, int io_mode = ios::in|ios::binary );
56 // Attempt to open a file with and without ".gz" extension.
57 void open( const string& name,
58 int io_mode = ios::in|ios::binary );
60 // Return the underlying stream.
61 istream& stream() { return gzstream; }
63 // Check stream state.
64 bool operator ! () const { return !gzstream; }
66 // Check for end of file.
67 bool eof() const { return gzstream.eof(); }
69 // Remove whitespace from stream.
70 // Whitespace is as defined by isspace().
71 istream& eat_whitespace();
73 // Removes comments and whitespace from stream.
74 // A comment is any line starting with '#'.
75 istream& eat_comments();
77 // Read one character from stream.
78 istream& get( char& c ) { return gzstream.get(c); }
80 // Put a character back into the input buffer.
81 istream& putback( char c ) { return gzstream.putback(c); }
84 // The underlying compressed data stream.
89 fg_gzifstream( const fg_gzifstream& );
92 // istream manipulator that skips to end of line.
93 istream& skipeol( istream& in );
95 // istream manipulator that skips over white space.
96 istream& skipws( istream& in );
98 // istream manipulator that skips comments and white space.
99 // A comment starts with '#'.
100 istream& skipcomment( istream& in );
102 #endif /* _FGSTREAM_HXX */
105 // Revision 1.2 1998/09/24 15:22:18 curt
106 // Additional enhancements.
108 // Revision 1.1 1998/09/01 19:06:29 curt