home *** CD-ROM | disk | FTP | other *** search
- #ifndef __STD_STRSTREAM__
- #define __STD_STRSTREAM__
- #pragma option push -b -a4 -Vx- -Ve- -w-inl -w-aus -w-sig
-
- /***************************************************************************
- *
- * strstream - Declarations for the Standard Library string stream classes
- *
- * $Id: strstream,v 1.25 1996/08/28 18:43:49 smithey Exp $
- *
- ***************************************************************************
- *
- * (c) Copyright 1994, 1995 Rogue Wave Software, Inc.
- * ALL RIGHTS RESERVED *
- * The software and information contained herein are proprietary to, and
- * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
- * intends to preserve as trade secrets such software and information.
- * This software is furnished pursuant to a written license agreement and
- * may be used, copied, transmitted, and stored only in accordance with
- * the terms of such license and with the inclusion of the above copyright
- * notice. This software and information or any other copies thereof may
- * not be provided or otherwise made available to any other person.
- *
- * Notwithstanding any other lease or license that may pertain to, or
- * accompany the delivery of, this computer software and information, the
- * rights of the Government regarding its use, reproduction and disclosure
- * are as set forth in Section 52.227-19 of the FARS Computer
- * Software-Restricted Rights clause.
- *
- * Use, duplication, or disclosure by the Government is subject to
- * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
- * Technical Data and Computer Software clause at DFARS 252.227-7013.
- * Contractor/Manufacturer is Rogue Wave Software, Inc.,
- * P.O. Box 2328, Corvallis, Oregon 97339.
- *
- * This computer software and information is distributed with "restricted
- * rights." Use, duplication or disclosure is subject to restrictions as
- * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
- * Computer Software-Restricted Rights (April 1985)." If the Clause at
- * 18-52.227-74 "Rights in Data General" is specified in the contract,
- * then the "Alternate III" clause applies.
- *
- **************************************************************************/
-
- #include <streambuf>
- #include <istream>
- #include <ostream>
-
- #ifndef _RWSTD_NO_NAMESPACE
- namespace std {
- #endif
-
-
- #ifndef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES
- class _RWSTDExport strstreambuf : public basic_streambuf<char>
- {
- #else
- class _RWSTDExport strstreambuf : public basic_streambuf<char, char_traits<char> >
- {
- #endif // _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES
-
- public:
- //
- // Types:
- //
- typedef char char_type;
- typedef char_traits<char> traits;
- typedef traits::int_type int_type;
- typedef traits::pos_type pos_type;
- typedef traits::off_type off_type;
-
- _EXPLICIT strstreambuf(streamsize alsize = 0);
- strstreambuf(void *(*palloc)(size_t), void (*pfree)(void *));
- strstreambuf(char *gnext, streamsize n, char *pbeg = 0);
-
- strstreambuf(unsigned char *gnext, streamsize n,
- unsigned char *pbeg = 0);
- strstreambuf(signed char *gnext, streamsize n,
- signed char *pbeg = 0);
-
- strstreambuf(const char *gnext, streamsize n);
- strstreambuf(const unsigned char *gnext, streamsize n);
- strstreambuf(const signed char *gnext, streamsize n);
- virtual ~strstreambuf();
-
- void freeze(bool f = 1);
- char *str();
- int pcount() const;
-
- protected:
- virtual int_type overflow(int_type c = traits::eof());
- virtual int_type pbackfail(int_type c = traits::eof());
- virtual int_type underflow();
-
- virtual pos_type seekoff(off_type, ios_base::seekdir way,
- ios_base::openmode which =
- ios_base::in | ios_base::out);
-
- virtual pos_type seekpos(pos_type sp, ios_base::openmode which =
- ios_base::in | ios_base::out);
-
- virtual streambuf* setbuf(char *s, streamsize n);
- virtual streamsize xsputn(const char_type *s, streamsize n);
-
- private:
- typedef long strstate;
-
- enum str_state {
- allocated = 0x01,
- constant = 0x02,
- dynamic = 0x04,
- frozen = 0x08
- };
-
- int doallocate();
-
- strstate __strmode;
- streamsize __alsize;
- char *__data;
- streamsize __end_pos;
-
- void *(*__palloc)(size_t);
- void (*__pfree)(void *);
- };
-
-
- #ifndef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES
- class _RWSTDExport istrstream : public basic_istream<char>
- {
- #else
- class _RWSTDExport istrstream : public basic_istream<char, char_traits<char> >
- {
- #endif
-
- public:
- //
- // Types:
- //
- typedef char char_type;
- typedef char_traits<char> traits;
- typedef traits::int_type int_type;
- typedef traits::pos_type pos_type;
- typedef traits::off_type off_type;
-
- _EXPLICIT istrstream(const char *s);
- istrstream(const char *s, streamsize n);
- _EXPLICIT istrstream(char *s);
- istrstream(char *s, streamsize n);
-
- virtual ~istrstream();
-
- strstreambuf *rdbuf() const;
- char *str();
- protected:
-
- private:
- strstreambuf __sb;
- };
-
- #ifndef _RWSTD_NO_COMPLEX_DEFAULT_TEMPLATES
- class _RWSTDExport ostrstream : public basic_ostream<char>
- {
- #else
- class _RWSTDExport ostrstream : public basic_ostream<char, char_traits<char> >
- {
- #endif
-
- public:
- //
- // Types:
- //
- typedef char char_type;
- typedef char_traits<char> traits;
- typedef traits::int_type int_type;
- typedef traits::pos_type pos_type;
- typedef traits::off_type off_type;
-
- ostrstream();
- ostrstream(char *s, int n,
- ios_base::openmode = ios_base::out);
-
- virtual ~ostrstream();
- strstreambuf *rdbuf() const;
- void freeze(int freezefl = 1);
- char *str();
- int pcount() const;
-
- protected:
-
- private:
- strstreambuf __sb;
- };
-
-
- /*
- * Class strstream
- */
-
- #ifndef _RWSTD_NO_DEFAULT_TEMPLATES
- class _RWSTDExport strstream : public basic_iostream<char>
- {
- #else
- class _RWSTDExport strstream : public basic_iostream<char, char_traits<char> >
- {
- #endif
-
- public:
- //
- // Types:
- //
- typedef char char_type;
- typedef char_traits<char> traits;
- typedef traits::int_type int_type;
- typedef traits::pos_type pos_type;
- typedef traits::off_type off_type;
-
- strstream();
- strstream(char *s, int n,
- ios_base::openmode = ios_base::out | ios_base::in);
-
- void freeze(int freezefl = 1);
- int pcount() const;
-
- virtual ~strstream();
- strstreambuf *rdbuf() const;
-
- char *str();
- protected:
-
- private:
- strstreambuf __sb;
- };
-
-
- #ifndef _RWSTD_NO_NAMESPACE
- }
- #endif
-
- #pragma option pop
-
- #endif //__STD_STRSTREAM__
-