📄 streambu.html
字号:
<P>The member function returns a pointer just past the end of the<A HREF="#input buffer">input buffer</A>.</P><H3><A NAME="streambuf::epptr"><CODE>streambuf::epptr</CODE></A></H3><PRE>char_type *<B>epptr</B>() const;</PRE><P>The member function returns a pointer just past the end of the<A HREF="#output buffer">output buffer</A>.</P><H3><A NAME="streambuf::gbump"><CODE>streambuf::gbump</CODE></A></H3><PRE>void <B>gbump</B>(int count);</PRE><P>The member function adds <CODE>count</CODE> to the next pointer for the<A HREF="#input buffer">input buffer</A>.</P><H3><A NAME="streambuf::getloc"><CODE>streambuf::getloc</CODE></A></H3><PRE>locale <B>getloc</B>() const;</PRE><P>The member function returns the stored locale object.</P><H3><A NAME="streambuf::gptr"><CODE>streambuf::gptr</CODE></A></H3><PRE>char_type *<B>gptr</B>() const;</PRE><P>The member function returns a pointer to the next element of the<A HREF="#input buffer">input buffer</A>.</P><H3><A NAME="streambuf::imbue"><CODE>streambuf::imbue</CODE></A></H3><PRE>virtual void <B>imbue</B>(const locale &loc);</PRE><P>The default behavior is to do nothing.</P><H3><A NAME="streambuf::in_avail"><CODE>streambuf::in_avail</CODE></A></H3><PRE>streamsize <B>in_avail</B>();</PRE><P>If a <A HREF="#read position">read position</A> is available,the member function returns<CODE><A HREF="#streambuf::egptr">egptr</A>() -<A HREF="#streambuf::gptr">gptr</A>()</CODE>.Otherwise, it returns<CODE><A HREF="#streambuf::showmanyc">showmanyc</A>()</CODE>.</P><H3><A NAME="streambuf::int_type"><CODE>streambuf::int_type</CODE></A></H3><PRE>typedef traits_type::int_type <B>int_type</B>;</PRE><P>The type is a synonym for<CODE>traits_type::<A HREF="string2.html#char_traits::int_type">int_type</A></CODE>.</P><H3><A NAME="streambuf::off_type"><CODE>streambuf::off_type</CODE></A></H3><PRE>typedef traits_type::off_type <B>off_type</B>;</PRE><P>The type is a synonym for<CODE>traits_type::<A HREF="string2.html#char_traits::off_type">off_type</A></CODE>.</P><H3><A NAME="streambuf::overflow"><CODE>streambuf::overflow</CODE></A></H3><PRE>virtual int_type <B>overflow</B>(int_type meta = traits_type::eof());</PRE><P>If <CODE>meta</CODE> does not compare equal to<CODE>traits_type::<A HREF="string2.html#char_traits::eof">eof</A>()</CODE>,the protected virtual member function endeavors to insert the element<CODE>traits_type:: <A HREF="string2.html#char_traits::to_char_type">to_char_type</A>(meta)</CODE>into the output stream. It can do so in various ways:</P><UL><LI>If a <A HREF="#write position">write position</A> is available,it can store the element into the write position and increment thenext pointer for the<A HREF="#output buffer">output buffer</A>.<LI>It can make a write position available by allocatingnew or additional storage for the output buffer.<LI>It can make a write position available by writing out, to someexternal destination, some or all of the elementsbetween the beginning and next pointers for the output buffer.</UL><P>If the function cannot succeed, it returns<CODE>traits_type::eof()</CODE> or throws an exception.Otherwise, it returns<CODE>traits_type::<A HREF="string2.html#char_traits::not_eof">not_eof</A>(meta)</CODE>.The default behavior is to return <CODE>traits_type::eof()</CODE>.</P><H3><A NAME="streambuf::pbackfail"><CODE>streambuf::pbackfail</CODE></A></H3><PRE>virtual int_type <B>pbackfail</B>(int_type meta = traits_type::eof());</PRE><P>The protected virtual member function endeavors to put back an elementinto the input stream, then make it the current element (pointed toby the next pointer).If <CODE>meta</CODE> compares equal to<CODE>traits_type::<A HREF="string2.html#char_traits::eof">eof</A>()</CODE>,the element to push back is effectively the one already in the streambefore the current element. Otherwise, that element is replaced by<CODE>traits_type::<A HREF="string2.html#char_traits::to_char_type">to_char_type</A>(meta)</CODE>.The function can put back an element in various ways:</P><UL><LI>If a <A HREF="#putback position">putback position</A> is available,it can store the element into the putback position and decrement thenext pointer for the<A HREF="#input buffer">input buffer</A>.<LI>It can make a putback position available by allocatingnew or additional storage for the input buffer.<LI>For a stream buffer with common input and output streams,it can make a putback position available by writing out, to someexternal destination, some or all of the elementsbetween the beginning and next pointers for the output buffer.</UL><P>If the function cannot succeed, it returns<CODE>traits_type::eof()</CODE> or throws an exception. Otherwise,it returns some other value.The default behavior is to return <CODE>traits_type::eof()</CODE>.</P><H3><A NAME="streambuf::pbase"><CODE>streambuf::pbase</CODE></A></H3><PRE>char_type *<B>pbase</B>() const;</PRE><P>The member function returns a pointer to the beginning of the<A HREF="#output buffer">output buffer</A>.</P><H3><A NAME="streambuf::pbump"><CODE>streambuf::pbump</CODE></A></H3><PRE>void <B>pbump</B>(int count);</PRE><P>The member function adds <CODE>count</CODE> to the next pointer for the<A HREF="#output buffer">output buffer</A>.</P><H3><A NAME="streambuf::pos_type"><CODE>streambuf::pos_type</CODE></A></H3><PRE>typedef traits_type::pos_type <B>pos_type</B>;</PRE><P>The type is a synonym for<CODE>traits_type::<A HREF="string2.html#char_traits::pos_type">pos_type</A></CODE>.</P><H3><A NAME="streambuf::pptr"><CODE>streambuf::pptr</CODE></A></H3><PRE>char_type *<B>pptr</B>() const;</PRE><P>The member function returns a pointer to the next element of the<A HREF="#output buffer">output buffer</A>.</P><H3><A NAME="streambuf::pubimbue"><CODE>streambuf::pubimbue</CODE></A></H3><PRE>locale <B>pubimbue</B>(const locale& loc);</PRE><P>The member function stores <CODE>loc</CODE> in thelocale object, calls<CODE><A HREF="#streambuf::imbue">imbue</A>()</CODE>,then returns the previous value stored in the locale object.</P><H3><A NAME="streambuf::pubseekoff"><CODE>streambuf::pubseekoff</CODE></A></H3><PRE>pos_type <B>pubseekoff</B>(off_type off, ios_base::seekdir way, ios_base::openmode which = ios_base::in | ios_base::out);</PRE><P>The member function returns<CODE><A HREF="#streambuf::seekoff">seekoff</A>(off, way,which)</CODE>.</P><H3><A NAME="streambuf::pubseekpos"><CODE>streambuf::pubseekpos</CODE></A></H3><PRE>pos_type <B>pubseekpos</B>(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out);</PRE><P>The member function returns<CODE><A HREF="#streambuf::seekpos">seekpos</A>(sp, which)</CODE>.</P><H3><A NAME="streambuf::pubsetbuf"><CODE>streambuf::pubsetbuf</CODE></A></H3><PRE>streambuf *<B>pubsetbuf</B>(char_type *buffer, streamsize count);</PRE><P>The member function returns<CODE><A HREF="#streambuf::setbuf">setbuf</A>(buffer, count)</CODE>.</P><H3><A NAME="streambuf::pubsync"><CODE>streambuf::pubsync</CODE></A></H3><PRE>int <B>pubsync</B>();</PRE><P>The member function returns<CODE><A HREF="#streambuf::sync">sync</A>()</CODE>.</P><H3><A NAME="streambuf::sbumpc"><CODE>streambuf::sbumpc</CODE></A></H3><PRE>int_type <B>sbumpc</B>();</PRE><P>If a <A HREF="#read position">read position</A> is available,the member function returns<CODE>traits_type::<A HREF="string2.html#char_traits::to_int_type">to_int_type</A>(*<A HREF="#streambuf::gptr">gptr</A>())</CODE>and increments the next pointer for the<A HREF="#input buffer">input buffer</A>.Otherwise, it returns<CODE><A HREF="#streambuf::uflow">uflow</A>()</CODE>.</P><H3><A NAME="streambuf::seekoff"><CODE>streambuf::seekoff</CODE></A></H3><PRE>virtual pos_type <B>seekoff</B>(off_type off, ios_base::seekdir way, ios_base::openmode which = ios_base::in | ios_base::out);</PRE><P>The protected virtual member function endeavors to alter the currentpositions for the controlled streams. The new position is determinedas follows:</P><UL><LI>If <CODE>way ==ios_base::<A HREF="ios.html#ios_base::beg">beg</A></CODE>,the new position is the beginning of the stream plus <CODE>off</CODE>.<LI>If <CODE>way ==ios_base::<A HREF="ios.html#ios_base::cur">cur</A></CODE>,the new position is the current stream position plus <CODE>off</CODE>.<LI>If <CODE>way ==ios_base::<A HREF="ios.html#ios_base::end">end</A></CODE>,the new position is the end of the stream plus <CODE>off</CODE>.</UL><P>Typically, if<CODE>which & ios_base::in</CODE> is nonzero,the input stream is affected, and if <CODE>which & ios_base::out</CODE>is nonzero, the output stream is affected. Actual use of this parametervaries among derived stream buffers, however.</P><P>If the function succeeds in altering the stream position(s),it returns the resultant stream position (or one of them).Otherwise, it returns an invalid stream position.The default behavior is to return an invalid stream position.</P><H3><A NAME="streambuf::seekpos"><CODE>streambuf::seekpos</CODE></A></H3><PRE>virtual pos_type <B>seekpos</B>(pos_type sp, ios_base::openmode which = ios_base::in | ios_base::out);</PRE><P>The protected virtual member function endeavors to alter the current
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -