]> git.mxchange.org Git - simgear.git/blobdiff - Misc/fgstream.hxx
Tweak for SGI portability.
[simgear.git] / Misc / fgstream.hxx
index f9f74b6a31474de1fd41f90d9b848e018c03b9e0..e202a78c25cfaddb098a32502ef40d026b2bd117 100644 (file)
 #endif                                   
 
 #ifdef HAVE_CONFIG_H
-#  include "config.h"
+#  include "Include/config.h"
 #endif
 
 #include <string>
 
+#include "Include/compiler.h"
+FG_USING_STD(string);
+
+// #ifdef FG_HAVE_STD_INCLUDES
+// #include <istream>
+// #else
+// #include <istream.h>
+// #endif
+
 #include "zfstream.hxx"
 
+// Input stream manipulator function type.
+class fg_gzifstream;
+typedef fg_gzifstream& (*IManipFunc)( fg_gzifstream& );
+
 //-----------------------------------------------------------------------------
 //
 // Envelope class for gzifstream.
 //
-class fg_gzifstream
+class fg_gzifstream : private gzifstream_base, public istream
 {
 public:
     //
@@ -48,47 +61,49 @@ public:
 
     // Attempt to open a file with and without ".gz" extension.
     fg_gzifstream( const string& name,
-                  int io_mode = ios::in|ios::binary );
+                  ios_openmode io_mode = ios_in | ios_binary );
+
+    // 
+    fg_gzifstream( int fd, ios_openmode io_mode = ios_in|ios_binary );
 
     // Attempt to open a file with and without ".gz" extension.
     void open( const string& name,
-              int io_mode = ios::in|ios::binary );
-
-    // Return the underlying stream.
-    istream& stream() { return gzstream; }
-
-    // Check stream state.
-    bool operator ! () const { return !gzstream; }
-
-    // Check for end of file.
-    bool eof() const { return gzstream.eof(); }
-
-    // Remove whitespace from stream.
-    // Whitespace is as defined by isspace().
-    istream& eat_whitespace();
-
-    // Removes comments and whitespace from stream.
-    // A comment is any line starting with '#'.
-    istream& eat_comments();
-
-    // Read one character from stream.
-    istream& get( char& c ) { return gzstream.get(c); }
+              ios_openmode io_mode = ios_in|ios_binary );
 
-    // Put a character back into the input buffer.
-    istream& putback( char c ) { return gzstream.putback(c); }
-
-private:
-    // The underlying compressed data stream.
-    gzifstream gzstream;
+    void attach( int fd, ios_openmode io_mode = ios_in|ios_binary );
 
 private:
     // Not defined!
     fg_gzifstream( const fg_gzifstream& );    
+    void operator= ( const fg_gzifstream& );    
 };
 
+// istream manipulator that skips to end of line.
+istream& skipeol( istream& in );
+
+// istream manipulator that skips over white space.
+istream& skipws( istream& in );
+
+// istream manipulator that skips comments and white space.
+// A comment starts with '#'.
+istream& skipcomment( istream& in );
+
+
 #endif /* _FGSTREAM_HXX */
 
 // $Log$
+// Revision 1.5  1998/11/06 14:05:13  curt
+// More portability improvements by Bernie Bright.
+//
+// Revision 1.4  1998/10/16 00:50:56  curt
+// Remove leading _ from a couple defines.
+//
+// Revision 1.3  1998/10/13 00:10:06  curt
+// More portability changes to help with windoze compilation problems.
+//
+// Revision 1.2  1998/09/24 15:22:18  curt
+// Additional enhancements.
+//
 // Revision 1.1  1998/09/01 19:06:29  curt
 // Initial revision.
 //