Annotation of GNUtools/libg++/libio/fstream.h, revision 1.1.1.1

1.1       root        1: /* This is part of libio/iostream, providing -*- C++ -*- input/output.
                      2: Copyright (C) 1993 Free Software Foundation
                      3: 
                      4: This file is part of the GNU IO Library.  This library is free
                      5: software; you can redistribute it and/or modify it under the
                      6: terms of the GNU General Public License as published by the
                      7: Free Software Foundation; either version 2, or (at your option)
                      8: any later version.
                      9: 
                     10: This library is distributed in the hope that it will be useful,
                     11: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     13: GNU General Public License for more details.
                     14: 
                     15: You should have received a copy of the GNU General Public License
                     16: along with GNU CC; see the file COPYING.  If not, write to
                     17: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
                     18: 
                     19: As a special exception, if you link this library with files
                     20: compiled with a GNU compiler to produce an executable, this does not cause
                     21: the resulting executable to be covered by the GNU General Public License.
                     22: This exception does not however invalidate any other reasons why
                     23: the executable file might be covered by the GNU General Public License. */
                     24: 
                     25: #ifndef _FSTREAM_H
                     26: #define _FSTREAM_H
                     27: #ifdef __GNUG__
                     28: #pragma interface
                     29: #pragma cplusplus
                     30: #endif
                     31: #include <iostream.h>
                     32: 
                     33: class fstreambase : virtual public ios {
                     34:   public:
                     35:     fstreambase();
                     36:     fstreambase(int fd);
                     37:     fstreambase(int fd, char *p, int l); /* Deprecated */
                     38:     fstreambase(const char *name, int mode, int prot=0664);
                     39:     void close();
                     40:     filebuf* rdbuf() const { return (filebuf*) ios::rdbuf(); }
                     41:     void open(const char *name, int mode, int prot=0664);
                     42:     int is_open() const { return rdbuf()->is_open(); }
                     43:     void setbuf(char *ptr, int len) { rdbuf()->setbuf(ptr, len); }
                     44: #ifdef _STREAM_COMPAT
                     45:     int filedesc() { return rdbuf()->fd(); }
                     46:     fstreambase& raw() { rdbuf()->setbuf(NULL, 0); return *this; }
                     47: #endif
                     48: };
                     49: 
                     50: class ifstream : public fstreambase, public istream {
                     51:   public:
                     52:     ifstream() : fstreambase() { }
                     53:     ifstream(int fd) : fstreambase(fd) { }
                     54:     ifstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/
                     55:     ifstream(const char *name, int mode=ios::in, int prot=0664)
                     56:        : fstreambase(name, mode, prot) { }
                     57:     void open(const char *name, int mode=ios::in, int prot=0664)
                     58:        { fstreambase::open(name, mode, prot); }
                     59: };
                     60: 
                     61: class ofstream : public fstreambase, public ostream {
                     62:   public:
                     63:     ofstream() : fstreambase() { }
                     64:     ofstream(int fd) : fstreambase(fd) { }
                     65:     ofstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/
                     66:     ofstream(const char *name, int mode=ios::out, int prot=0664)
                     67:        : fstreambase(name, mode, prot) { }
                     68:     void open(const char *name, int mode=ios::out, int prot=0664)
                     69:        { fstreambase::open(name, mode, prot); }
                     70: };
                     71: 
                     72: class fstream : public fstreambase, public iostream {
                     73:   public:
                     74:     fstream() : fstreambase() { }
                     75:     fstream(int fd) : fstreambase(fd) { }
                     76:     fstream(const char *name, int mode, int prot=0664)
                     77:        : fstreambase(name, mode, prot) { }
                     78:     fstream(int fd, char *p, int l) : fstreambase(fd, p, l) { } /*Deprecated*/
                     79:     void open(const char *name, int mode, int prot=0664)
                     80:        { fstreambase::open(name, mode, prot); }
                     81: };
                     82: #endif /*!_FSTREAM_H*/

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.