Annotation of researchv10no/cmd/cfront/libC/ooiostream/fstream.h, revision 1.1

1.1     ! root        1: /*ident        "@(#)ctrans:incl/fstream.h      1.1.1.2" */
        !             2: /**************************************************************************
        !             3:                         Copyright (c) 1984 AT&T
        !             4:                           All Rights Reserved   
        !             5: 
        !             6:         THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
        !             7:       
        !             8:         The copyright notice above does not evidence any        
        !             9:         actual or intended publication of such source code.
        !            10: 
        !            11: *****************************************************************************/
        !            12: #ifndef FSTREAMH
        !            13: #define FSTREAMH
        !            14: 
        !            15: #include <iostream.h>
        !            16: 
        !            17: class  filebuf : public streambuf {    /* a stream buffer for files */
        !            18: public:
        !            19:                        filebuf() ;
        !            20:                        filebuf(int fd);
        !            21:                        filebuf(int fd, char*  p, int l) ;
        !            22: 
        !            23:        int             is_open() { return opened ; }
        !            24:        int             fd() { return xfd ; }
        !            25:        filebuf*        open(const char *name, open_mode om, int prot=0664);
        !            26:        filebuf*        attach(int fd) ;
        !            27:        filebuf*        close() ;
        !            28:                        ~filebuf() ;
        !            29: public: /* virtuals */
        !            30:        virtual int     overflow(int=EOF);
        !            31:        virtual int     underflow();
        !            32:        virtual int     sync() ;
        !            33:        virtual streampos
        !            34:                        seekoff(streamoff,seek_dir,open_mode) ;
        !            35:        virtual streambuf*
        !            36:                        setbuf(char*  p, int len) ;
        !            37: protected:
        !            38:        int             xfd;    
        !            39:        open_mode       mode ;
        !            40:        char            opened;
        !            41:        streampos       last_seek ;
        !            42:        char*           in_start;
        !            43:        int             last_op();
        !            44:        char            lahead[2] ;
        !            45: };
        !            46: 
        !            47: class fstreambase : virtual public ios { 
        !            48: public:
        !            49:                        fstreambase() ;
        !            50:        
        !            51:                        fstreambase(const char* name, 
        !            52:                                        open_mode mode,int prot=0664) ;
        !            53:                        fstreambase(int fd) ;
        !            54:                        fstreambase(int fd, char*  p, int l) ;
        !            55:                        ~fstreambase() ;
        !            56:        void            open(const char* name, open_mode mode, int prot=0664) ;
        !            57:        void            attach(int fd);
        !            58:        void            close() ;
        !            59:        void            setbuf(char*  p, int l) ;
        !            60:        filebuf*        rdbuf() { return &buf ; }
        !            61: private:
        !            62:        filebuf         buf ;
        !            63: protected:
        !            64:        void            verify(int) ;
        !            65: } ;
        !            66: 
        !            67: class ifstream : public fstreambase, public istream {
        !            68: public:
        !            69:                        ifstream() ;
        !            70:                        ifstream(const char* name, 
        !            71:                                        open_mode mode,int prot=0664) ;
        !            72:                        ifstream(int fd) ;
        !            73:                        ifstream(int fd, char*  p, int l) ;
        !            74:                        ~ifstream() ;
        !            75: 
        !            76:        filebuf*        rdbuf() { return fstreambase::rdbuf(); }
        !            77:        void            open(const char* name, open_mode mode, int prot=0664) ;
        !            78: } ;
        !            79: 
        !            80: class ofstream : public fstreambase, public ostream {
        !            81: public:
        !            82:                        ofstream() ;
        !            83:                        ofstream(const char* name, 
        !            84:                                        open_mode mode,int prot=0664) ;
        !            85:                        ofstream(int fd) ;
        !            86:                        ofstream(int fd, char*  p, int l) ;
        !            87:                        ~ofstream() ;
        !            88: 
        !            89:        filebuf*        rdbuf() { return fstreambase::rdbuf(); }
        !            90:        void            open(const char* name, open_mode mode, int prot=0664) ;
        !            91: } ;
        !            92: 
        !            93: class fstream : public fstreambase, public iostream {
        !            94: public:
        !            95:                        fstream() ;
        !            96:        
        !            97:                        fstream(const char* name, 
        !            98:                                        open_mode mode,int prot=0664) ;
        !            99:                        fstream(int fd) ;
        !           100:                        fstream(int fd, char*  p, int l) ;
        !           101:                        ~fstream() ;
        !           102:        filebuf*        rdbuf() { return fstreambase::rdbuf(); }
        !           103:        void            open(const char* name, open_mode mode, int prot=0664) ;
        !           104: } ;
        !           105: 
        !           106: #endif

unix.superglobalmegacorp.com

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