gcc50/csu: Skip depends step to avoid possible race
[dragonfly.git] / contrib / gcc-4.4 / libstdc++-v3 / include / backward / strstream
1 // Backward-compat support -*- C++ -*-
2
3 // Copyright (C) 2001, 2002, 2004, 2005, 2009, 2010
4 // Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library.  This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
16
17 // Under Section 7 of GPL version 3, you are granted additional
18 // permissions described in the GCC Runtime Library Exception, version
19 // 3.1, as published by the Free Software Foundation.
20
21 // You should have received a copy of the GNU General Public License and
22 // a copy of the GCC Runtime Library Exception along with this program;
23 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24 // <http://www.gnu.org/licenses/>.
25
26 /*
27  * Copyright (c) 1998
28  * Silicon Graphics Computer Systems, Inc.
29  *
30  * Permission to use, copy, modify, distribute and sell this software
31  * and its documentation for any purpose is hereby granted without fee,
32  * provided that the above copyright notice appear in all copies and
33  * that both that copyright notice and this permission notice appear
34  * in supporting documentation.  Silicon Graphics makes no
35  * representations about the suitability of this software for any
36  * purpose.  It is provided "as is" without express or implied warranty.
37  */
38
39 // WARNING: The classes defined in this header are DEPRECATED.  This
40 // header is defined in section D.7.1 of the C++ standard, and it
41 // MAY BE REMOVED in a future standard revision.  One should use the
42 // header <sstream> instead.
43
44 #ifndef _BACKWARD_STRSTREAM
45 #define _BACKWARD_STRSTREAM
46
47 #include "backward_warning.h"
48 #include <iosfwd>
49 #include <ios>
50 #include <istream>
51 #include <ostream>
52 #include <string>
53
54 _GLIBCXX_BEGIN_NAMESPACE(std)
55
56   // Class strstreambuf, a streambuf class that manages an array of char.
57   // Note that this class is not a template.
58   class strstreambuf : public basic_streambuf<char, char_traits<char> >
59   {
60   public:
61     // Types.
62     typedef char_traits<char>              _Traits;
63     typedef basic_streambuf<char, _Traits> _Base;
64
65   public:
66     // Constructor, destructor
67     explicit strstreambuf(streamsize __initial_capacity = 0);
68     strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));
69
70     strstreambuf(char* __get, streamsize __n, char* __put = 0);
71     strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0);
72     strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0);
73
74     strstreambuf(const char* __get, streamsize __n);
75     strstreambuf(const signed char* __get, streamsize __n);
76     strstreambuf(const unsigned char* __get, streamsize __n);
77
78     virtual ~strstreambuf();
79
80   public:
81     void freeze(bool = true);
82     char* str();
83     int pcount() const;
84
85   protected:
86     virtual int_type overflow(int_type __c  = _Traits::eof());
87     virtual int_type pbackfail(int_type __c = _Traits::eof());
88     virtual int_type underflow();
89     virtual _Base* setbuf(char* __buf, streamsize __n);
90     virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
91                              ios_base::openmode __mode
92                              = ios_base::in | ios_base::out);
93     virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
94                              = ios_base::in | ios_base::out);
95
96   private:
97     strstreambuf&
98     operator=(const strstreambuf&);
99
100     strstreambuf(const strstreambuf&);
101
102     // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
103     char* _M_alloc(size_t);
104     void  _M_free(char*);
105
106     // Helper function used in constructors.
107     void _M_setup(char* __get, char* __put, streamsize __n);
108
109   private:
110     // Data members.
111     void* (*_M_alloc_fun)(size_t);
112     void  (*_M_free_fun)(void*);
113
114     bool _M_dynamic  : 1;
115     bool _M_frozen   : 1;
116     bool _M_constant : 1;
117   };
118
119   // Class istrstream, an istream that manages a strstreambuf.
120   class istrstream : public basic_istream<char>
121   {
122   public:
123     explicit istrstream(char*);
124     explicit istrstream(const char*);
125     istrstream(char* , streamsize);
126     istrstream(const char*, streamsize);
127     virtual ~istrstream();
128
129     strstreambuf* rdbuf() const;
130     char* str();
131
132   private:
133     strstreambuf _M_buf;
134   };
135
136   // Class ostrstream
137   class ostrstream : public basic_ostream<char>
138   {
139   public:
140     ostrstream();
141     ostrstream(char*, int, ios_base::openmode = ios_base::out);
142     virtual ~ostrstream();
143
144     strstreambuf* rdbuf() const;
145     void freeze(bool = true);
146     char* str();
147     int pcount() const;
148
149   private:
150     strstreambuf _M_buf;
151   };
152
153   // Class strstream
154   class strstream : public basic_iostream<char>
155   {
156   public:
157     typedef char                        char_type;
158     typedef char_traits<char>::int_type int_type;
159     typedef char_traits<char>::pos_type pos_type;
160     typedef char_traits<char>::off_type off_type;
161
162     strstream();
163     strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
164     virtual ~strstream();
165
166     strstreambuf* rdbuf() const;
167     void freeze(bool = true);
168     int pcount() const;
169     char* str();
170
171   private:
172     strstreambuf _M_buf;
173   };
174
175 _GLIBCXX_END_NAMESPACE
176
177 #endif