]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/zfstream.hxx
Better error reporting for effects
[simgear.git] / simgear / misc / zfstream.hxx
index 1dd3669e1b1853af6dcfccd72163689b0b975d9a..a8635483d9e619c942fe8eed6117dac838e55fba 100644 (file)
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 // Library General Public License for more details.
 //
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the
-// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA  02111-1307, USA.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
 
 #include <simgear/compiler.h>
 
-#ifdef HAVE_ZLIB
-#  include <zlib.h>
-#else
-#  include <simgear/zlib/zlib.h>
-#endif
-
-// At least Irix needs this
-#ifdef SG_HAVE_NATIVE_SGI_COMPILERS
-#include <char_traits.h>
-SG_USING_STD(char_traits);
-#endif
-
-#ifdef SG_HAVE_STD_INCLUDES
+#include <zlib.h>
 
-#  include <streambuf>
-#  include <istream>
 
-#  define ios_openmode ios_base::openmode
-#  define ios_in       ios_base::in
-#  define ios_out      ios_base::out
-#  define ios_app      ios_base::app
-#  define ios_binary   ios_base::binary
+#include <streambuf>
+#include <istream>
 
-#  define ios_seekdir  ios_base::seekdir
+#define ios_openmode std::ios_base::openmode
+#define ios_in       std::ios_base::in
+#define ios_out      std::ios_base::out
+#define ios_app      std::ios_base::app
+#define ios_binary   std::ios_base::binary
 
-#  define ios_badbit   ios_base::badbit
-#  define ios_failbit  ios_base::failbit
+#define ios_seekdir  std::ios_base::seekdir
 
-SG_USING_STD(streambuf);
-SG_USING_STD(ios_base);
-SG_USING_STD(streampos);
-SG_USING_STD(streamoff);
-
-#else
-
-#  ifdef SG_HAVE_STREAMBUF
-#    include <streambuf.h>
-#    include <istream.h>
-#  else
-#    include <iostream.h>
-#  endif
-
-//#  define ios_openmode ios::open_mode
-#  define ios_openmode int
-#  define ios_in       ios::in
-#  define ios_out      ios::out
-#  define ios_app      ios::app
-
-#if defined(__GNUC__) && __GNUC_MINOR__ < 8
-#  define ios_binary   ios::bin
-#elif defined( SG_HAVE_NATIVE_SGI_COMPILERS )
-#  define ios_binary   0
-#else
-#  define ios_binary   ios::binary
-#endif
-
-#  define ios_seekdir  ios::seek_dir
-
-#  define ios_badbit   ios::badbit
-#  define ios_failbit  ios::failbit
-
-#  include <simgear/sg_traits.hxx>
-
-#endif // SG_HAVE_STD_INCLUDES
+#define ios_badbit   std::ios_base::badbit
+#define ios_failbit  std::ios_base::failbit
 
 /**
  * A C++ I/O streams interface to the zlib gz* functions.
  */
-class gzfilebuf : public streambuf
-{
-public:
-
-#ifndef SG_HAVE_STD_INCLUDES
-    typedef char_traits<char>           traits_type;
-    typedef char_traits<char>::int_type int_type;
-    // typedef char_traits<char>::pos_type pos_type;
-    // typedef char_traits<char>::off_type off_type;
+#ifdef SG_NEED_STREAMBUF_HACK
+class gzfilebuf : public __streambuf {
+    typedef __streambuf parent;
+#else
+class gzfilebuf : public std::streambuf {
+    typedef std::streambuf parent;
 #endif
 
+public:
     /** Constructor */
     gzfilebuf();
 
@@ -141,7 +90,7 @@ public:
     bool is_open() const { return (file != NULL); }
 
     /** @return stream position */
-    virtual streampos seekoff( streamoff off, ios_seekdir way, int which );
+    virtual std::streampos seekoff( std::streamoff off, ios_seekdir way, int which );
 
     /** sync the stream */
     virtual int sync();
@@ -149,8 +98,8 @@ public:
 protected:
 
     virtual int_type underflow();
-    virtual int_type overflow( int_type c = traits_type::eof() );
 
+    virtual int_type overflow( int_type c = parent::traits_type::eof() );
 private:
 
     int_type flushbuf();