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

  1. /*  strstream.h -- class strstream declarations
  2.  
  3.     Copyright (c) 1990, 1991 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.  
  24. _CLASSDEF(strstreambuf)
  25. _CLASSDEF(strstreambase)
  26. _CLASSDEF(istrstream)
  27. _CLASSDEF(ostrstream)
  28. _CLASSDEF(strstream)
  29.  
  30. class _CLASSTYPE strstreambuf : public streambuf {
  31. public:
  32.     _Cdecl strstreambuf();
  33.     _Cdecl strstreambuf(int n);
  34.     _Cdecl strstreambuf(void * (*a)(long), void (*f)(void *));
  35.     _Cdecl strstreambuf( signed char * _s, int,
  36.                          signed char * _strt=0);
  37.     _Cdecl strstreambuf( unsigned char * _s, int,
  38.                          unsigned char * _strt=0);
  39.     _Cdecl ~strstreambuf();
  40.  
  41.     void    _Cdecl freeze(int = 1);
  42.     char * _Cdecl str();
  43. virtual int _Cdecl doallocate();
  44. virtual int _Cdecl overflow(int);
  45. virtual int _Cdecl underflow();
  46. virtual int _Cdecl sync();
  47. virtual streambuf * _Cdecl setbuf(char *, int);
  48. virtual streampos  _Cdecl seekoff(streamoff, ios::seek_dir, int);
  49.  
  50. private:
  51.     void * _Cdecl (*allocf)(long);
  52.     void    _Cdecl (*freef)(void *);
  53.     short   ssbflags;
  54.     enum    { dynamic = 1, frozen = 2, unlimited = 4 };
  55.     int next_alloc;
  56.  
  57.     void    _Cdecl init(signed char *, int, signed char *);
  58. };
  59.  
  60.  
  61. class _CLASSTYPE strstreambase : public virtual ios {
  62. public:
  63.     strstreambuf * _Cdecl rdbuf();
  64.  
  65. protected:
  66.         _Cdecl strstreambase(char *, int, char *);
  67.         _Cdecl strstreambase();
  68.         _Cdecl ~strstreambase();
  69. private:
  70.         strstreambuf buf;
  71. };
  72. inline strstreambuf * _Cdecl strstreambase::rdbuf()
  73.                                     { return &this->buf; }
  74.  
  75.  
  76. class _CLASSTYPE istrstream : public strstreambase, public istream {
  77. public:
  78.         _Cdecl istrstream(char *);
  79.         _Cdecl istrstream(char *, int);
  80.         _Cdecl ~istrstream();
  81. };
  82.  
  83.  
  84. class _CLASSTYPE ostrstream : public strstreambase, public ostream {
  85. public:
  86.         _Cdecl ostrstream(char *, int, int = ios::out);
  87.         _Cdecl ostrstream();
  88.         _Cdecl ~ostrstream();
  89.  
  90.     char * _Cdecl str();
  91.     int     _Cdecl pcount();
  92. };
  93. inline char * _Cdecl ostrstream::str()
  94.                 { return strstreambase::rdbuf()->str(); }
  95. inline int  _Cdecl ostrstream::pcount()
  96.                 { return strstreambase::rdbuf()->out_waiting(); }
  97.  
  98.  
  99. class _CLASSTYPE strstream : public strstreambase, public iostream {
  100. public:
  101.         _Cdecl strstream();
  102.         _Cdecl strstream(char *, int _sz, int _m);
  103.         _Cdecl ~strstream();
  104.  
  105.     char * _Cdecl str();
  106. };
  107. inline char * _Cdecl strstream::str()
  108.                 { return strstreambase::rdbuf()->str(); }
  109.  
  110. #pragma option -Vo.
  111.  
  112. #endif
  113.