46 lines
2.8 KiB
Markdown
46 lines
2.8 KiB
Markdown
[spanbuf.general]
|
||
|
||
# 31 Input/output library [[input.output]](./#input.output)
|
||
|
||
## 31.9 Span-based streams [[span.streams]](span.streams#spanbuf.general)
|
||
|
||
### 31.9.3 Class template basic_spanbuf [[spanbuf]](spanbuf#general)
|
||
|
||
#### 31.9.3.1 General [spanbuf.general]
|
||
|
||
[ð](#lib:basic_spanbuf)
|
||
|
||
namespace std {template<class charT, class traits = char_traits<charT>>class basic_spanbuf : public basic_streambuf<charT, traits> {public:using char_type = charT; using int_type = typename traits::int_type; using pos_type = typename traits::pos_type; using off_type = typename traits::off_type; using traits_type = traits; // [[spanbuf.cons]](spanbuf.cons "31.9.3.2 Constructors"), constructors basic_spanbuf() : basic_spanbuf(ios_base::in | ios_base::out) {}explicit basic_spanbuf(ios_base::openmode which): basic_spanbuf(std::span<charT>(), which) {}explicit basic_spanbuf(std::span<charT> s,
|
||
ios_base::openmode which = ios_base::in | ios_base::out);
|
||
basic_spanbuf(const basic_spanbuf&) = delete;
|
||
basic_spanbuf(basic_spanbuf&& rhs); // [[spanbuf.assign]](spanbuf.assign "31.9.3.3 Assignment and swap"), assignment and swap basic_spanbuf& operator=(const basic_spanbuf&) = delete;
|
||
basic_spanbuf& operator=(basic_spanbuf&& rhs); void swap(basic_spanbuf& rhs); // [[spanbuf.members]](spanbuf.members "31.9.3.4 Member functions"), member functions std::span<charT> span() const noexcept; void span(std::span<charT> s) noexcept; protected:// [[spanbuf.virtuals]](spanbuf.virtuals "31.9.3.5 Overridden virtual functions"), overridden virtual functions basic_streambuf<charT, traits>* setbuf(charT*, streamsize) override;
|
||
pos_type seekoff(off_type off, ios_base::seekdir way,
|
||
ios_base::openmode which = ios_base::in | ios_base::out) override;
|
||
pos_type seekpos(pos_type sp,
|
||
ios_base::openmode which = ios_base::in | ios_base::out) override; private: ios_base::openmode *mode*; // *exposition only* std::span<charT> *buf*; // *exposition only*};}
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L10120)
|
||
|
||
The class template basic_spanbuf is derived from basic_streambuf to associate possibly the input sequence and possibly the output sequence
|
||
with a sequence of arbitrary characters[.](#1.sentence-1)
|
||
|
||
The sequence is provided by an object of class span<charT>[.](#1.sentence-2)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L10126)
|
||
|
||
For the sake of exposition, the maintained data is presented here as:
|
||
|
||
- [(2.1)](#2.1)
|
||
|
||
ios_base::openmode *mode*, hasin set if the input sequence can be read, andout set if the output sequence can be written[.](#2.1.sentence-1)
|
||
|
||
- [(2.2)](#2.2)
|
||
|
||
std::span<charT> *buf* is the view to
|
||
the underlying character sequence[.](#2.2.sentence-1)
|