home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / STRSTREA.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  4.1 KB  |  141 lines

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