home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / STRSTREA.H < prev    next >
C/C++ Source or Header  |  1997-02-14  |  5KB  |  175 lines

  1. /*  strstream.h -- class strstream declarations
  2.  
  3. */
  4.  
  5. /*
  6.  *      C/C++ Run Time Library - Version 8.0
  7.  *
  8.  *      Copyright (c) 1990, 1997 by Borland International
  9.  *      All Rights Reserved.
  10.  *
  11.  */
  12. /* $Revision:   8.1  $ */
  13.  
  14. #ifndef __cplusplus
  15. #error Must use C++ for the type strstream.
  16. #endif
  17.  
  18. #ifndef __STRSTREAM_H
  19. #define __STRSTREAM_H
  20.  
  21. #if !defined(___DEFS_H)
  22. #include <_defs.h>
  23. #endif
  24.  
  25. #if !defined(__IOSTREAM_H)
  26. #include <iostream.h>
  27. #endif
  28.  
  29.  
  30. #if !defined(RC_INVOKED)
  31.  
  32. #pragma pack(push, 1)
  33.  
  34. #if defined(__BCOPT__)
  35. #if !defined(_RTL_ALLOW_po) && !defined(__FLAT__)
  36. #pragma option -po-     // disable Object data calling convention
  37. #endif
  38. #endif
  39.  
  40. #if !defined(__TINY__)
  41. #pragma option -RT
  42. #endif
  43.  
  44. #pragma option -Vo-
  45.  
  46. #if defined(__STDC__)
  47. #pragma warn -nak
  48. #endif
  49.  
  50. #endif  /* !RC_INVOKED */
  51.  
  52.  
  53. _CLASSDEF(strstreambuf)
  54. _CLASSDEF(strstreambase)
  55. _CLASSDEF(istrstream)
  56. _CLASSDEF(ostrstream)
  57. _CLASSDEF(strstream)
  58.  
  59. class _EXPCLASS strstreambuf : public streambuf {
  60. public:
  61.     _RTLENTRY strstreambuf();
  62.     _RTLENTRY strstreambuf(int n);
  63.     _RTLENTRY strstreambuf(void _FAR * (*a)(long), void (*f)(void _FAR *));
  64.     _RTLENTRY strstreambuf(         char _FAR * _s, int,
  65.                                     char _FAR * _strt=0);
  66.     _RTLENTRY strstreambuf(signed   char _FAR * _s, int,
  67.                            signed   char _FAR * _strt=0);
  68.     _RTLENTRY strstreambuf(unsigned char _FAR * _s, int,
  69.                            unsigned char _FAR * _strt=0);
  70.     _RTLENTRY ~strstreambuf();
  71.  
  72.     void    _RTLENTRY freeze(int = 1);
  73.     char _FAR *  _RTLENTRY str();
  74. virtual int _RTLENTRY doallocate();
  75. virtual int _RTLENTRY overflow(int);
  76. virtual int _RTLENTRY underflow();
  77. virtual int _RTLENTRY sync();
  78. virtual streambuf _FAR * _RTLENTRY setbuf(char _FAR *, int);
  79. virtual streampos   _RTLENTRY seekoff(streamoff, ios::seek_dir, int);
  80.  
  81. private:
  82.     void _FAR *  _RTLENTRY (*allocf)(long);
  83.     void    _RTLENTRY (*freef)(void _FAR *);
  84.     short   ssbflags;
  85.     enum    { dynamic = 1, frozen = 2, unlimited = 4 };
  86.     int next_alloc;
  87.  
  88.     void    _RTLENTRY init(char _FAR *, int, char _FAR *);
  89. };
  90.  
  91.  
  92. class _EXPCLASS strstreambase : public virtual ios {
  93. public:
  94.     strstreambuf _FAR * _RTLENTRY rdbuf();
  95.  
  96. protected:
  97.         _RTLENTRY strstreambase(char _FAR *, int, char _FAR *);
  98.         _RTLENTRY strstreambase();
  99.         _RTLENTRY ~strstreambase();
  100. private:
  101.         strstreambuf buf;
  102. };
  103. inline strstreambuf _FAR * _RTLENTRY strstreambase::rdbuf()
  104.                                     { return &this->buf; }
  105.  
  106.  
  107. class _EXPCLASS istrstream : public strstreambase, public istream {
  108. public:
  109.         _RTLENTRY istrstream(         char _FAR *);
  110.         _RTLENTRY istrstream(signed   char _FAR *);
  111.         _RTLENTRY istrstream(unsigned char _FAR *);
  112.         _RTLENTRY istrstream(         char _FAR *, int);
  113.         _RTLENTRY istrstream(signed   char _FAR *, int);
  114.         _RTLENTRY istrstream(unsigned char _FAR *, int);
  115.         _RTLENTRY ~istrstream();
  116. };
  117.  
  118.  
  119. class _EXPCLASS ostrstream : public strstreambase, public ostream {
  120. public:
  121.         _RTLENTRY ostrstream(         char _FAR *, int, int = ios::out);
  122.         _RTLENTRY ostrstream(signed   char _FAR *, int, int = ios::out);
  123.         _RTLENTRY ostrstream(unsigned char _FAR *, int, int = ios::out);
  124.         _RTLENTRY ostrstream();
  125.         _RTLENTRY ~ostrstream();
  126.  
  127.     char _FAR * _RTLENTRY str();
  128.     int     _RTLENTRY pcount();
  129. };
  130. inline char _FAR * _RTLENTRY ostrstream::str()
  131.                 { return strstreambase::rdbuf()->str(); }
  132. inline int  _RTLENTRY ostrstream::pcount()
  133.                 { return strstreambase::rdbuf()->out_waiting(); }
  134.  
  135.  
  136. class _EXPCLASS strstream : public strstreambase, public iostream {
  137. public:
  138.         _RTLENTRY strstream();
  139.         _RTLENTRY strstream(         char _FAR *, int _sz, int _m);
  140.         _RTLENTRY strstream(signed   char _FAR *, int _sz, int _m);
  141.         _RTLENTRY strstream(unsigned char _FAR *, int _sz, int _m);
  142.         _RTLENTRY ~strstream();
  143.  
  144.     char _FAR * _RTLENTRY str();
  145. };
  146. inline char _FAR * _RTLENTRY strstream::str()
  147.                 { return strstreambase::rdbuf()->str(); }
  148.  
  149.  
  150. #if !defined(RC_INVOKED)
  151.  
  152. #if defined(__STDC__)
  153. #pragma warn .nak
  154. #endif
  155.  
  156. #pragma option -Vo.
  157.  
  158. #if !defined(__TINY__)
  159. #pragma option -RT.
  160. #endif
  161.  
  162. #if defined(__BCOPT__)
  163. #if !defined(_RTL_ALLOW_po) && !defined(__FLAT__)
  164. #pragma option -po.     // restore Object data calling convention
  165. #endif
  166. #endif
  167.  
  168. /* restore default packing */
  169. #pragma pack(pop)
  170.  
  171. #endif  /* !RC_INVOKED */
  172.  
  173.  
  174. #endif  /* __STRSTREAM_H */
  175.