gccxml_gem 0.9.2-universal-darwin-10
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +79 -0
- data/bin/gccxml +0 -0
- data/bin/gccxml_cc1plus +0 -0
- data/gccxml.rb +57 -0
- data/share/doc/gccxml-0.9/Copyright.txt +55 -0
- data/share/doc/gccxml-0.9/gccxml.html +168 -0
- data/share/doc/gccxml-0.9/gccxml.txt +293 -0
- data/share/gccxml-0.9/GCC/2.95/algorithm +76 -0
- data/share/gccxml-0.9/GCC/2.95/bitset +17 -0
- data/share/gccxml-0.9/GCC/2.95/cctype +24 -0
- data/share/gccxml-0.9/GCC/2.95/clocale +14 -0
- data/share/gccxml-0.9/GCC/2.95/cmath +33 -0
- data/share/gccxml-0.9/GCC/2.95/complex +38 -0
- data/share/gccxml-0.9/GCC/2.95/csetjmp +13 -0
- data/share/gccxml-0.9/GCC/2.95/csignal +14 -0
- data/share/gccxml-0.9/GCC/2.95/cstdarg +12 -0
- data/share/gccxml-0.9/GCC/2.95/cstddef +13 -0
- data/share/gccxml-0.9/GCC/2.95/cstdio +55 -0
- data/share/gccxml-0.9/GCC/2.95/cstdlib +66 -0
- data/share/gccxml-0.9/GCC/2.95/cstring +34 -0
- data/share/gccxml-0.9/GCC/2.95/ctime +24 -0
- data/share/gccxml-0.9/GCC/2.95/cwchar +65 -0
- data/share/gccxml-0.9/GCC/2.95/cwctype +31 -0
- data/share/gccxml-0.9/GCC/2.95/deque +19 -0
- data/share/gccxml-0.9/GCC/2.95/exception +20 -0
- data/share/gccxml-0.9/GCC/2.95/fstream +23 -0
- data/share/gccxml-0.9/GCC/2.95/functional +64 -0
- data/share/gccxml-0.9/GCC/2.95/gccxml_bitset +1066 -0
- data/share/gccxml-0.9/GCC/2.95/iomanip +20 -0
- data/share/gccxml-0.9/GCC/2.95/iosfwd +20 -0
- data/share/gccxml-0.9/GCC/2.95/iostream +27 -0
- data/share/gccxml-0.9/GCC/2.95/iterator +39 -0
- data/share/gccxml-0.9/GCC/2.95/list +19 -0
- data/share/gccxml-0.9/GCC/2.95/map +20 -0
- data/share/gccxml-0.9/GCC/2.95/memory +21 -0
- data/share/gccxml-0.9/GCC/2.95/new +13 -0
- data/share/gccxml-0.9/GCC/2.95/numeric +15 -0
- data/share/gccxml-0.9/GCC/2.95/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/2.95/queue +20 -0
- data/share/gccxml-0.9/GCC/2.95/set +20 -0
- data/share/gccxml-0.9/GCC/2.95/sstream +24 -0
- data/share/gccxml-0.9/GCC/2.95/stack +19 -0
- data/share/gccxml-0.9/GCC/2.95/std/bastring.cc +524 -0
- data/share/gccxml-0.9/GCC/2.95/std/complext.h +397 -0
- data/share/gccxml-0.9/GCC/2.95/std/dcomplex.h +92 -0
- data/share/gccxml-0.9/GCC/2.95/std/fcomplex.h +88 -0
- data/share/gccxml-0.9/GCC/2.95/std/gslice_array.h +170 -0
- data/share/gccxml-0.9/GCC/2.95/std/indirect_array.h +157 -0
- data/share/gccxml-0.9/GCC/2.95/std/ldcomplex.h +96 -0
- data/share/gccxml-0.9/GCC/2.95/std/mask_array.h +154 -0
- data/share/gccxml-0.9/GCC/2.95/std/slice_array.h +156 -0
- data/share/gccxml-0.9/GCC/2.95/std/std_valarray.h +728 -0
- data/share/gccxml-0.9/GCC/2.95/std/straits.h +162 -0
- data/share/gccxml-0.9/GCC/2.95/std/valarray_meta.h +1035 -0
- data/share/gccxml-0.9/GCC/2.95/stdexcept +17 -0
- data/share/gccxml-0.9/GCC/2.95/stl_alloc.h +1057 -0
- data/share/gccxml-0.9/GCC/2.95/stl_bvector.h +836 -0
- data/share/gccxml-0.9/GCC/2.95/stl_deque.h +1699 -0
- data/share/gccxml-0.9/GCC/2.95/stl_list.h +843 -0
- data/share/gccxml-0.9/GCC/2.95/stl_tree.h +1331 -0
- data/share/gccxml-0.9/GCC/2.95/stl_vector.h +828 -0
- data/share/gccxml-0.9/GCC/2.95/string +26 -0
- data/share/gccxml-0.9/GCC/2.95/strstream +23 -0
- data/share/gccxml-0.9/GCC/2.95/typeinfo +11 -0
- data/share/gccxml-0.9/GCC/2.95/utility +25 -0
- data/share/gccxml-0.9/GCC/2.95/valarray +52 -0
- data/share/gccxml-0.9/GCC/2.95/vector +19 -0
- data/share/gccxml-0.9/GCC/2.96/sstream +305 -0
- data/share/gccxml-0.9/GCC/3.0/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.1/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.2/bits/fstream.tcc +500 -0
- data/share/gccxml-0.9/GCC/3.2/bits/gthr-default.h +581 -0
- data/share/gccxml-0.9/GCC/3.2/bits/istream.tcc +1207 -0
- data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.h +1810 -0
- data/share/gccxml-0.9/GCC/3.2/bits/locale_facets.tcc +2397 -0
- data/share/gccxml-0.9/GCC/3.2/bits/messages_members.h +108 -0
- data/share/gccxml-0.9/GCC/3.2/bits/ostream.tcc +713 -0
- data/share/gccxml-0.9/GCC/3.2/bits/sstream.tcc +241 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_deque.h +1682 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_list.h +989 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_tree.h +1462 -0
- data/share/gccxml-0.9/GCC/3.2/bits/stl_vector.h +1085 -0
- data/share/gccxml-0.9/GCC/3.2/bits/valarray_meta.h +1063 -0
- data/share/gccxml-0.9/GCC/3.2/fstream +579 -0
- data/share/gccxml-0.9/GCC/3.2/pthread.h +16 -0
- data/share/gccxml-0.9/GCC/3.2/sstream +384 -0
- data/share/gccxml-0.9/GCC/3.3/bits/fstream.tcc +530 -0
- data/share/gccxml-0.9/GCC/3.3/bits/list.tcc +378 -0
- data/share/gccxml-0.9/GCC/3.3/bits/locale_facets.h +2050 -0
- data/share/gccxml-0.9/GCC/3.3/bits/messages_members.h +108 -0
- data/share/gccxml-0.9/GCC/3.3/bits/sstream.tcc +243 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_deque.h +1603 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_list.h +1167 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_tree.h +1462 -0
- data/share/gccxml-0.9/GCC/3.3/bits/stl_vector.h +992 -0
- data/share/gccxml-0.9/GCC/3.3/bits/valarray_meta.h +1135 -0
- data/share/gccxml-0.9/GCC/3.3/fstream +842 -0
- data/share/gccxml-0.9/GCC/3.3/gccxml_builtins.h +22 -0
- data/share/gccxml-0.9/GCC/3.3/sstream +638 -0
- data/share/gccxml-0.9/GCC/3.4/bits/gthr-default.h +664 -0
- data/share/gccxml-0.9/GCC/3.4/gccxml_builtins.h +91 -0
- data/share/gccxml-0.9/GCC/4.0/gccxml_builtins.h +128 -0
- data/share/gccxml-0.9/GCC/4.1/bits/gthr-default.h +618 -0
- data/share/gccxml-0.9/GCC/4.1/gccxml_builtins.h +131 -0
- data/share/gccxml-0.9/GCC/4.2/gccxml_builtins.h +131 -0
- data/share/gccxml-0.9/GCC/4.3/gccxml_builtins.h +182 -0
- data/share/gccxml-0.9/IBM/8.0/adapt_headers.sh +34 -0
- data/share/gccxml-0.9/IBM/8.0/stdlib.h.patch +27 -0
- data/share/gccxml-0.9/IBM/8.0/xstring.patch +19 -0
- data/share/gccxml-0.9/IBM/README +8 -0
- data/share/gccxml-0.9/IBM/find_flags +51 -0
- data/share/gccxml-0.9/IBM/find_flags_common +48 -0
- data/share/gccxml-0.9/Intel/find_flags +56 -0
- data/share/gccxml-0.9/Intel/pthread.h +16 -0
- data/share/gccxml-0.9/MIPSpro/7.3/exception +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/gccxml_mpro_internals.h +21 -0
- data/share/gccxml-0.9/MIPSpro/7.3/iomanip +161 -0
- data/share/gccxml-0.9/MIPSpro/7.3/ostream +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stddef.h +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_config.h +9 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_locale.h +17 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_monetary.h +14 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_numeric_facets.h +13 -0
- data/share/gccxml-0.9/MIPSpro/7.3/stl_threads.h +11 -0
- data/share/gccxml-0.9/MIPSpro/7.3/string +18 -0
- data/share/gccxml-0.9/MIPSpro/find_flags +70 -0
- data/share/gccxml-0.9/MIPSpro/mipspro_defs.cxx +63 -0
- data/share/gccxml-0.9/Sun/5.8/Cstd.patch +156 -0
- data/share/gccxml-0.9/Sun/5.8/adapt_headers.sh +32 -0
- data/share/gccxml-0.9/Sun/5.8/std-5.10.patch +22 -0
- data/share/gccxml-0.9/Sun/README +8 -0
- data/share/gccxml-0.9/Sun/find_flags +51 -0
- data/share/gccxml-0.9/Sun/find_flags_common +42 -0
- data/share/gccxml-0.9/gccxml_config +2 -0
- data/share/gccxml-0.9/gccxml_identify_compiler.cc +13 -0
- data/share/man/man1/gccxml.1 +246 -0
- metadata +194 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
#define __builtin_apply(x,y,z) ((void*)0)
|
2
|
+
#define __builtin_nan(x) (0.0)
|
3
|
+
#define __builtin_nanf(x) (0.0f)
|
4
|
+
#define __builtin_nanl(x) (0.0l)
|
5
|
+
#define __builtin_huge_val(x) (0.0)
|
6
|
+
#define __builtin_huge_valf(x) (0.0f)
|
7
|
+
#define __builtin_huge_vall(x) (0.0l)
|
8
|
+
#define __builtin_apply_args(x) ((void*)0)
|
9
|
+
#define __builtin_types_compatible_p(x,y) 0
|
10
|
+
#define __builtin_choose_expr(x,y,z) int
|
11
|
+
#define __builtin_constant_p(x) 0
|
12
|
+
void __builtin_return (void *RESULT);
|
13
|
+
void * __builtin_return_address (unsigned int LEVEL);
|
14
|
+
void * __builtin_frame_address (unsigned int LEVEL);
|
15
|
+
long __builtin_expect (long EXP, long C);
|
16
|
+
void __builtin_prefetch (const void *ADDR, ...);
|
17
|
+
double __builtin_inf (void);
|
18
|
+
float __builtin_inff (void);
|
19
|
+
long double __builtin_infl (void);
|
20
|
+
double __builtin_nans (const char *str);
|
21
|
+
float __builtin_nansf (const char *str);
|
22
|
+
long double __builtin_nansl (const char *str);
|
@@ -0,0 +1,638 @@
|
|
1
|
+
// String based streams -*- C++ -*-
|
2
|
+
|
3
|
+
// Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
|
4
|
+
//
|
5
|
+
// This file is part of the GNU ISO C++ Library. This library is free
|
6
|
+
// software; you can redistribute it and/or modify it under the
|
7
|
+
// terms of the GNU General Public License as published by the
|
8
|
+
// Free Software Foundation; either version 2, or (at your option)
|
9
|
+
// any later version.
|
10
|
+
|
11
|
+
// This library is distributed in the hope that it will be useful,
|
12
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
// GNU General Public License for more details.
|
15
|
+
|
16
|
+
// You should have received a copy of the GNU General Public License along
|
17
|
+
// with this library; see the file COPYING. If not, write to the Free
|
18
|
+
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
19
|
+
// USA.
|
20
|
+
|
21
|
+
// As a special exception, you may use this file as part of a free software
|
22
|
+
// library without restriction. Specifically, if other files instantiate
|
23
|
+
// templates or use macros or inline functions from this file, or you compile
|
24
|
+
// this file and link it with other files to produce an executable, this
|
25
|
+
// file does not by itself cause the resulting executable to be covered by
|
26
|
+
// the GNU General Public License. This exception does not however
|
27
|
+
// invalidate any other reasons why the executable file might be covered by
|
28
|
+
// the GNU General Public License.
|
29
|
+
|
30
|
+
//
|
31
|
+
// ISO C++ 14882: 27.7 String-based streams
|
32
|
+
//
|
33
|
+
|
34
|
+
/** @file sstream
|
35
|
+
* This is a Standard C++ Library header. You should @c #include this header
|
36
|
+
* in your programs, rather than any of the "st[dl]_*.h" implementation files.
|
37
|
+
*/
|
38
|
+
|
39
|
+
#ifndef _CPP_SSTREAM
|
40
|
+
#define _CPP_SSTREAM 1
|
41
|
+
|
42
|
+
#pragma GCC system_header
|
43
|
+
|
44
|
+
#include <istream>
|
45
|
+
#include <ostream>
|
46
|
+
|
47
|
+
namespace std
|
48
|
+
{
|
49
|
+
// [27.7.1] template class basic_stringbuf
|
50
|
+
/**
|
51
|
+
* @brief The actual work of input and output (for std::string).
|
52
|
+
*
|
53
|
+
* This class associates either or both of its input and output sequences
|
54
|
+
* with a sequence of characters, which can be initialized from, or made
|
55
|
+
* available as, a @c std::basic_string. (Paraphrased from [27.7.1]/1.)
|
56
|
+
*
|
57
|
+
* For this class, open modes (of type @c ios_base::openmode) have
|
58
|
+
* @c in set if the input sequence can be read, and @c out set if the
|
59
|
+
* output sequence can be written.
|
60
|
+
*/
|
61
|
+
template<typename _CharT, typename _Traits, typename _Alloc>
|
62
|
+
class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
|
63
|
+
{
|
64
|
+
public:
|
65
|
+
// Types:
|
66
|
+
typedef _CharT char_type;
|
67
|
+
typedef _Traits traits_type;
|
68
|
+
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
|
69
|
+
// 251. basic_stringbuf missing allocator_type
|
70
|
+
typedef _Alloc allocator_type;
|
71
|
+
#endif
|
72
|
+
typedef typename traits_type::int_type int_type;
|
73
|
+
typedef typename traits_type::pos_type pos_type;
|
74
|
+
typedef typename traits_type::off_type off_type;
|
75
|
+
|
76
|
+
//@{
|
77
|
+
/**
|
78
|
+
* @if maint
|
79
|
+
* @doctodo
|
80
|
+
* @endif
|
81
|
+
*/
|
82
|
+
typedef basic_streambuf<char_type, traits_type> __streambuf_type;
|
83
|
+
typedef basic_string<char_type, _Traits, _Alloc> __string_type;
|
84
|
+
typedef typename __string_type::size_type __size_type;
|
85
|
+
//@}
|
86
|
+
|
87
|
+
protected:
|
88
|
+
// Data Members:
|
89
|
+
/**
|
90
|
+
* @if maint
|
91
|
+
* @doctodo
|
92
|
+
* @endif
|
93
|
+
*/
|
94
|
+
__string_type _M_string;
|
95
|
+
|
96
|
+
public:
|
97
|
+
// Constructors:
|
98
|
+
/**
|
99
|
+
* @brief Starts with an empty string buffer.
|
100
|
+
* @param mode Whether the buffer can read, or write, or both.
|
101
|
+
*
|
102
|
+
* The default constructor initializes the parent class using its
|
103
|
+
* own default ctor.
|
104
|
+
*/
|
105
|
+
explicit
|
106
|
+
basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)
|
107
|
+
: __streambuf_type(), _M_string()
|
108
|
+
{ _M_stringbuf_init(__mode); }
|
109
|
+
|
110
|
+
/**
|
111
|
+
* @brief Starts with an existing string buffer.
|
112
|
+
* @param str A string to copy as a starting buffer.
|
113
|
+
* @param mode Whether the buffer can read, or write, or both.
|
114
|
+
*
|
115
|
+
* This constructor initializes the parent class using its
|
116
|
+
* own default ctor.
|
117
|
+
*/
|
118
|
+
explicit
|
119
|
+
basic_stringbuf(const __string_type& __str,
|
120
|
+
ios_base::openmode __mode = ios_base::in | ios_base::out)
|
121
|
+
: __streambuf_type(), _M_string(__str.data(), __str.size())
|
122
|
+
{ _M_stringbuf_init(__mode); }
|
123
|
+
|
124
|
+
// Get and set:
|
125
|
+
/**
|
126
|
+
* @brief Copying out the string buffer.
|
127
|
+
* @return A copy of one of the underlying sequences.
|
128
|
+
*
|
129
|
+
* "If the buffer is only created in input mode, the underlying
|
130
|
+
* character sequence is equal to the input sequence; otherwise, it
|
131
|
+
* is equal to the output sequence." [27.7.1.2]/1
|
132
|
+
*/
|
133
|
+
__string_type
|
134
|
+
str() const
|
135
|
+
{
|
136
|
+
if (this->_M_mode & ios_base::out)
|
137
|
+
{
|
138
|
+
// This is the deal: _M_string.size() is a value that
|
139
|
+
// represents the size of the initial string that makes
|
140
|
+
// _M_string, and may not be the correct size of the
|
141
|
+
// current stringbuf internal buffer.
|
142
|
+
__size_type __len = _M_string.size();
|
143
|
+
if (this->_M_out_end > this->_M_out_beg)
|
144
|
+
__len = max(__size_type(this->_M_out_end - this->_M_out_beg), __len);
|
145
|
+
return __string_type(this->_M_out_beg, this->_M_out_beg + __len);
|
146
|
+
}
|
147
|
+
else
|
148
|
+
return _M_string;
|
149
|
+
}
|
150
|
+
|
151
|
+
/**
|
152
|
+
* @brief Setting a new buffer.
|
153
|
+
* @param s The string to use as a new sequence.
|
154
|
+
*
|
155
|
+
* Deallocates any previous stored sequence, then copies @a s to
|
156
|
+
* use as a new one.
|
157
|
+
*/
|
158
|
+
void
|
159
|
+
str(const __string_type& __s)
|
160
|
+
{
|
161
|
+
// Cannot use _M_string = __s, since v3 strings are COW.
|
162
|
+
_M_string.assign(__s.data(), __s.size());
|
163
|
+
_M_stringbuf_init(this->_M_mode);
|
164
|
+
}
|
165
|
+
|
166
|
+
protected:
|
167
|
+
// Common initialization code for both ctors goes here.
|
168
|
+
/**
|
169
|
+
* @if maint
|
170
|
+
* @doctodo
|
171
|
+
* @endif
|
172
|
+
*/
|
173
|
+
void
|
174
|
+
_M_stringbuf_init(ios_base::openmode __mode)
|
175
|
+
{
|
176
|
+
// _M_buf_size is a convenient alias for "what the streambuf
|
177
|
+
// thinks the allocated size of the string really is." This is
|
178
|
+
// necessary as ostringstreams are implemented with the
|
179
|
+
// streambufs having control of the allocation and
|
180
|
+
// re-allocation of the internal string object, _M_string.
|
181
|
+
this->_M_buf_size = _M_string.size();
|
182
|
+
|
183
|
+
// NB: Start ostringstream buffers at 512 bytes. This is an
|
184
|
+
// experimental value (pronounced "arbitrary" in some of the
|
185
|
+
// hipper english-speaking countries), and can be changed to
|
186
|
+
// suit particular needs.
|
187
|
+
this->_M_buf_size_opt = 512;
|
188
|
+
this->_M_mode = __mode;
|
189
|
+
if (this->_M_mode & (ios_base::ate | ios_base::app))
|
190
|
+
_M_really_sync(0, this->_M_buf_size);
|
191
|
+
else
|
192
|
+
_M_really_sync(0, 0);
|
193
|
+
}
|
194
|
+
|
195
|
+
// Overridden virtual functions:
|
196
|
+
// [documentation is inherited]
|
197
|
+
virtual int_type
|
198
|
+
underflow()
|
199
|
+
{
|
200
|
+
if (this->_M_in_cur && this->_M_in_cur < this->_M_in_end)
|
201
|
+
return traits_type::to_int_type(*this->gptr());
|
202
|
+
else
|
203
|
+
return traits_type::eof();
|
204
|
+
}
|
205
|
+
|
206
|
+
// [documentation is inherited]
|
207
|
+
virtual int_type
|
208
|
+
pbackfail(int_type __c = traits_type::eof());
|
209
|
+
|
210
|
+
// [documentation is inherited]
|
211
|
+
virtual int_type
|
212
|
+
overflow(int_type __c = traits_type::eof());
|
213
|
+
|
214
|
+
/**
|
215
|
+
* @brief Manipulates the buffer.
|
216
|
+
* @param s Pointer to a buffer area.
|
217
|
+
* @param n Size of @a s.
|
218
|
+
* @return @c this
|
219
|
+
*
|
220
|
+
* If no buffer has already been created, and both @a s and @a n are
|
221
|
+
* non-zero, then @c s is used as a buffer; see
|
222
|
+
* http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2
|
223
|
+
* for more.
|
224
|
+
*/
|
225
|
+
virtual __streambuf_type*
|
226
|
+
setbuf(char_type* __s, streamsize __n)
|
227
|
+
{
|
228
|
+
if (__s && __n)
|
229
|
+
{
|
230
|
+
_M_string = __string_type(__s, __n);
|
231
|
+
_M_really_sync(0, 0);
|
232
|
+
}
|
233
|
+
return this;
|
234
|
+
}
|
235
|
+
|
236
|
+
// [documentation is inherited]
|
237
|
+
virtual pos_type
|
238
|
+
seekoff(off_type __off, ios_base::seekdir __way,
|
239
|
+
ios_base::openmode __mode = ios_base::in | ios_base::out);
|
240
|
+
|
241
|
+
// [documentation is inherited]
|
242
|
+
virtual pos_type
|
243
|
+
seekpos(pos_type __sp,
|
244
|
+
ios_base::openmode __mode = ios_base::in | ios_base::out);
|
245
|
+
|
246
|
+
// Internal function for correctly updating the internal buffer
|
247
|
+
// for a particular _M_string, due to initialization or
|
248
|
+
// re-sizing of an existing _M_string.
|
249
|
+
// Assumes: contents of _M_string and internal buffer match exactly.
|
250
|
+
// __i == _M_in_cur - _M_in_beg
|
251
|
+
// __o == _M_out_cur - _M_out_beg
|
252
|
+
/**
|
253
|
+
* @if maint
|
254
|
+
* @doctodo
|
255
|
+
* @endif
|
256
|
+
*/
|
257
|
+
virtual int
|
258
|
+
_M_really_sync(__size_type __i, __size_type __o)
|
259
|
+
{
|
260
|
+
char_type* __base = const_cast<char_type*>(_M_string.data());
|
261
|
+
bool __testin = this->_M_mode & ios_base::in;
|
262
|
+
bool __testout = this->_M_mode & ios_base::out;
|
263
|
+
__size_type __len = _M_string.size();
|
264
|
+
|
265
|
+
this->_M_buf = __base;
|
266
|
+
if (__testin)
|
267
|
+
this->setg(__base, __base + __i, __base + __len);
|
268
|
+
if (__testout)
|
269
|
+
{
|
270
|
+
this->setp(__base, __base + __len);
|
271
|
+
this->_M_out_cur += __o;
|
272
|
+
}
|
273
|
+
return 0;
|
274
|
+
}
|
275
|
+
};
|
276
|
+
|
277
|
+
|
278
|
+
// [27.7.2] Template class basic_istringstream
|
279
|
+
/**
|
280
|
+
* @brief Controlling input for std::string.
|
281
|
+
*
|
282
|
+
* This class supports reading from objects of type std::basic_string,
|
283
|
+
* using the inherited functions from std::basic_istream. To control
|
284
|
+
* the associated sequence, an instance of std::basic_stringbuf is used,
|
285
|
+
* which this page refers to as @c sb.
|
286
|
+
*/
|
287
|
+
template<typename _CharT, typename _Traits, typename _Alloc>
|
288
|
+
class basic_istringstream : public basic_istream<_CharT, _Traits>
|
289
|
+
{
|
290
|
+
public:
|
291
|
+
// Types:
|
292
|
+
typedef _CharT char_type;
|
293
|
+
typedef _Traits traits_type;
|
294
|
+
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
|
295
|
+
// 251. basic_stringbuf missing allocator_type
|
296
|
+
typedef _Alloc allocator_type;
|
297
|
+
#endif
|
298
|
+
typedef typename traits_type::int_type int_type;
|
299
|
+
typedef typename traits_type::pos_type pos_type;
|
300
|
+
typedef typename traits_type::off_type off_type;
|
301
|
+
|
302
|
+
// Non-standard types:
|
303
|
+
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
|
304
|
+
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
|
305
|
+
typedef basic_istream<char_type, traits_type> __istream_type;
|
306
|
+
|
307
|
+
private:
|
308
|
+
/**
|
309
|
+
* @if maint
|
310
|
+
* @doctodo
|
311
|
+
* @endif
|
312
|
+
*/
|
313
|
+
__stringbuf_type _M_stringbuf;
|
314
|
+
|
315
|
+
public:
|
316
|
+
// Constructors:
|
317
|
+
/**
|
318
|
+
* @brief Default constructor starts with an empty string buffer.
|
319
|
+
* @param mode Whether the buffer can read, or write, or both.
|
320
|
+
*
|
321
|
+
* @c ios_base::in is automatically included in @a mode.
|
322
|
+
*
|
323
|
+
* Initializes @c sb using @c mode|in, and passes @c &sb to the base
|
324
|
+
* class initializer. Does not allocate any buffer.
|
325
|
+
*
|
326
|
+
* @if maint
|
327
|
+
* That's a lie. We initialize the base class with NULL, because the
|
328
|
+
* string class does its own memory management.
|
329
|
+
* @endif
|
330
|
+
*/
|
331
|
+
explicit
|
332
|
+
basic_istringstream(ios_base::openmode __mode = ios_base::in)
|
333
|
+
: __istream_type(NULL), _M_stringbuf(__mode | ios_base::in)
|
334
|
+
{ this->init(&_M_stringbuf); }
|
335
|
+
|
336
|
+
/**
|
337
|
+
* @brief Starts with an existing string buffer.
|
338
|
+
* @param str A string to copy as a starting buffer.
|
339
|
+
* @param mode Whether the buffer can read, or write, or both.
|
340
|
+
*
|
341
|
+
* @c ios_base::in is automatically included in @a mode.
|
342
|
+
*
|
343
|
+
* Initializes @c sb using @a str and @c mode|in, and passes @c &sb
|
344
|
+
* to the base class initializer.
|
345
|
+
*
|
346
|
+
* @if maint
|
347
|
+
* That's a lie. We initialize the base class with NULL, because the
|
348
|
+
* string class does its own memory management.
|
349
|
+
* @endif
|
350
|
+
*/
|
351
|
+
explicit
|
352
|
+
basic_istringstream(const __string_type& __str,
|
353
|
+
ios_base::openmode __mode = ios_base::in)
|
354
|
+
: __istream_type(NULL), _M_stringbuf(__str, __mode | ios_base::in)
|
355
|
+
{ this->init(&_M_stringbuf); }
|
356
|
+
|
357
|
+
/**
|
358
|
+
* @brief The destructor does nothing.
|
359
|
+
*
|
360
|
+
* The buffer is deallocated by the stringbuf object, not the
|
361
|
+
* formatting stream.
|
362
|
+
*/
|
363
|
+
~basic_istringstream()
|
364
|
+
{ }
|
365
|
+
|
366
|
+
// Members:
|
367
|
+
/**
|
368
|
+
* @brief Accessing the underlying buffer.
|
369
|
+
* @return The current basic_stringbuf buffer.
|
370
|
+
*
|
371
|
+
* This hides both signatures of std::basic_ios::rdbuf().
|
372
|
+
*/
|
373
|
+
__stringbuf_type*
|
374
|
+
rdbuf() const
|
375
|
+
{ return const_cast<__stringbuf_type*>(&_M_stringbuf); }
|
376
|
+
|
377
|
+
/**
|
378
|
+
* @brief Copying out the string buffer.
|
379
|
+
* @return @c rdbuf()->str()
|
380
|
+
*/
|
381
|
+
__string_type
|
382
|
+
str() const
|
383
|
+
{ return _M_stringbuf.str(); }
|
384
|
+
|
385
|
+
/**
|
386
|
+
* @brief Setting a new buffer.
|
387
|
+
* @param s The string to use as a new sequence.
|
388
|
+
*
|
389
|
+
* Calls @c rdbuf()->str(s).
|
390
|
+
*/
|
391
|
+
void
|
392
|
+
str(const __string_type& __s)
|
393
|
+
{ _M_stringbuf.str(__s); }
|
394
|
+
};
|
395
|
+
|
396
|
+
|
397
|
+
// [27.7.3] Template class basic_ostringstream
|
398
|
+
/**
|
399
|
+
* @brief Controlling output for std::string.
|
400
|
+
*
|
401
|
+
* This class supports writing to objects of type std::basic_string,
|
402
|
+
* using the inherited functions from std::basic_ostream. To control
|
403
|
+
* the associated sequence, an instance of std::basic_stringbuf is used,
|
404
|
+
* which this page refers to as @c sb.
|
405
|
+
*/
|
406
|
+
template <typename _CharT, typename _Traits, typename _Alloc>
|
407
|
+
class basic_ostringstream : public basic_ostream<_CharT, _Traits>
|
408
|
+
{
|
409
|
+
public:
|
410
|
+
// Types:
|
411
|
+
typedef _CharT char_type;
|
412
|
+
typedef _Traits traits_type;
|
413
|
+
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
|
414
|
+
// 251. basic_stringbuf missing allocator_type
|
415
|
+
typedef _Alloc allocator_type;
|
416
|
+
#endif
|
417
|
+
typedef typename traits_type::int_type int_type;
|
418
|
+
typedef typename traits_type::pos_type pos_type;
|
419
|
+
typedef typename traits_type::off_type off_type;
|
420
|
+
|
421
|
+
// Non-standard types:
|
422
|
+
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
|
423
|
+
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
|
424
|
+
typedef basic_ostream<char_type, traits_type> __ostream_type;
|
425
|
+
|
426
|
+
private:
|
427
|
+
/**
|
428
|
+
* @if maint
|
429
|
+
* @doctodo
|
430
|
+
* @endif
|
431
|
+
*/
|
432
|
+
__stringbuf_type _M_stringbuf;
|
433
|
+
|
434
|
+
public:
|
435
|
+
// Constructors/destructor:
|
436
|
+
/**
|
437
|
+
* @brief Default constructor starts with an empty string buffer.
|
438
|
+
* @param mode Whether the buffer can read, or write, or both.
|
439
|
+
*
|
440
|
+
* @c ios_base::out is automatically included in @a mode.
|
441
|
+
*
|
442
|
+
* Initializes @c sb using @c mode|out, and passes @c &sb to the base
|
443
|
+
* class initializer. Does not allocate any buffer.
|
444
|
+
*
|
445
|
+
* @if maint
|
446
|
+
* That's a lie. We initialize the base class with NULL, because the
|
447
|
+
* string class does its own memory management.
|
448
|
+
* @endif
|
449
|
+
*/
|
450
|
+
explicit
|
451
|
+
basic_ostringstream(ios_base::openmode __mode = ios_base::out)
|
452
|
+
: __ostream_type(NULL), _M_stringbuf(__mode | ios_base::out)
|
453
|
+
{ this->init(&_M_stringbuf); }
|
454
|
+
|
455
|
+
/**
|
456
|
+
* @brief Starts with an existing string buffer.
|
457
|
+
* @param str A string to copy as a starting buffer.
|
458
|
+
* @param mode Whether the buffer can read, or write, or both.
|
459
|
+
*
|
460
|
+
* @c ios_base::out is automatically included in @a mode.
|
461
|
+
*
|
462
|
+
* Initializes @c sb using @a str and @c mode|out, and passes @c &sb
|
463
|
+
* to the base class initializer.
|
464
|
+
*
|
465
|
+
* @if maint
|
466
|
+
* That's a lie. We initialize the base class with NULL, because the
|
467
|
+
* string class does its own memory management.
|
468
|
+
* @endif
|
469
|
+
*/
|
470
|
+
explicit
|
471
|
+
basic_ostringstream(const __string_type& __str,
|
472
|
+
ios_base::openmode __mode = ios_base::out)
|
473
|
+
: __ostream_type(NULL), _M_stringbuf(__str, __mode | ios_base::out)
|
474
|
+
{ this->init(&_M_stringbuf); }
|
475
|
+
|
476
|
+
/**
|
477
|
+
* @brief The destructor does nothing.
|
478
|
+
*
|
479
|
+
* The buffer is deallocated by the stringbuf object, not the
|
480
|
+
* formatting stream.
|
481
|
+
*/
|
482
|
+
~basic_ostringstream()
|
483
|
+
{ }
|
484
|
+
|
485
|
+
// Members:
|
486
|
+
/**
|
487
|
+
* @brief Accessing the underlying buffer.
|
488
|
+
* @return The current basic_stringbuf buffer.
|
489
|
+
*
|
490
|
+
* This hides both signatures of std::basic_ios::rdbuf().
|
491
|
+
*/
|
492
|
+
__stringbuf_type*
|
493
|
+
rdbuf() const
|
494
|
+
{ return const_cast<__stringbuf_type*>(&_M_stringbuf); }
|
495
|
+
|
496
|
+
/**
|
497
|
+
* @brief Copying out the string buffer.
|
498
|
+
* @return @c rdbuf()->str()
|
499
|
+
*/
|
500
|
+
__string_type
|
501
|
+
str() const
|
502
|
+
{ return _M_stringbuf.str(); }
|
503
|
+
|
504
|
+
/**
|
505
|
+
* @brief Setting a new buffer.
|
506
|
+
* @param s The string to use as a new sequence.
|
507
|
+
*
|
508
|
+
* Calls @c rdbuf()->str(s).
|
509
|
+
*/
|
510
|
+
void
|
511
|
+
str(const __string_type& __s)
|
512
|
+
{ _M_stringbuf.str(__s); }
|
513
|
+
};
|
514
|
+
|
515
|
+
|
516
|
+
// [27.7.4] Template class basic_stringstream
|
517
|
+
/**
|
518
|
+
* @brief Controlling input and output for std::string.
|
519
|
+
*
|
520
|
+
* This class supports reading from and writing to objects of type
|
521
|
+
* std::basic_string, using the inherited functions from
|
522
|
+
* std::basic_iostream. To control the associated sequence, an instance
|
523
|
+
* of std::basic_stringbuf is used, which this page refers to as @c sb.
|
524
|
+
*/
|
525
|
+
template <typename _CharT, typename _Traits, typename _Alloc>
|
526
|
+
class basic_stringstream : public basic_iostream<_CharT, _Traits>
|
527
|
+
{
|
528
|
+
public:
|
529
|
+
// Types:
|
530
|
+
typedef _CharT char_type;
|
531
|
+
typedef _Traits traits_type;
|
532
|
+
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
|
533
|
+
// 251. basic_stringbuf missing allocator_type
|
534
|
+
typedef _Alloc allocator_type;
|
535
|
+
#endif
|
536
|
+
typedef typename traits_type::int_type int_type;
|
537
|
+
typedef typename traits_type::pos_type pos_type;
|
538
|
+
typedef typename traits_type::off_type off_type;
|
539
|
+
|
540
|
+
// Non-standard Types:
|
541
|
+
typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
|
542
|
+
typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
|
543
|
+
typedef basic_iostream<char_type, traits_type> __iostream_type;
|
544
|
+
|
545
|
+
private:
|
546
|
+
/**
|
547
|
+
* @if maint
|
548
|
+
* @doctodo
|
549
|
+
* @endif
|
550
|
+
*/
|
551
|
+
__stringbuf_type _M_stringbuf;
|
552
|
+
|
553
|
+
public:
|
554
|
+
// Constructors/destructors
|
555
|
+
/**
|
556
|
+
* @brief Default constructor starts with an empty string buffer.
|
557
|
+
* @param mode Whether the buffer can read, or write, or both.
|
558
|
+
*
|
559
|
+
* Initializes @c sb using @c mode, and passes @c &sb to the base
|
560
|
+
* class initializer. Does not allocate any buffer.
|
561
|
+
*
|
562
|
+
* @if maint
|
563
|
+
* That's a lie. We initialize the base class with NULL, because the
|
564
|
+
* string class does its own memory management.
|
565
|
+
* @endif
|
566
|
+
*/
|
567
|
+
explicit
|
568
|
+
basic_stringstream(ios_base::openmode __m = ios_base::out | ios_base::in)
|
569
|
+
: __iostream_type(NULL), _M_stringbuf(__m)
|
570
|
+
{ this->init(&_M_stringbuf); }
|
571
|
+
|
572
|
+
/**
|
573
|
+
* @brief Starts with an existing string buffer.
|
574
|
+
* @param str A string to copy as a starting buffer.
|
575
|
+
* @param mode Whether the buffer can read, or write, or both.
|
576
|
+
*
|
577
|
+
* Initializes @c sb using @a str and @c mode, and passes @c &sb
|
578
|
+
* to the base class initializer.
|
579
|
+
*
|
580
|
+
* @if maint
|
581
|
+
* That's a lie. We initialize the base class with NULL, because the
|
582
|
+
* string class does its own memory management.
|
583
|
+
* @endif
|
584
|
+
*/
|
585
|
+
explicit
|
586
|
+
basic_stringstream(const __string_type& __str,
|
587
|
+
ios_base::openmode __m = ios_base::out | ios_base::in)
|
588
|
+
: __iostream_type(NULL), _M_stringbuf(__str, __m)
|
589
|
+
{ this->init(&_M_stringbuf); }
|
590
|
+
|
591
|
+
/**
|
592
|
+
* @brief The destructor does nothing.
|
593
|
+
*
|
594
|
+
* The buffer is deallocated by the stringbuf object, not the
|
595
|
+
* formatting stream.
|
596
|
+
*/
|
597
|
+
~basic_stringstream()
|
598
|
+
{ }
|
599
|
+
|
600
|
+
// Members:
|
601
|
+
/**
|
602
|
+
* @brief Accessing the underlying buffer.
|
603
|
+
* @return The current basic_stringbuf buffer.
|
604
|
+
*
|
605
|
+
* This hides both signatures of std::basic_ios::rdbuf().
|
606
|
+
*/
|
607
|
+
__stringbuf_type*
|
608
|
+
rdbuf() const
|
609
|
+
{ return const_cast<__stringbuf_type*>(&_M_stringbuf); }
|
610
|
+
|
611
|
+
/**
|
612
|
+
* @brief Copying out the string buffer.
|
613
|
+
* @return @c rdbuf()->str()
|
614
|
+
*/
|
615
|
+
__string_type
|
616
|
+
str() const
|
617
|
+
{ return _M_stringbuf.str(); }
|
618
|
+
|
619
|
+
/**
|
620
|
+
* @brief Setting a new buffer.
|
621
|
+
* @param s The string to use as a new sequence.
|
622
|
+
*
|
623
|
+
* Calls @c rdbuf()->str(s).
|
624
|
+
*/
|
625
|
+
void
|
626
|
+
str(const __string_type& __s)
|
627
|
+
{ _M_stringbuf.str(__s); }
|
628
|
+
};
|
629
|
+
} // namespace std
|
630
|
+
|
631
|
+
#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
|
632
|
+
# define export
|
633
|
+
#endif
|
634
|
+
#ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
|
635
|
+
# include <bits/sstream.tcc>
|
636
|
+
#endif
|
637
|
+
|
638
|
+
#endif
|