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++
32 # include "Include/config.h"
35 #include <Include/compiler.h>
37 #if defined( FG_HAVE_STD_INCLUDES )
39 #elif defined ( FG_HAVE_NATIVE_SGI_COMPILERS )
40 # include <CC/stream.h>
47 #include "zfstream.hxx"
51 #ifndef FG_HAVE_NATIVE_SGI_COMPILERS
52 FG_USING_STD(istream);
56 //-----------------------------------------------------------------------------
58 // Envelope class for gzifstream.
60 class fg_gzifstream : private gzifstream_base, public istream
66 // Attempt to open a file with and without ".gz" extension.
67 fg_gzifstream( const string& name,
68 ios_openmode io_mode = ios_in | ios_binary );
71 fg_gzifstream( int fd, ios_openmode io_mode = ios_in|ios_binary );
73 // Attempt to open a file with and without ".gz" extension.
74 void open( const string& name,
75 ios_openmode io_mode = ios_in|ios_binary );
77 void attach( int fd, ios_openmode io_mode = ios_in|ios_binary );
79 void close() { gzbuf.close(); }
81 bool is_open() { return gzbuf.is_open(); }
85 fg_gzifstream( const fg_gzifstream& );
86 void operator= ( const fg_gzifstream& );
89 // istream manipulator that skips to end of line.
90 istream& skipeol( istream& in );
92 // istream manipulator that skips over white space.
93 istream& skipws( istream& in );
95 // istream manipulator that skips comments and white space.
96 // A comment starts with '#'.
97 istream& skipcomment( istream& in );
100 #endif /* _FGSTREAM_HXX */
103 // Revision 1.9 1999/03/27 14:04:25 curt
104 // Added is_open() so we can check if the open() succeeded.
106 // Revision 1.8 1999/03/02 01:01:55 curt
107 // Tweaks for compiling with native SGI compilers.
109 // Revision 1.7 1999/02/26 22:08:08 curt
110 // Added initial support for native SGI compilers.
112 // Revision 1.6 1999/01/19 20:41:46 curt
113 // Portability updates contributed by Bernie Bright.
115 // Revision 1.5 1998/11/06 14:05:13 curt
116 // More portability improvements by Bernie Bright.
118 // Revision 1.4 1998/10/16 00:50:56 curt
119 // Remove leading _ from a couple defines.
121 // Revision 1.3 1998/10/13 00:10:06 curt
122 // More portability changes to help with windoze compilation problems.
124 // Revision 1.2 1998/09/24 15:22:18 curt
125 // Additional enhancements.
127 // Revision 1.1 1998/09/01 19:06:29 curt