|
|
1.1 root 1: /***
2: *strstream.h - definitions/declarations for strstreambuf, strstream
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 strstream and strstreambuf classes.
9: * [AT&T C++]
10: *
11: ****/
12:
13: #ifndef _INC_STRSTREAM
14: #define _INC_STRSTREAM
15:
16: #include <iostream.h>
17:
18: // Force word packing to avoid possible -Zp override
19: #pragma pack(4)
20:
21: #pragma warning(disable:4505) // disable unwanted /W4 warning
22: // #pragma warning(default:4505) // use this to reenable, if necessary
23:
24: class strstreambuf : public streambuf {
25: public:
26: strstreambuf();
27: strstreambuf(int);
28: strstreambuf(char *, int, char * = 0);
29: strstreambuf(unsigned char *, int, unsigned char * = 0);
30: strstreambuf(signed char *, int, signed char * = 0);
31: strstreambuf(void * (*a)(long), void (*f) (void *));
32: ~strstreambuf();
33:
34: void freeze(int =1);
35: char * str();
36:
37: virtual int overflow(int);
38: virtual int underflow();
39: virtual streambuf* setbuf(char *, int);
40: virtual streampos seekoff(streamoff, ios::seek_dir, int);
41: virtual int sync(); // not in spec.
42:
43: protected:
44: virtual int doallocate();
45: private:
46: int x_dynamic;
47: int x_bufmin;
48: int _fAlloc;
49: int x_static;
50: void * (* x_alloc)(long);
51: void (* x_free)(void *);
52: };
53:
54: class istrstream : public istream {
55: public:
56: istrstream(char *);
57: istrstream(char *, int);
58: ~istrstream();
59:
60: inline strstreambuf* rdbuf() const { return (strstreambuf*) ios::rdbuf(); }
61: inline char * str() { return rdbuf()->str(); }
62: };
63:
64: class ostrstream : public ostream {
65: public:
66: ostrstream();
67: ostrstream(char *, int, int = ios::out);
68: ~ostrstream();
69:
70: inline int pcount() const { return rdbuf()->out_waiting(); }
71: inline strstreambuf* rdbuf() const { return (strstreambuf*) ios::rdbuf(); }
72: inline char * str() { return rdbuf()->str(); }
73: };
74:
75: class strstream : public iostream { // strstreambase ???
76: public:
77: strstream();
78: strstream(char *, int, int);
79: ~strstream();
80:
81: inline int pcount() const { return rdbuf()->out_waiting(); } // not in spec.
82: inline strstreambuf* rdbuf() const { return (strstreambuf*) ostream::rdbuf(); }
83: inline char * str() { return rdbuf()->str(); }
84: };
85:
86: // Restore default packing
87: #pragma pack()
88:
89: #endif // !_INC_STRSTREAM
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.