]> git.mxchange.org Git - simgear.git/blob - Misc/fgstream.hxx
Added the Serial subdirectory
[simgear.git] / Misc / fgstream.hxx
1 // zlib input file stream wrapper.
2 //
3 // Written by Bernie Bright, 1998
4 //
5 // Copyright (C) 1998  Bernie Bright - bbright@c031.aone.net.au
6 //
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.
11 //
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.
16 //
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.
20 //
21 // $Id$
22 // (Log is kept at end of this file)
23
24 #ifndef _FGSTREAM_HXX
25 #define _FGSTREAM_HXX
26
27 #ifndef __cplusplus                                                          
28 # error This library requires C++
29 #endif                                   
30
31 #ifdef HAVE_CONFIG_H
32 #  include "Include/config.h"
33 #endif
34
35 #include <string>
36
37 #include "Include/compiler.h"
38 FG_USING_STD(string);
39
40 // #ifdef FG_HAVE_STD_INCLUDES
41 // #include <istream>
42 // #else
43 // #include <istream.h>
44 // #endif
45
46 #include "zfstream.hxx"
47
48 // Input stream manipulator function type.
49 class fg_gzifstream;
50 typedef fg_gzifstream& (*IManipFunc)( fg_gzifstream& );
51
52 //-----------------------------------------------------------------------------
53 //
54 // Envelope class for gzifstream.
55 //
56 class fg_gzifstream : private gzifstream_base, public istream
57 {
58 public:
59     //
60     fg_gzifstream();
61
62     // Attempt to open a file with and without ".gz" extension.
63     fg_gzifstream( const string& name,
64                    ios_openmode io_mode = ios_in | ios_binary );
65
66     // 
67     fg_gzifstream( int fd, ios_openmode io_mode = ios_in|ios_binary );
68
69     // Attempt to open a file with and without ".gz" extension.
70     void open( const string& name,
71                ios_openmode io_mode = ios_in|ios_binary );
72
73     void attach( int fd, ios_openmode io_mode = ios_in|ios_binary );
74
75 private:
76     // Not defined!
77     fg_gzifstream( const fg_gzifstream& );    
78     void operator= ( const fg_gzifstream& );    
79 };
80
81 // istream manipulator that skips to end of line.
82 istream& skipeol( istream& in );
83
84 // istream manipulator that skips over white space.
85 istream& skipws( istream& in );
86
87 // istream manipulator that skips comments and white space.
88 // A comment starts with '#'.
89 istream& skipcomment( istream& in );
90
91
92 #endif /* _FGSTREAM_HXX */
93
94 // $Log$
95 // Revision 1.5  1998/11/06 14:05:13  curt
96 // More portability improvements by Bernie Bright.
97 //
98 // Revision 1.4  1998/10/16 00:50:56  curt
99 // Remove leading _ from a couple defines.
100 //
101 // Revision 1.3  1998/10/13 00:10:06  curt
102 // More portability changes to help with windoze compilation problems.
103 //
104 // Revision 1.2  1998/09/24 15:22:18  curt
105 // Additional enhancements.
106 //
107 // Revision 1.1  1998/09/01 19:06:29  curt
108 // Initial revision.
109 //