📄 iistrbuf.htm
字号:
<html>
<head>
<title>istreambuf_iterator</title>
<head>
<body bgcolor="#FFFFFF">
<a name="here"></a>
<img src="iisbfban.gif">
<pre>
<font size=5>Class Name</font> istreambuf_iterator
<font size=5>Header File</font> <iterator>
<font size=5>Classification</font> abstract data type
</pre>
<a href="iistrbuf.htm#crd">Class Relationship Diagram</a><br>
<br>
<a href="iistrbuf.htm#class-descrip">Class Description</a>
<h1>Member Classes</h1>
<a href="iistrbuf.htm#streambuf">streambuf_type*</a>
<a href="iistrbuf.htm#proxy">proxy</a>
<h1>Methods</h1>
<pre>
<a href="iistrbuf.htm#equal">bool equal(istreambuf_iterator& b);</a>
<a href="iistrbuf.htm#istreambuf1">istreambuf_iterator() throw();</a>
<a href="iistrbuf.htm#istreambuf2">istreambuf_iterator(istream_type& s);</a>
<a href="iistrbuf.htm#istreambuf3">istreambuf_iterator(streambuf_type& s);</a>
<a href="iistrbuf.htm#istreambuf4">istreambuf_iterator(const proxy& p) throw();</a>
</pre>
<h1>Operators</h1>
<pre>
<a href="iistrbuf.htm#operator*">istreambuf_iterator<T,charT,traits>& operator*();</a>
<a href="iistrbuf.htm#operator++1">istreambuf_iterator<T,charT,traits>& operator++();</a>
<a href="iistrbuf.htm#operator++2">istreambuf_iterator<T,charT,traits>& operator++(int);</a>
</pre>
<hr>
<a name="class-descrip"><h3>Class Description</h3>
<p>
The istreambuf_iterator is a <a href="defines.htm#buffer">stream buffer iterator</a>. The istreambuf_iterator class is a low level istream_iterator. Characters of
charT are successively read from an input streambuf in a single direction.
Only one pass is made over the data. An end-of-stream iterator object is
created when an istreambuf_iterator object is constructed using the
constructors istreambuf_iterator() or istreambuf_iterator(0) .
The end-of-stream is reached when streambuf_type::sgetc() returns
traits::eof(). At this point, the istreambuf_iterator is equal to an
end-of-stream iterator value. Any two end-of-stream iterators are always
equal. When the iterator object is incremented using the operator++ and
evaluated (dereferenced or copied), the iterator points to the next input
character of type charT. operator* accesses the current input character.
Note: The result of operator * on an end-of-stream is not defined. The
operator++ is not equality-preserving. If i == j, there is no guarantee
that when i and j are incremented they will still be equal (++i != ++j).
A new value is used every time operator++ is evaluated.
</p>
<hr>
<a name="streambuf"><h3>streambuf_type</h3></a>
<p>
The streambuf serves as the input stream type charT values are extracted.
</p>
<hr>
<a name="proxy"><h3>proxy</h3></a>
<p>
The proxy class is for exposition only. It provides a temporary holding place
for the return value of the post-increment operator(operator++). It holds the
character pointed to by the previous value of the iterator in order to
retrieve the character in the future.
</p>
<hr>
<pre>
<a name="istreambuf1">
Method istreambuf_iterator()</a>
Access Public
Classification Constructor
Syntax istream_iterator() throw();
Parameters None
Returns None
</pre>
<h3>Description</h3>
<p>
This constructor constructs an end-of-stream iterator object.
</p>
<hr>
<pre>
<a name="istreambuf2">
Method istreambuf_iterator()</a>
Access Public
Classification Constructor
Syntax istreambuf_iterator(istream_type& s) throw();
Parameters <em>s</em> is a reference to istream_type in which istream_type's
streambuf serves as the input stream type charT values
are extracted.
Returns None
</pre>
<h3>Description</h3>
<p>
This constructor constructs an istreambuf_iterator object that extracts a
value of type charT from the input stream specified by <em>s</em>' streambuf.
</p>
<hr>
<a name="istreambuf3">
<pre>
Method istreambuf_iterator()</a>
Access Public
Classification Constructor
Syntax istreambuf_iterator(streambuf_type* s) throw();
Parameters <em>s</em> is a pointer to streambuf_type in which
streambuf_types's streambuf or *(s.rdbuf()) serves
as the input stream type charT values are extracted.
Returns None
</pre>
<h3>Description</h3>
<p>
This constructor constructs an istreambuf_iterator object that extracts
a value of type charT from the input stream specified by <em>s</em>'
streambuf. An end-of-stream object is constructed if s.rdbuf() is null.
</p>
<hr>
<pre>
<a name="istreambuf4">
Method istreambuf_iterator()</a>
Access Public
Classification Constructor
Syntax istreambuf_iterator(const proxy& p) throw();
Parameters <em>p</em> is a reference to const proxy in which proxy's
streambuf serves as the input stream type charT
values are extracted.
Returns None
</pre>
<h3>Description</h3>
<p>
This constructor constructs an istreambuf_iterator object that extracts a
value of type charT from the input stream specified by <em>p</em>'s
streambuf. proxy is an implementation defined helper type. When a value is
returned by operator++(int), post incrementation operator, proxy serves as
a temporary placeholder by keeping the character pointed to by the previous
value of the iterator so in the future that character can be accessed.
</p>
<hr>
<pre>
<a name="operator*">
Method operator*()</a>
Access Public
Classification Accessor
Syntax charT operator*() const;
Parameters None
Returns This operator returns the character extracted from
the streambuf by the member sbuf_->sgetc(). It is
not defined what will be returned if the dereference
operator is used on an end-of-stream value.
</pre>
<h3>Description</h3>
<p>
The dereferene operator dereferences a const iterator object and returns
the current input character.
</p>
<hr>
<pre>
<a name="operator++1">
Method operator++()</a>
Access Public
Classification Accessor
Syntax istreambuf_iterator<charT,traits>&
istreambuf_iterator<charT,traits>::operator++();
Returns This method returns a pointer to the current object.
</pre>
<h3>Description</h3>
<p>
The prefix incrementation operator extracts a value of type
charT and returns *this. This method effects sbuf_->sbumpc().
</p>
<hr>
<pre>
<a name="operator++2">
Method operator++()</a>
Access Public
Classification Accessor
Syntax proxy istreambuf_iterator<charT,traits>operator++(int x);
Parameters <em>x</em> has no effect on the behavior of this method.
Returns proxy serves as a temporary placeholder by keeping the
character pointed to by the previous value of the
iterator so in the future that character can be
accessed.
</pre>
<h3>Description</h3>
<p>
The postfix incrementation operator makes a copy of the object. The
streambuf pointer is advanced, and the copy is returned. This method
effects proxy(sbuf_->sbumpc(), sbuf_).
</p>
<hr>
<pre>
<a name="equal">
Method equal()</a>
Access Public
Classification Accessor
Syntax bool equal(istreambuf_iterator<charT,traits>& b);
Parameters <em>b</em> is a reference to the istreambuf_iterator object
that *this is compared for equality.
Returns This method returns true if and only if both
iterators are at the end-of-stream or neither are
at the end-of-stream.
</pre>
<h3>Description</h3>
<p>
The equal() method determines the equality of the object and an
istreambuf_iterator. Regardless of what type of streambuf object is used by
the iterators, the returned bool will be true if and only if both iterators are at the end-of-stream or neither
are at the end-of-stream.
</p>
<hr>
<a name="crd"><h2>The Class Relationship Diagram for istreambuf_iterator</h2></a>
<img src="iistrbuf.gif">
<hr>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -