home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / INCLUDE.ZIP / STRSTREA.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  3.4 KB  |  123 lines

  1. /*  strstream.h -- class strstream declarations
  2.  
  3.     Copyright (c) 1990, 1992 by Borland International
  4.     All rights reserved
  5. */
  6.  
  7. #ifndef __cplusplus
  8. #error Must use C++ for the type strstream.
  9. #endif
  10.  
  11. #ifndef __STRSTREAM_H
  12. #define __STRSTREAM_H
  13.  
  14. #if !defined(___DEFS_H)
  15. #include <_defs.h>
  16. #endif
  17.  
  18. #if !defined(__IOSTREAM_H)
  19. #include <iostream.h>
  20. #endif
  21.  
  22. #pragma option -Vo-
  23. #if defined(__BCOPT__) && !defined(_RTL_ALLOW_po)
  24. #pragma option -po-
  25. #endif
  26.  
  27. _CLASSDEF(strstreambuf)
  28. _CLASSDEF(strstreambase)
  29. _CLASSDEF(istrstream)
  30. _CLASSDEF(ostrstream)
  31. _CLASSDEF(strstream)
  32.  
  33. class _CLASSTYPE strstreambuf : public streambuf {
  34. public:
  35.     _Cdecl strstreambuf();
  36.     _Cdecl strstreambuf(int n);
  37.     _Cdecl strstreambuf(void _FAR * (*a)(long), void (*f)(void _FAR *));
  38.     _Cdecl strstreambuf( signed char _FAR * _s, int,
  39.                          signed char _FAR * _strt=0);
  40.     _Cdecl strstreambuf( unsigned char _FAR * _s, int,
  41.                          unsigned char _FAR * _strt=0);
  42.     _Cdecl ~strstreambuf();
  43.  
  44.     void    _Cdecl freeze(int = 1);
  45.     char _FAR * _Cdecl str();
  46. virtual int _Cdecl doallocate();
  47. virtual int _Cdecl overflow(int);
  48. virtual int _Cdecl underflow();
  49. virtual int _Cdecl sync();
  50. virtual streambuf _FAR * _Cdecl setbuf(char _FAR *, int);
  51. virtual streampos  _Cdecl seekoff(streamoff, ios::seek_dir, int);
  52.  
  53. private:
  54.     void _FAR * _Cdecl (*allocf)(long);
  55.     void    _Cdecl (*freef)(void _FAR *);
  56.     short   ssbflags;
  57.     enum    { dynamic = 1, frozen = 2, unlimited = 4 };
  58.     int next_alloc;
  59.  
  60.     void    _Cdecl init(signed char _FAR *, int, signed char _FAR *);
  61. };
  62.  
  63.  
  64. class _CLASSTYPE strstreambase : public virtual ios {
  65. public:
  66.     strstreambuf _FAR * _Cdecl rdbuf();
  67.  
  68. protected:
  69.         _Cdecl strstreambase(signed char _FAR *, int, signed char _FAR *);
  70.         _Cdecl strstreambase();
  71.         _Cdecl ~strstreambase();
  72. private:
  73.         strstreambuf buf;
  74. };
  75. inline strstreambuf _FAR * _Cdecl strstreambase::rdbuf()
  76.                                     { return &this->buf; }
  77.  
  78.  
  79. class _CLASSTYPE istrstream : public strstreambase, public istream {
  80. public:
  81.         _Cdecl istrstream(signed char _FAR *);
  82.         _Cdecl istrstream(unsigned char _FAR *);
  83.         _Cdecl istrstream(signed char _FAR *, int);
  84.         _Cdecl istrstream(unsigned char _FAR *, int);
  85.         _Cdecl ~istrstream();
  86. };
  87.  
  88.  
  89. class _CLASSTYPE ostrstream : public strstreambase, public ostream {
  90. public:
  91.         _Cdecl ostrstream(signed char _FAR *, int, int = ios::out);
  92.         _Cdecl ostrstream(unsigned char _FAR *, int, int = ios::out);
  93.         _Cdecl ostrstream();
  94.         _Cdecl ~ostrstream();
  95.  
  96.     char _FAR * _Cdecl str();
  97.     int     _Cdecl pcount();
  98. };
  99. inline char _FAR * _Cdecl ostrstream::str()
  100.                 { return strstreambase::rdbuf()->str(); }
  101. inline int  _Cdecl ostrstream::pcount()
  102.                 { return strstreambase::rdbuf()->out_waiting(); }
  103.  
  104.  
  105. class _CLASSTYPE strstream : public strstreambase, public iostream {
  106. public:
  107.         _Cdecl strstream();
  108.         _Cdecl strstream(signed char _FAR *, int _sz, int _m);
  109.         _Cdecl strstream(unsigned char _FAR *, int _sz, int _m);
  110.         _Cdecl ~strstream();
  111.  
  112.     char _FAR * _Cdecl str();
  113. };
  114. inline char _FAR * _Cdecl strstream::str()
  115.                 { return strstreambase::rdbuf()->str(); }
  116.  
  117. #pragma option -Vo.
  118. #if defined(__BCOPT__)
  119. #pragma option -po.
  120. #endif
  121.  
  122. #endif
  123.