From: Martin v. Löwis Date: Fri, 28 Jan 2000 09:54:58 +0000 (+0000) Subject: fstream.h (ifstream::ifstream): Add ios::in to mode. X-Git-Tag: prereleases/gcc-2.95.3-test1~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddab14d90ceec9a7f909142e4af3e7fbf7134bca;p=thirdparty%2Fgcc.git fstream.h (ifstream::ifstream): Add ios::in to mode. * fstream.h (ifstream::ifstream): Add ios::in to mode. (ifstream::open): Likewise. (ofstream::ofstream): Add ios::out to mode. (ofstream::open): Likewise. From-SVN: r31665 --- diff --git a/libio/ChangeLog b/libio/ChangeLog index 8151dc26ee35..d78e5056a4e4 100644 --- a/libio/ChangeLog +++ b/libio/ChangeLog @@ -1,3 +1,10 @@ +2000-01-28 Martin v. Löwis + + * fstream.h (ifstream::ifstream): Add ios::in to mode. + (ifstream::open): Likewise. + (ofstream::ofstream): Add ios::out to mode. + (ofstream::open): Likewise. + 1999-12-21 Martin v. Löwis * filebuf.cc (open): Support ios::ate if _G_HAVE_IO_FILE_OPEN. diff --git a/libio/fstream.h b/libio/fstream.h index ea98f5caed05..1dc4ca1d418b 100644 --- a/libio/fstream.h +++ b/libio/fstream.h @@ -1,92 +1,5 @@ -/* This is part of libio/iostream, providing -*- C++ -*- input/output. -Copyright (C) 1993 Free Software Foundation - -This file is part of the GNU IO Library. This library is free -software; you can redistribute it and/or modify it under the -terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) -any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this library; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -As a special exception, if you link this library with files -compiled with a GNU compiler to produce an executable, this does not cause -the resulting executable to be covered by the GNU General Public License. -This exception does not however invalidate any other reasons why -the executable file might be covered by the GNU General Public License. */ - -#ifndef _FSTREAM_H -#define _FSTREAM_H -#ifdef __GNUG__ -#pragma interface -#endif -#include - -extern "C++" { -class fstreambase : virtual public ios { -#ifdef _IO_NEW_STREAMS - mutable filebuf __my_fb; // mutable so rdbuf() can be const -#endif - void __fb_init (); - public: - fstreambase(); - fstreambase(int fd); - fstreambase(int fd, char *p, int l); /* Deprecated */ - fstreambase(const char *name, int mode, int prot=0664); - void close(); -#ifdef _IO_NEW_STREAMS - filebuf* rdbuf() const { return &__my_fb; } -#else - filebuf* rdbuf() const { return (filebuf*) ios::rdbuf(); } -#endif - void open(const char *name, int mode, int prot=0664); - int is_open() const { return rdbuf()->is_open(); } - void setbuf(char *ptr, int len) { rdbuf()->setbuf(ptr, len); } - void attach(int fd); -#ifdef _STREAM_COMPAT - int filedesc() { return rdbuf()->fd(); } - fstreambase& raw() { rdbuf()->setbuf(NULL, 0); return *this; } -#endif -}; - -class ifstream : public fstreambase, public istream { - public: - ifstream() : fstreambase() { } - ifstream(int fd) : fstreambase(fd) { } - ifstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/ - ifstream(const char *name, int mode=ios::in, int prot=0664) - : fstreambase(name, mode, prot) { } - void open(const char *name, int mode=ios::in, int prot=0664) - { fstreambase::open(name, mode, prot); } -}; - -class ofstream : public fstreambase, public ostream { - public: - ofstream() : fstreambase() { } - ofstream(int fd) : fstreambase(fd) { } - ofstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/ - ofstream(const char *name, int mode=ios::out, int prot=0664) - : fstreambase(name, mode, prot) { } - void open(const char *name, int mode=ios::out, int prot=0664) - { fstreambase::open(name, mode, prot); } -}; - -class fstream : public fstreambase, public iostream { - public: - fstream() : fstreambase() { } - fstream(int fd) : fstreambase(fd) { } - fstream(const char *name, int mode, int prot=0664) - : fstreambase(name, mode, prot) { } - fstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/ - void open(const char *name, int mode, int prot=0664) - { fstreambase::open(name, mode, prot); } -}; -} // extern "C++" -#endif /*!_FSTREAM_H*/ +Copyright (C) 1993, 2000 Free Software Foundation + : fstreambase(name, mode | ios::in, prot) { } + { fstreambase::open(name, mode | ios::in, prot); } + : fstreambase(name, mode | ios::out, prot) { } + { fstreambase::open(name, mode | ios::out, prot); }