STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
strstream File Reference
#include "backward_warning.h"
#include <iosfwd>
#include <ios>
#include <istream>
#include <ostream>
#include <string>

Macros

#define _BACKWARD_STRSTREAM
 

Functions

namespace std _GLIBCXX_VISIBILITY (default)
 

Detailed Description

This is an internal header file, included by other library headers. Do not attempt to use it directly. {sstream}

Macro Definition Documentation

#define _BACKWARD_STRSTREAM

Function Documentation

namespace std _GLIBCXX_VISIBILITY ( default  )
59 {
60 _GLIBCXX_BEGIN_NAMESPACE_VERSION
61 
62  // Class strstreambuf, a streambuf class that manages an array of char.
63  // Note that this class is not a template.
64  class strstreambuf : public basic_streambuf<char, char_traits<char> >
65  {
66  public:
67  // Types.
68  typedef char_traits<char> _Traits;
69  typedef basic_streambuf<char, _Traits> _Base;
70 
71  public:
72  // Constructor, destructor
73  explicit strstreambuf(streamsize __initial_capacity = 0);
74  strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
75 
76  strstreambuf(char* __get, streamsize __n, char* __put = 0) throw ();
77  strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0) throw ();
78  strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0) throw ();
79 
80  strstreambuf(const char* __get, streamsize __n) throw ();
81  strstreambuf(const signed char* __get, streamsize __n) throw ();
82  strstreambuf(const unsigned char* __get, streamsize __n) throw ();
83 
84  virtual ~strstreambuf();
85 
86  public:
87  void freeze(bool = true) throw ();
88  char* str() throw ();
89  _GLIBCXX_PURE int pcount() const throw ();
90 
91  protected:
92  virtual int_type overflow(int_type __c = _Traits::eof());
93  virtual int_type pbackfail(int_type __c = _Traits::eof());
94  virtual int_type underflow();
95  virtual _Base* setbuf(char* __buf, streamsize __n);
96  virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
97  ios_base::openmode __mode
98  = ios_base::in | ios_base::out);
99  virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
100  = ios_base::in | ios_base::out);
101 
102  private:
103  strstreambuf&
104  operator=(const strstreambuf&);
105 
106  strstreambuf(const strstreambuf&);
107 
108  // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
109  char* _M_alloc(size_t);
110  void _M_free(char*);
111 
112  // Helper function used in constructors.
113  void _M_setup(char* __get, char* __put, streamsize __n) throw ();
114 
115  private:
116  // Data members.
117  void* (*_M_alloc_fun)(size_t);
118  void (*_M_free_fun)(void*);
119 
120  bool _M_dynamic : 1;
121  bool _M_frozen : 1;
122  bool _M_constant : 1;
123  };
124 
125  // Class istrstream, an istream that manages a strstreambuf.
126  class istrstream : public basic_istream<char>
127  {
128  public:
129  explicit istrstream(char*);
130  explicit istrstream(const char*);
131  istrstream(char* , streamsize);
132  istrstream(const char*, streamsize);
133  virtual ~istrstream();
134 
135  _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
136  char* str() throw ();
137 
138  private:
139  strstreambuf _M_buf;
140  };
141 
142  // Class ostrstream
143  class ostrstream : public basic_ostream<char>
144  {
145  public:
146  ostrstream();
147  ostrstream(char*, int, ios_base::openmode = ios_base::out);
148  virtual ~ostrstream();
149 
150  _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
151  void freeze(bool = true) throw();
152  char* str() throw ();
153  _GLIBCXX_PURE int pcount() const throw ();
154 
155  private:
156  strstreambuf _M_buf;
157  };
158 
159  // Class strstream
160  class strstream : public basic_iostream<char>
161  {
162  public:
163  typedef char char_type;
164  typedef char_traits<char>::int_type int_type;
165  typedef char_traits<char>::pos_type pos_type;
166  typedef char_traits<char>::off_type off_type;
167 
168  strstream();
169  strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
170  virtual ~strstream();
171 
172  _GLIBCXX_CONST strstreambuf* rdbuf() const throw ();
173  void freeze(bool = true) throw ();
174  _GLIBCXX_PURE int pcount() const throw ();
175  char* str() throw ();
176 
177  private:
178  strstreambuf _M_buf;
179  };
180 
181 _GLIBCXX_END_NAMESPACE_VERSION
182 } // namespace
#define true
Definition: stdbool.h:34