Annotation of mstools/h/ostream.h, revision 1.1.1.2

1.1       root        1: /***
                      2: *ostream.h - definitions/declarations for the ostream class
                      3: *
1.1.1.2 ! root        4: *      Copyright (c) 1991-1993, Microsoft Corporation.  All rights reserved.
1.1       root        5: *
                      6: *Purpose:
                      7: *      This file defines the classes, values, macros, and functions
                      8: *      used by the ostream class.
                      9: *      [AT&T C++]
                     10: *
                     11: ****/
                     12: 
                     13: #ifndef _INC_OSTREAM
                     14: #define _INC_OSTREAM
                     15: 
                     16: #include <ios.h>
                     17: 
1.1.1.2 ! root       18: // C4505: "unreferenced local function has been removed"
        !            19: #pragma warning(disable:4505) // disable C4505 warning
        !            20: // #pragma warning(default:4505)       // use this to reenable, if desired
        !            21: 
        !            22: // C4103 : "used #pragma pack to change alignment"
        !            23: #pragma warning(disable:4103)  // disable C4103 warning
        !            24: // #pragma warning(default:4103)       // use this to reenable, if desired
        !            25: 
1.1       root       26: // Force word packing to avoid possible -Zp override
                     27: #pragma pack(4)
                     28: 
                     29: typedef long streamoff, streampos;
                     30: 
                     31: class ostream : virtual public ios {
                     32: 
                     33: public:
                     34:        ostream(streambuf*);
                     35:        virtual ~ostream();
                     36: 
                     37:        ostream& flush();
                     38:        int  opfx();
                     39:        void osfx();
                     40: 
                     41: inline ostream& operator<<(ostream& (*f)(ostream&));
                     42: inline ostream& operator<<(ios& (*f)(ios&));
                     43:        ostream& operator<<(const char *);
                     44: inline ostream& operator<<(const unsigned char *);
                     45: inline ostream& operator<<(const signed char *);
                     46: inline ostream& operator<<(char);
                     47:        ostream& operator<<(unsigned char);
                     48: inline ostream& operator<<(signed char);
                     49:        ostream& operator<<(short);
                     50:        ostream& operator<<(unsigned short);
                     51:        ostream& operator<<(int);
                     52:        ostream& operator<<(unsigned int);
                     53:        ostream& operator<<(long);
                     54:        ostream& operator<<(unsigned long);
                     55: inline ostream& operator<<(float);
                     56:        ostream& operator<<(double);
1.1.1.2 ! root       57:        ostream& operator<<(long double);
1.1       root       58:        ostream& operator<<(const void *);
                     59:        ostream& operator<<(streambuf*);
                     60: inline ostream& put(char);
                     61:        ostream& put(unsigned char);
                     62: inline ostream& put(signed char);
                     63:        ostream& write(const char *,int);
                     64: inline ostream& write(const unsigned char *,int);
                     65: inline ostream& write(const signed char *,int);
                     66:        ostream& seekp(streampos);
                     67:        ostream& seekp(streamoff,ios::seek_dir);
                     68:        streampos tellp();
                     69: 
                     70: protected:
                     71:        ostream();
                     72:        ostream(const ostream&);        // treat as private
                     73:        ostream& operator=(streambuf*); // treat as private
                     74:        ostream& operator=(const ostream& _os) {return operator=(_os.rdbuf()); }
                     75:        int do_opfx(int);               // not used
                     76:        void do_osfx();                 // not used
                     77: 
                     78: private:
                     79:        ostream(ios&);
                     80:        ostream& writepad(const char *, const char *);
                     81:        int x_floatused;
                     82: };
                     83: 
                     84: inline ostream& ostream::operator<<(ostream& (*f)(ostream&)) { (*f)(*this); return *this; }
                     85: inline ostream& ostream::operator<<(ios& (*f)(ios& )) { (*f)(*this); return *this; }
                     86: 
                     87: inline ostream& ostream::operator<<(char c) { return operator<<((unsigned char) c); }
                     88: inline ostream& ostream::operator<<(signed char c) { return operator<<((unsigned char) c); }
                     89: 
                     90: inline ostream& ostream::operator<<(const unsigned char * s) { return operator<<((const char *) s); }
                     91: inline ostream& ostream::operator<<(const signed char * s) { return operator<<((const char *) s); }
                     92: 
                     93: inline ostream& ostream::operator<<(float f) { x_floatused = 1; return operator<<((double) f); }
                     94: 
                     95: inline ostream& ostream::put(char c) { return put((unsigned char) c); }
                     96: inline ostream& ostream::put(signed char c) { return put((unsigned char) c); }
                     97: 
                     98: inline ostream& ostream::write(const unsigned char * s, int n) { return write((char *) s, n); }
                     99: inline ostream& ostream::write(const signed char * s, int n) { return write((char *) s, n); }
                    100: 
                    101: 
                    102: class ostream_withassign : public ostream {
                    103:        public:
                    104:                ostream_withassign();
                    105:                ostream_withassign(streambuf* _is);
                    106:                ~ostream_withassign();
                    107:     ostream& operator=(const ostream& _os) { return ostream::operator=(_os.rdbuf()); }
                    108:     ostream& operator=(streambuf* _sb) { return ostream::operator=(_sb); }
                    109: };
                    110: 
                    111: #ifndef _WINDLL           // Warning!  Not available under Windows without QuickWin:
                    112: extern ostream_withassign cout;
                    113: extern ostream_withassign cerr;
                    114: extern ostream_withassign clog;
                    115: #endif
                    116: 
                    117: inline ostream& flush(ostream& _outs) { return _outs.flush(); }
                    118: inline ostream& endl(ostream& _outs) { return _outs << '\n' << flush; }
                    119: inline ostream& ends(ostream& _outs) { return _outs << char('\0'); }
                    120: 
                    121: ios&           dec(ios&);
                    122: ios&           hex(ios&);
                    123: ios&           oct(ios&);
                    124: 
                    125: // Restore default packing
                    126: #pragma pack()
                    127: 
                    128: #endif         // !_INC_OSTREAM

unix.superglobalmegacorp.com

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