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

1.1       root        1: /***
                      2: *istream.h - definitions/declarations for the istream class
                      3: *
1.1.1.2 ! root        4: *      Copyright (c) 1990-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 istream class.
                      9: *      [AT&T C++]
                     10: *
                     11: ****/
                     12: 
                     13: #ifndef _INC_ISTREAM
                     14: #define _INC_ISTREAM
                     15: 
                     16: #include <ios.h>
                     17: 
1.1.1.2 ! root       18: // C4069: "long double != double"
        !            19: #pragma warning(disable:4069)  // disable C4069 warning
        !            20: // #pragma warning(default:4069)       // use this to reenable, if desired
        !            21: 
        !            22: // C4505: "unreferenced local function has been removed"
        !            23: #pragma warning(disable:4505) // disable C4505 warning
        !            24: // #pragma warning(default:4505)       // use this to reenable, if desired
        !            25: 
        !            26: // C4103 : "used #pragma pack to change alignment"
        !            27: #pragma warning(disable:4103)  // disable C4103 warning
        !            28: // #pragma warning(default:4103)       // use this to reenable, if desired
        !            29: 
1.1       root       30: // Force word packing to avoid possible -Zp override
                     31: #pragma pack(4)
                     32: 
                     33: 
                     34: typedef long streamoff, streampos;
                     35: 
                     36: class istream : virtual public ios {
                     37: 
                     38: public:
                     39:     istream(streambuf*);
                     40:     virtual ~istream();
                     41: 
                     42:     int  ipfx(int =0);
                     43:     void isfx() { unlockbuf(); unlock(); }
                     44: 
                     45:     inline istream& operator>>(istream& (*_f)(istream&));
                     46:     inline istream& operator>>(ios& (*_f)(ios&));
                     47:     istream& operator>>(char *);
                     48:     inline istream& operator>>(unsigned char *);
                     49:     inline istream& operator>>(signed char *);
                     50:     istream& operator>>(char &);
                     51:     inline istream& operator>>(unsigned char &);
                     52:     inline istream& operator>>(signed char &);
                     53:     istream& operator>>(short &);
                     54:     istream& operator>>(unsigned short &);
                     55:     istream& operator>>(int &);
                     56:     istream& operator>>(unsigned int &);
                     57:     istream& operator>>(long &);
                     58:     istream& operator>>(unsigned long &);
                     59:     istream& operator>>(float &);
                     60:     istream& operator>>(double &);
1.1.1.2 ! root       61:     istream& operator>>(long double &);
1.1       root       62:     istream& operator>>(streambuf*);
                     63: 
                     64:     int get();
                     65:     istream& get(char *,int,char ='\n');
                     66:     inline istream& get(unsigned char *,int,char ='\n');
                     67:     inline istream& get(signed char *,int,char ='\n');
                     68:     istream& get(char &);
                     69:     inline istream& get(unsigned char &);
                     70:     inline istream& get(signed char &);
                     71:     istream& get(streambuf&,char ='\n');
                     72:     inline istream& getline(char *,int,char ='\n');
                     73:     inline istream& getline(unsigned char *,int,char ='\n');
                     74:     inline istream& getline(signed char *,int,char ='\n');
                     75: 
                     76:     inline istream& ignore(int =1,int =EOF);
                     77:     istream& read(char *,int);
                     78:     inline istream& read(unsigned char *,int);
                     79:     inline istream& read(signed char *,int);
                     80: 
                     81:     int gcount() const { return x_gcount; }
                     82:     int peek();
                     83:     istream& putback(char);
                     84:     int sync();
                     85: 
                     86:     istream& seekg(streampos);
                     87:     istream& seekg(streamoff,ios::seek_dir);
                     88:     streampos tellg();
                     89: 
                     90:     void eatwhite();   // consider: protect and friend with manipulator ws
                     91: protected:
                     92:     istream();
                     93:     istream(const istream&);   // treat as private
                     94:     istream& operator=(streambuf* _isb); // treat as private
                     95:     istream& operator=(const istream& _is) { return operator=(_is.rdbuf()); }
                     96:     int do_ipfx(int);
                     97: 
                     98: private:
                     99:     istream(ios&);
                    100:     int getint(char *);
                    101:     int getdouble(char *, int);
                    102:     int _fGline;
                    103:     int x_gcount;
                    104: };
                    105: 
                    106:     inline istream& istream::operator>>(istream& (*_f)(istream&)) { (*_f)(*this); return *this; }
                    107:     inline istream& istream::operator>>(ios& (*_f)(ios&)) { (*_f)(*this); return *this; }
                    108: 
                    109:     inline istream& istream::operator>>(unsigned char * _s) { return operator>>((char *)_s); }
                    110:     inline istream& istream::operator>>(signed char * _s) { return operator>>((char *)_s); }
                    111: 
                    112:     inline istream& istream::operator>>(unsigned char & _c) { return operator>>((char &) _c); }
                    113:     inline istream& istream::operator>>(signed char & _c) { return operator>>((char &) _c); }
                    114: 
                    115:     inline istream& istream::get(unsigned char * b, int lim ,char delim) { return get((char *)b, lim, delim); }
                    116:     inline istream& istream::get(signed char * b, int lim, char delim) { return get((char *)b, lim, delim); }
                    117: 
                    118:     inline istream& istream::get(unsigned char & _c) { return get((char &)_c); }
                    119:     inline istream& istream::get(signed char & _c) { return get((char &)_c); }
                    120: 
                    121:     inline istream& istream::getline(char * _b,int _lim,char _delim) { lock(); _fGline++; get(_b, _lim, _delim); unlock(); return *this; }
                    122:     inline istream& istream::getline(unsigned char * _b,int _lim,char _delim) { lock(); _fGline++; get((char *)_b, _lim, _delim); unlock(); return *this; }
                    123:     inline istream& istream::getline(signed char * _b,int _lim,char _delim) { lock(); _fGline++; get((char *)_b, _lim, _delim); unlock(); return *this; }
                    124: 
                    125:     inline istream& istream::ignore(int _n,int delim) { lock(); _fGline++; return get((char *)0, _n+1, (char)delim); unlock(); return *this; }
                    126: 
                    127:     inline istream& istream::read(unsigned char * _ptr, int _n) { return read((char *) _ptr, _n); }
                    128:     inline istream& istream::read(signed char * _ptr, int _n) { return read((char *) _ptr, _n); }
                    129: 
                    130: class istream_withassign : public istream {
                    131:        public:
                    132:                istream_withassign();
                    133:                istream_withassign(streambuf*);
                    134:                ~istream_withassign();
                    135:     istream& operator=(const istream& _is) { return istream::operator=(_is); }
                    136:     istream& operator=(streambuf* _isb) { return istream::operator=(_isb); }
                    137: };
                    138: 
                    139: #ifndef _WINDLL           // Warning!  Not available under Windows without QuickWin:
                    140: extern istream_withassign cin;
                    141: #endif
                    142: 
                    143: inline istream& ws(istream& _ins) { _ins.eatwhite(); return _ins; }
                    144: 
                    145: ios&           dec(ios&);
                    146: ios&           hex(ios&);
                    147: ios&           oct(ios&);
                    148: 
                    149: // Restore default packing
                    150: #pragma pack()
                    151: 
                    152: #endif                 // !_INC_ISTREAM

unix.superglobalmegacorp.com

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