Init
This commit is contained in:
102
cppdraft/streambuf/virt/buffer.md
Normal file
102
cppdraft/streambuf/virt/buffer.md
Normal file
@@ -0,0 +1,102 @@
|
||||
[streambuf.virt.buffer]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.6 Stream buffers [[stream.buffers]](stream.buffers#streambuf.virt.buffer)
|
||||
|
||||
### 31.6.3 Class template basic_streambuf [[streambuf]](streambuf#virt.buffer)
|
||||
|
||||
#### 31.6.3.5 Virtual functions [[streambuf.virtuals]](streambuf.virtuals#streambuf.virt.buffer)
|
||||
|
||||
#### 31.6.3.5.2 Buffer management and positioning [streambuf.virt.buffer]
|
||||
|
||||
[ð](#lib:setbuf,basic_streambuf)
|
||||
|
||||
`basic_streambuf* setbuf(char_type* s, streamsize n);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3619)
|
||||
|
||||
*Effects*: Influences stream buffering in a way that is defined separately for each class
|
||||
derived frombasic_streambuf in this Clause ([[stringbuf.virtuals]](stringbuf.virtuals "31.8.2.5 Overridden virtual functions"), [[filebuf.virtuals]](filebuf.virtuals "31.10.3.5 Overridden virtual functions"))[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3626)
|
||||
|
||||
*Default behavior*: Does nothing[.](#2.sentence-1)
|
||||
|
||||
Returnsthis[.](#2.sentence-2)
|
||||
|
||||
[ð](#lib:seekoff,basic_streambuf)
|
||||
|
||||
`pos_type seekoff(off_type off, ios_base::seekdir way,
|
||||
ios_base::openmode which
|
||||
= ios_base::in | ios_base::out);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3641)
|
||||
|
||||
*Effects*: Alters the stream positions within one or more of
|
||||
the controlled sequences in a way that is defined separately for each class
|
||||
derived frombasic_streambuf in this Clause ([[stringbuf.virtuals]](stringbuf.virtuals "31.8.2.5 Overridden virtual functions"), [[filebuf.virtuals]](filebuf.virtuals "31.10.3.5 Overridden virtual functions"))[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3649)
|
||||
|
||||
*Default behavior*: Returnspos_type(off_type(-1))[.](#4.sentence-1)
|
||||
|
||||
[ð](#lib:seekpos,basic_streambuf)
|
||||
|
||||
`pos_type seekpos(pos_type sp,
|
||||
ios_base::openmode which
|
||||
= ios_base::in | ios_base::out);
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3663)
|
||||
|
||||
*Effects*: Alters the stream positions within one or more of
|
||||
the controlled sequences in a way that is defined separately for each class
|
||||
derived frombasic_streambuf in this Clause ([[stringbuf]](stringbuf "31.8.2 Class template basic_stringbuf"), [[filebuf]](filebuf "31.10.3 Class template basic_filebuf"))[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3671)
|
||||
|
||||
*Default behavior*: Returnspos_type(off_type(-1))[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:sync,basic_streambuf)
|
||||
|
||||
`int sync();
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3683)
|
||||
|
||||
*Effects*: Synchronizes the controlled sequences with the arrays[.](#7.sentence-1)
|
||||
|
||||
That is, ifpbase() is non-null the characters betweenpbase() andpptr() are written to the controlled sequence[.](#7.sentence-2)
|
||||
|
||||
The pointers may then be reset as appropriate[.](#7.sentence-3)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3695)
|
||||
|
||||
*Returns*: -1 on failure[.](#8.sentence-1)
|
||||
|
||||
What constitutes failure is determined by each derived class ([[filebuf.virtuals]](filebuf.virtuals "31.10.3.5 Overridden virtual functions"))[.](#8.sentence-2)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3700)
|
||||
|
||||
*Default behavior*: Returns zero[.](#9.sentence-1)
|
||||
204
cppdraft/streambuf/virt/get.md
Normal file
204
cppdraft/streambuf/virt/get.md
Normal file
@@ -0,0 +1,204 @@
|
||||
[streambuf.virt.get]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.6 Stream buffers [[stream.buffers]](stream.buffers#streambuf.virt.get)
|
||||
|
||||
### 31.6.3 Class template basic_streambuf [[streambuf]](streambuf#virt.get)
|
||||
|
||||
#### 31.6.3.5 Virtual functions [[streambuf.virtuals]](streambuf.virtuals#streambuf.virt.get)
|
||||
|
||||
#### 31.6.3.5.3 Get area [streambuf.virt.get]
|
||||
|
||||
[ð](#lib:showmanyc,basic_streambuf)
|
||||
|
||||
`streamsize showmanyc();[267](#footnote-267 "The morphemes of showmanyc are âes-how-many-seeâ, not âshow-manicâ.")
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3716)
|
||||
|
||||
*Returns*: An estimate of the number of
|
||||
characters available in the sequence, or â1[.](#1.sentence-1)
|
||||
|
||||
If it returns
|
||||
a positive value, then successive calls tounderflow() will not returntraits::eof() until at least that number of characters have been
|
||||
extracted from the stream[.](#1.sentence-2)
|
||||
|
||||
Ifshowmanyc() returns â1, then calls tounderflow() oruflow() will fail[.](#1.sentence-3)[268](#footnote-268 "underflow or uflow can fail by throwing an exception prematurely. The intention is not only that the calls will not return eof() but that they will return âimmediatelyâ.")
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3744)
|
||||
|
||||
*Default behavior*: Returns zero[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3748)
|
||||
|
||||
*Remarks*: Usestraits::eof()[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:xsgetn,basic_streambuf)
|
||||
|
||||
`streamsize xsgetn(char_type* s, streamsize n);
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3760)
|
||||
|
||||
*Effects*: Assigns up to n characters to successive elements of
|
||||
the array whose first element is designated by s[.](#4.sentence-1)
|
||||
|
||||
The characters assigned are read from the input sequence as if
|
||||
by repeated calls tosbumpc()[.](#4.sentence-2)
|
||||
|
||||
Assigning stops when either n characters
|
||||
have been assigned or a call tosbumpc() would returntraits::eof()[.](#4.sentence-3)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3773)
|
||||
|
||||
*Returns*: The number of characters assigned[.](#5.sentence-1)[269](#footnote-269 "Classes derived from basic_streambuf can provide more efficient ways to implement xsgetn() and xsputn() by overriding these definitions from the base class.")
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3786)
|
||||
|
||||
*Remarks*: Usestraits::eof()[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:underflow,basic_streambuf)
|
||||
|
||||
`int_type underflow();
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3798)
|
||||
|
||||
The[*pending sequence*](#def:pending_sequence) of characters is defined as the concatenation of
|
||||
|
||||
- [(7.1)](#7.1)
|
||||
|
||||
the empty sequence if gptr() is null, otherwise the
|
||||
characters in
|
||||
[gptr(), egptr()),
|
||||
followed by
|
||||
|
||||
- [(7.2)](#7.2)
|
||||
|
||||
some (possibly empty) sequence of characters read from the input sequence[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3811)
|
||||
|
||||
The[*result character*](#def:result_character) is
|
||||
the first character of the pending sequence if it is non-empty,
|
||||
otherwise
|
||||
the next character that would be read from the input sequence[.](#8.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3819)
|
||||
|
||||
The[*backup sequence*](#def:backup_sequence) is the empty sequence if eback() is null, otherwise the
|
||||
characters in
|
||||
[eback(), gptr())[.](#9.sentence-1)
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3826)
|
||||
|
||||
*Effects*: The function sets up thegptr() andegptr() such that
|
||||
if the pending sequence is non-empty, thenegptr() is non-null and
|
||||
the characters in [gptr(), egptr()) are
|
||||
the characters in the pending sequence,
|
||||
otherwise
|
||||
either gptr() is null orgptr() == egptr()[.](#10.sentence-1)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3843)
|
||||
|
||||
Ifeback() andgptr() are non-null then the function is not constrained as to their contents, but the âusual backup conditionâ is that either
|
||||
|
||||
- [(11.1)](#11.1)
|
||||
|
||||
the backup sequence contains at leastgptr() - eback() characters, in which case the characters in
|
||||
[eback(), gptr())
|
||||
agree with the lastgptr() - eback() characters of the backup sequence, or
|
||||
|
||||
- [(11.2)](#11.2)
|
||||
|
||||
the characters in [gptr() - n, gptr())
|
||||
agree with the backup sequence (where n is the length of the backup sequence)[.](#11.sentence-1)
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3863)
|
||||
|
||||
*Returns*: traits::to_int_type(c),
|
||||
where c is the first*character* of the[*pending sequence*](#def:pending_sequence),
|
||||
without moving the input sequence position past it[.](#12.sentence-1)
|
||||
|
||||
If the pending sequence is null then the function returnstraits::eof() to indicate failure[.](#12.sentence-2)
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3875)
|
||||
|
||||
*Default behavior*: Returnstraits::eof()[.](#13.sentence-1)
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3880)
|
||||
|
||||
*Remarks*: The public members ofbasic_streambuf call this virtual function only ifgptr() is null orgptr() >= egptr()[.](#14.sentence-1)
|
||||
|
||||
[ð](#lib:uflow,basic_streambuf)
|
||||
|
||||
`int_type uflow();
|
||||
`
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3896)
|
||||
|
||||
*Preconditions*: The constraints are the same as forunderflow(),
|
||||
except that the result character is transferred from the pending
|
||||
sequence to the backup sequence, and the pending sequence is not empty before the transfer[.](#15.sentence-1)
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3903)
|
||||
|
||||
*Default behavior*: Callsunderflow()[.](#16.sentence-1)
|
||||
|
||||
Ifunderflow() returnstraits::eof(),
|
||||
returnstraits::eof()[.](#16.sentence-2)
|
||||
|
||||
Otherwise, returns the value oftraits::to_int_type(*gptr()) and increments the value of the next pointer for the input sequence[.](#16.sentence-3)
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3917)
|
||||
|
||||
*Returns*: traits::eof() to indicate failure[.](#17.sentence-1)
|
||||
|
||||
[267)](#footnote-267)[267)](#footnoteref-267)
|
||||
|
||||
The morphemes of showmanyc are âes-how-many-seeâ, not âshow-manicâ[.](#footnote-267.sentence-1)
|
||||
|
||||
[268)](#footnote-268)[268)](#footnoteref-268)
|
||||
|
||||
underflow oruflow can fail by throwing an exception prematurely[.](#footnote-268.sentence-1)
|
||||
|
||||
The intention is not only that the calls will not returneof() but that they will return âimmediatelyâ[.](#footnote-268.sentence-2)
|
||||
|
||||
[269)](#footnote-269)[269)](#footnoteref-269)
|
||||
|
||||
Classes derived frombasic_streambuf can provide more efficient ways to implementxsgetn() andxsputn() by overriding these definitions from the base class[.](#footnote-269.sentence-1)
|
||||
39
cppdraft/streambuf/virt/locales.md
Normal file
39
cppdraft/streambuf/virt/locales.md
Normal file
@@ -0,0 +1,39 @@
|
||||
[streambuf.virt.locales]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.6 Stream buffers [[stream.buffers]](stream.buffers#streambuf.virt.locales)
|
||||
|
||||
### 31.6.3 Class template basic_streambuf [[streambuf]](streambuf#virt.locales)
|
||||
|
||||
#### 31.6.3.5 Virtual functions [[streambuf.virtuals]](streambuf.virtuals#streambuf.virt.locales)
|
||||
|
||||
#### 31.6.3.5.1 Locales [streambuf.virt.locales]
|
||||
|
||||
[ð](#lib:imbue,basic_streambuf)
|
||||
|
||||
`void imbue(const locale&);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3594)
|
||||
|
||||
*Effects*: Change any translations based on locale[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3598)
|
||||
|
||||
*Remarks*: Allows the derived class to be informed of changes in locale at the
|
||||
time they occur[.](#2.sentence-1)
|
||||
|
||||
Between invocations of this function a class derived
|
||||
from streambuf can safely cache results of calls to locale functions
|
||||
and to members of facets so obtained[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3606)
|
||||
|
||||
*Default behavior*: Does nothing[.](#3.sentence-1)
|
||||
72
cppdraft/streambuf/virt/pback.md
Normal file
72
cppdraft/streambuf/virt/pback.md
Normal file
@@ -0,0 +1,72 @@
|
||||
[streambuf.virt.pback]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.6 Stream buffers [[stream.buffers]](stream.buffers#streambuf.virt.pback)
|
||||
|
||||
### 31.6.3 Class template basic_streambuf [[streambuf]](streambuf#virt.pback)
|
||||
|
||||
#### 31.6.3.5 Virtual functions [[streambuf.virtuals]](streambuf.virtuals#streambuf.virt.pback)
|
||||
|
||||
#### 31.6.3.5.4 Putback [streambuf.virt.pback]
|
||||
|
||||
[ð](#lib:pbackfail,basic_streambuf)
|
||||
|
||||
`int_type pbackfail(int_type c = traits::eof());
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3931)
|
||||
|
||||
The[*pending sequence*](#def:pending_sequence) is defined as forunderflow(),
|
||||
with the modifications that
|
||||
|
||||
- [(1.1)](#1.1)
|
||||
|
||||
Iftraits::eq_int_type(c, traits::eof()) returnstrue,
|
||||
then the input sequence is backed up one character before the pending sequence is determined[.](#1.1.sentence-1)
|
||||
|
||||
- [(1.2)](#1.2)
|
||||
|
||||
Iftraits::eq_int_type(c, traits::eof()) returns false, then c is prepended[.](#1.2.sentence-1)
|
||||
Whether the input sequence is backed up or modified in any other way is unspecified[.](#1.2.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3951)
|
||||
|
||||
*Postconditions*: On return, the constraints ofgptr(),eback(),
|
||||
andpptr() are the same as forunderflow()[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3961)
|
||||
|
||||
*Returns*: traits::eof() to indicate failure[.](#3.sentence-1)
|
||||
|
||||
Failure may occur because the input sequence could not be backed up, or if for some
|
||||
other reason the pointers cannot be set consistent with the constraints[.](#3.sentence-2)
|
||||
|
||||
pbackfail() is called only when put back has really failed[.](#3.sentence-3)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3970)
|
||||
|
||||
Returns some value other thantraits::eof() to indicate success[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3975)
|
||||
|
||||
*Default behavior*: Returnstraits::eof()[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L3980)
|
||||
|
||||
*Remarks*: The public functions ofbasic_streambuf call this virtual function only whengptr() is null,gptr() == eback(),
|
||||
ortraits::eq(traits::to_char_type(c), gptr()[-1]) returnsfalse[.](#6.sentence-1)
|
||||
|
||||
Other calls shall also satisfy that constraint[.](#6.sentence-2)
|
||||
121
cppdraft/streambuf/virt/put.md
Normal file
121
cppdraft/streambuf/virt/put.md
Normal file
@@ -0,0 +1,121 @@
|
||||
[streambuf.virt.put]
|
||||
|
||||
# 31 Input/output library [[input.output]](./#input.output)
|
||||
|
||||
## 31.6 Stream buffers [[stream.buffers]](stream.buffers#streambuf.virt.put)
|
||||
|
||||
### 31.6.3 Class template basic_streambuf [[streambuf]](streambuf#virt.put)
|
||||
|
||||
#### 31.6.3.5 Virtual functions [[streambuf.virtuals]](streambuf.virtuals#streambuf.virt.put)
|
||||
|
||||
#### 31.6.3.5.5 Put area [streambuf.virt.put]
|
||||
|
||||
[ð](#lib:xsputn,basic_streambuf)
|
||||
|
||||
`streamsize xsputn(const char_type* s, streamsize n);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L4003)
|
||||
|
||||
*Effects*: Writes up to n characters to the output sequence as if
|
||||
by repeated calls tosputc(c)[.](#1.sentence-1)
|
||||
|
||||
The characters written are obtained from successive elements of
|
||||
the array whose first element is designated by s[.](#1.sentence-2)
|
||||
|
||||
Writing stops when either n characters have been written or
|
||||
a call tosputc(c) would returntraits::eof()[.](#1.sentence-3)
|
||||
|
||||
It is unspecified whether the function calls overflow() when pptr() == epptr() becomes true or whether it achieves the same effects by other means[.](#1.sentence-4)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L4017)
|
||||
|
||||
*Returns*: The number of characters written[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:overflow,basic_streambuf)
|
||||
|
||||
`int_type overflow(int_type c = traits::eof());
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L4028)
|
||||
|
||||
*Effects*: Consumes some initial subsequence of the characters of the[*pending sequence*](#def:pending_sequence)[.](#3.sentence-1)
|
||||
|
||||
The pending sequence is defined as the concatenation of
|
||||
|
||||
- [(3.1)](#3.1)
|
||||
|
||||
the empty sequence if pbase() is null, otherwise thepptr() - pbase() characters beginning atpbase(), followed by
|
||||
|
||||
- [(3.2)](#3.2)
|
||||
|
||||
the empty sequence
|
||||
iftraits::eq_int_type(c, traits::eof()) returnstrue, otherwise the sequence consisting of c[.](#3.sentence-2)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L4047)
|
||||
|
||||
*Preconditions*: Every overriding definition of this virtual function
|
||||
obeys the following constraints:
|
||||
|
||||
- [(4.1)](#4.1)
|
||||
|
||||
The effect of consuming a character on the associated output sequence is
|
||||
specified[.](#4.1.sentence-1)[270](#footnote-270 "That is, for each class derived from a specialization of basic_streambuf in this Clause ([stringbuf], [filebuf]), a specification of how consuming a character effects the associated output sequence is given. There is no requirement on a program-defined class.")
|
||||
|
||||
- [(4.2)](#4.2)
|
||||
|
||||
Letr be the number of characters in the pending sequence not consumed[.](#4.2.sentence-1)
|
||||
Ifr is nonzero thenpbase() andpptr() are set so that:pptr() - pbase() == r and the r characters starting atpbase() are the associated output stream[.](#4.2.sentence-2)
|
||||
In case r is zero (all characters of the pending sequence have been consumed)
|
||||
then eitherpbase() is set tonullptr,
|
||||
orpbase() andpptr() are both set to the same non-null value[.](#4.2.sentence-3)
|
||||
|
||||
- [(4.3)](#4.3)
|
||||
|
||||
The function may fail if either
|
||||
appending some character to the associated output stream fails or
|
||||
if it is unable to establishpbase() andpptr() according to the above rules[.](#4.3.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L4097)
|
||||
|
||||
*Returns*: traits::eof() or throws an exception
|
||||
if the function fails[.](#5.sentence-1)
|
||||
|
||||
Otherwise,
|
||||
returns some value other thantraits::eof() to indicate success[.](#5.sentence-2)[271](#footnote-271 "Typically, overflow returns c to indicate success, except when traits::eq_int_type(c, traits::eof()) returns true, in which case it returns traits::not_eof(c).")
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L4118)
|
||||
|
||||
*Default behavior*: Returnstraits::eof()[.](#6.sentence-1)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L4123)
|
||||
|
||||
*Remarks*: The member functionssputc() andsputn() call this function in case that
|
||||
no room can be found in the put buffer enough to accommodate the
|
||||
argument character sequence[.](#7.sentence-1)
|
||||
|
||||
[270)](#footnote-270)[270)](#footnoteref-270)
|
||||
|
||||
That is, for each class derived from a specialization ofbasic_streambuf in this Clause ([[stringbuf]](stringbuf "31.8.2 Class template basic_stringbuf"), [[filebuf]](filebuf "31.10.3 Class template basic_filebuf")),
|
||||
a specification of how consuming a character effects the associated output sequence is given[.](#footnote-270.sentence-1)
|
||||
|
||||
There is no requirement on a program-defined class[.](#footnote-270.sentence-2)
|
||||
|
||||
[271)](#footnote-271)[271)](#footnoteref-271)
|
||||
|
||||
Typically,overflow returns c to indicate success, except whentraits::eq_int_type(c, traits::eof()) returnstrue,
|
||||
in which case it returnstraits::not_eof(c)[.](#footnote-271.sentence-1)
|
||||
Reference in New Issue
Block a user