Debian Codegraph @

headers/sstream

raw
1 /* Copyright (C) 2015 Povilas Kanapickas <[email protected]>
2
3 This file is part of cppreference-doc
4
5 This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
6 Unported License. To view a copy of this license, visit
7 http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
8 Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
9
10 Permission is granted to copy, distribute and/or modify this document
11 under the terms of the GNU Free Documentation License, Version 1.3 or
12 any later version published by the Free Software Foundation; with no
13 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
14 */
15
16 #ifndef CPPREFERENCE_SSTREAM_H
17 #define CPPREFERENCE_SSTREAM_H
18
19 namespace std {
20
21 template <
22 class CharT,
23 class Traits = std::char_traits<CharT>,
24 class Allocator = std::allocator<CharT>
25 > class basic_stringbuf : public std::basic_streambuf<CharT, Traits> {
26 public:
27
28 #if CPPREFERENCE_STDVER>= 2011
29 typedef Allocator allocator_type;
30 #endif
31
32 explicit basic_stringbuf(std::ios_base::openmode which = std::ios_base::in
33 | std::ios_base::out);
34
35 explicit basic_stringbuf(const std::basic_string<CharT, traits, Allocator>& new_str,
36 std::ios_base::openmode which = std::ios_base::in
37 | std::ios_base::out);
38 #if CPPREFERENCE_STDVER>= 2011
39 basic_stringbuf(const basic_stringbuf& rhs) = delete;
40 basic_stringbuf(basic_stringbuf&& rhs);
41 std::basic_stringbuf& operator=(std::basic_stringbuf&& rhs);
42 std::basic_stringbuf& operator=(const std::basic_stringbuf& rhs) = delete;
43 void swap(std::basic_stringbuf& rhs);
44 #endif
45
46 virtual ~basic_stringbuf();
47
48 std::basic_string<CharT, Traits, Allocator> str() const;
49 void str(const std::basic_string<CharT, Traits, Allocator>& s);
50
51 protected:
52 virtual int_type underflow();
53 virtual int_type pbackfail(int_type c = Traits_type::eof());
54 virtual int_type overflow(int_type c = Traits_type::eof());
55 virtual basic_streambuf<CharT, Traits>* setbuf(char_type* s, streamsize n);
56 virtual pos_type seekoff(off_type off, ios_base::seekdir dir,
57 ios_base::openmode which = ios_base::in | ios_base::out);
58 virtual pos_type seekpos(pos_type pos,
59 ios_base::openmode which = ios_base::in | ios_base::out);
60 };
61
62 #if CPPREFERENCE_STDVER>= 2011
63 template<class CharT, class Traits, class Allocator>
64 void swap(std::basic_stringbuf<CharT, Traits, Allocator>& lhs,
65 std::basic_stringbuf<CharT, Traits, Allocator>& rhs);
66 #endif
67
68 typedef basic_stringbuf<char> stringbuf;
69 typedef basic_stringbuf<wchar_t> wstringbuf;
70
71 template <
72 class CharT,
73 class Traits = std::char_traits<CharT>,
74 class Allocator = std::allocator<CharT>
75 > class basic_stringstream : public std::basic_iostream<CharT, Traits> {
76 public:
77
78 #if CPPREFERENCE_STDVER>= 2011
79 typedef Allocator allocator_type;
80 #endif
81
82 explicit basic_stringstream(ios_base::openmode mode = ios_base::in | ios_base::out);
83 explicit basic_stringstream(const std::basic_string<CharT, Traits, Allocator>& str,
84 ios_base::openmode mode = ios_base::in | ios_base::out);
85 #if CPPREFERENCE_STDVER>= 2011
86 basic_stringstream(basic_stringstream&& other);
87 basic_stringstream& operator=(basic_stringstream&& other);
88
89 void swap(basic_stringstream& other);
90 #endif
91 std::basic_stringbuf<CharT, Traits>* rdbuf() const;
92
93 std::basic_string<CharT, Traits, Allocator> str() const;
94 void str(const std::basic_string<CharT, Traits, Allocator>& new_str);
95 };
96
97 #if CPPREFERENCE_STDVER>= 2011
98 template<class CharT, class Traits, class Allocator>
99 void swap(std::basic_stringstream<CharT, Traits, Allocator>& lhs,
100 std::basic_stringstream<CharT, Traits, Allocator>& rhs);
101 #endif
102
103 typedef basic_stringstream<char> stringstream;
104 typedef basic_stringstream<wchar_t> wstringstream;
105
106 template <
107 class CharT,
108 class Traits = std::char_traits<CharT>,
109 class Allocator = std::allocator<CharT>
110 > class basic_istringstream : public std::basic_ostream<CharT, Traits> {
111 public:
112
113 #if CPPREFERENCE_STDVER>= 2011
114 typedef Allocator allocator_type;
115 #endif
116
117 explicit basic_istringstream(ios_base::openmode mode = ios_base::in);
118 explicit basic_istringstream(const std::basic_string<CharT, Traits, Allocator>& str,
119 ios_base::openmode mode = ios_base::in);
120 #if CPPREFERENCE_STDVER>= 2011
121 basic_istringstream(basic_istringstream&& other);
122 basic_istringstream& operator=(basic_istringstream&& other);
123
124 void swap(basic_istringstream& other);
125 #endif
126 std::basic_stringbuf<CharT, Traits>* rdbuf() const;
127
128 std::basic_string<CharT, Traits, Allocator> str() const;
129 void str(const std::basic_string<CharT, Traits, Allocator>& new_str);
130 };
131
132 typedef basic_istringstream<char> istringstream;
133 typedef basic_istringstream<wchar_t> wistringstream;
134
135 #if CPPREFERENCE_STDVER>= 2011
136 template<class CharT, class Traits, class Allocator>
137 void swap(std::basic_istringstream<CharT, Traits, Allocator>& lhs,
138 std::basic_istringstream<CharT, Traits, Allocator>& rhs);
139 #endif
140
141 template <
142 class CharT,
143 class Traits = std::char_traits<CharT>,
144 class Allocator = std::allocator<CharT>
145 > class basic_ostringstream : public std::basic_ostream<CharT, Traits> {
146 public:
147
148 #if CPPREFERENCE_STDVER>= 2011
149 typedef Allocator allocator_type;
150 #endif
151
152 explicit basic_ostringstream(ios_base::openmode mode = ios_base::out);
153 explicit basic_ostringstream(const std::basic_string<CharT, Traits, Allocator>& str,
154 ios_base::openmode mode = ios_base::out);
155 #if CPPREFERENCE_STDVER>= 2011
156 basic_ostringstream(basic_ostringstream&& other);
157 basic_ostringstream& operator=(basic_ostringstream&& other);
158
159 void swap(basic_ostringstream& other);
160 #endif
161 std::basic_stringbuf<CharT, Traits>* rdbuf() const;
162
163 std::basic_string<CharT, Traits, Allocator> str() const;
164 void str(const std::basic_string<CharT, Traits, Allocator>& new_str);
165 };
166
167 #if CPPREFERENCE_STDVER>= 2011
168 template<class CharT, class Traits, class Allocator>
169 void swap(std::basic_ostringstream<CharT, Traits, Allocator>& lhs,
170 std::basic_ostringstream<CharT, Traits, Allocator>& rhs);
171 #endif
172
173 typedef basic_ostringstream<char> ostringstream;
174 typedef basic_ostringstream<wchar_t> wostringstream;
175
176 } // namespace std
177
178 #endif // CPPREFERENCE_SSTREAM_H