⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 streambu.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<HTML><HEAD><TITLE>&lt;streambuf&gt;</TITLE></HEAD><BODY><H1><A NAME="&lt;streambuf&gt;"><CODE>&lt;streambuf&gt;</CODE></A></H1><HR><P>Include the <A HREF="lib_cpp.html#iostreams">iostreams</A>standard header <B><CODE>&lt;streambuf&gt;</CODE></B> to defineclass <CODE><A HREF="#streambuf">streambuf</A></CODE>,which is basic to the operation of the iostreams classes.(This header is typically included for you by anotherof the iostreams headers. You seldom have occasion to include itdirectly.)</P><PRE>        // DECLARATIONSclass <B><A HREF="#streambuf">streambuf</A></B>;        // END OF DECLARATIONS</PRE><H2><A NAME="streambuf"><CODE>streambuf</CODE></A></H2><HR><P><B><CODE><A HREF="#streambuf::streambuf">streambuf</A>&#183; <A HREF="#streambuf::char_type">char_type</A>&#183; <A HREF="#streambuf::eback">eback</A>&#183; <A HREF="#streambuf::egptr">egptr</A>&#183; <A HREF="#streambuf::epptr">epptr</A>&#183; <A HREF="#streambuf::gbump">gbump</A>&#183; <A HREF="#streambuf::getloc">getloc</A>&#183; <A HREF="#streambuf::gptr">gptr</A>&#183; <A HREF="#streambuf::imbue">imbue</A>&#183; <A HREF="#streambuf::in_avail">in_avail</A>&#183; <A HREF="#streambuf::int_type">int_type</A>&#183; <A HREF="#streambuf::off_type">off_type</A>&#183; <A HREF="#streambuf::overflow">overflow</A>&#183; <A HREF="#streambuf::pbackfail">pbackfail</A>&#183; <A HREF="#streambuf::pbase">pbase</A>&#183; <A HREF="#streambuf::pbump">pbump</A>&#183; <A HREF="#streambuf::pos_type">pos_type</A>&#183; <A HREF="#streambuf::pptr">pptr</A>&#183; <A HREF="#streambuf::pubimbue">pubimbue</A>&#183; <A HREF="#streambuf::pubseekoff">pubseekoff</A>&#183; <A HREF="#streambuf::pubseekpos">pubseekpos</A>&#183; <A HREF="#streambuf::pubsetbuf">pubsetbuf</A>&#183; <A HREF="#streambuf::pubsync">pubsync</A>&#183; <A HREF="#streambuf::sbumpc">sbumpc</A>&#183; <A HREF="#streambuf::seekoff">seekoff</A>&#183; <A HREF="#streambuf::seekpos">seekpos</A>&#183; <A HREF="#streambuf::setbuf">setbuf</A>&#183; <A HREF="#streambuf::setg">setg</A>&#183; <A HREF="#streambuf::setp">setp</A>&#183; <A HREF="#streambuf::sgetc">sgetc</A>&#183; <A HREF="#streambuf::sgetn">sgetn</A>&#183; <A HREF="#streambuf::showmanyc">showmanyc</A>&#183; <A HREF="#streambuf::snextc">snextc</A>&#183; <A HREF="#streambuf::sputbackc">sputbackc</A>&#183; <A HREF="#streambuf::sputc">sputc</A>&#183; <A HREF="#streambuf::sputn">sputn</A>&#183; <A HREF="#streambuf::stossc">stossc</A>&#183; <A HREF="#streambuf::sungetc">sungetc</A>&#183; <A HREF="#streambuf::sync">sync</A>&#183; <A HREF="#streambuf::traits_type">traits_type</A>&#183; <A HREF="#streambuf::uflow">uflow</A>&#183; <A HREF="#streambuf::underflow">underflow</A>&#183; <A HREF="#streambuf::xsgetn">xsgetn</A>&#183; <A HREF="#streambuf::xsputn">xsputn</A></CODE></B></P><HR><PRE>class <B>streambuf</B> {public:    typedef char <B><A HREF="#streambuf::char_type">char_type</A></B>;    typedef char_traits <B><A HREF="#streambuf::traits_type">traits_type</A></B>;    typedef traits_type::int_type <B><A HREF="#streambuf::int_type">int_type</A></B>;    typedef traits_type::pos_type <B><A HREF="#streambuf::pos_type">pos_type</A></B>;    typedef traits_type::off_type <B><A HREF="#streambuf::off_type">off_type</A></B>;    virtual <B>~streambuf</B>();    locale <B><A HREF="#streambuf::pubimbue">pubimbue</A></B>(const locale&amp; loc);    locale <B><A HREF="#streambuf::getloc">getloc</A></B>() const;    streambuf *<B><A HREF="#streambuf::pubsetbuf">pubsetbuf</A></B>(char_type *buffer,        streamsize count);    pos_type <B><A HREF="#streambuf::pubseekoff">pubseekoff</A></B>(off_type off,        ios_base::seekdir way,        ios_base::openmode which =            ios_base::in | ios_base::out);    pos_type <B><A HREF="#streambuf::pubseekpos">pubseekpos</A></B>(pos_type sp,        ios_base::openmode which =            ios_base::in | ios_base::out);    int <B><A HREF="#streambuf::pubsync">pubsync</A></B>();    streamsize <B><A HREF="#streambuf::in_avail">in_avail</A></B>();    int_type <B><A HREF="#streambuf::snextc">snextc</A></B>();    int_type <B><A HREF="#streambuf::sbumpc">sbumpc</A></B>();    int_type <B><A HREF="#streambuf::sgetc">sgetc</A></B>();    void <B><A HREF="#streambuf::stossc">stossc</A></B>(); <B>[optional]</B>    streamsize <B><A HREF="#streambuf::sgetn">sgetn</A></B>(char_type *ptr, streamsize count);    int_type <B><A HREF="#streambuf::sputbackc">sputbackc</A></B>(char_type ch);    int_type <B><A HREF="#streambuf::sungetc">sungetc</A></B>();    int_type <B><A HREF="#streambuf::sputc">sputc</A></B>(char_type ch);    streamsize <B><A HREF="#streambuf::sputn">sputn</A></B>(const char_type *ptr, streamsize count);protected:    <B><A HREF="#streambuf::streambuf">streambuf</A></B>();    char_type *<B><A HREF="#streambuf::eback">eback</A></B>() const;    char_type *<B><A HREF="#streambuf::gptr">gptr</A></B>() const;    char_type *<B><A HREF="#streambuf::egptr">egptr</A></B>() const;    void <B><A HREF="#streambuf::gbump">gbump</A></B>(int count);    void <B><A HREF="#streambuf::setg">setg</A></B>(char_type *gbeg,        char_type *gnext, char_type *gend);    char_type *<B><A HREF="#streambuf::pbase">pbase</A></B>() const;    char_type *<B><A HREF="#streambuf::pptr">pptr</A></B>() const;    char_type *<B><A HREF="#streambuf::epptr">epptr</A></B>() const;    void <B><A HREF="#streambuf::pbump">pbump</A></B>(int count);    void <B><A HREF="#streambuf::setp">setp</A></B>(char_type *pbeg, char_type *pend);    virtual void <B><A HREF="#streambuf::imbue">imbue</A></B>(const locale &loc);    virtual streambuf *<B><A HREF="#streambuf::setbuf">setbuf</A></B>(char_type *buffer,        streamsize count);    virtual pos_type <B><A HREF="#streambuf::seekoff">seekoff</A></B>(off_type off,        ios_base::seekdir way,        ios_base::openmode which =            ios_base::in | ios_base::out);    virtual pos_type <B><A HREF="#streambuf::seekpos">seekpos</A></B>(pos_type sp,        ios_base::openmode which =            ios_base::in | ios_base::out);    virtual int <B><A HREF="#streambuf::sync">sync</A></B>();    virtual streamsize <B><A HREF="#streambuf::showmanyc">showmanyc</A></B>();    virtual streamsize <B><A HREF="#streambuf::xsgetn">xsgetn</A></B>(char_type *ptr,        streamsize count);    virtual int_type <B><A HREF="#streambuf::underflow">underflow</A></B>();    virtual int_type <B><A HREF="#streambuf::uflow">uflow</A></B>();    virtual int_type <B><A HREF="#streambuf::pbackfail">pbackfail</A></B>(int_type meta =        traits_type::eof());    virtual streamsize <B><A HREF="#streambuf::xsputn">xsputn</A></B>(const char_type *ptr,        streamsize count);    virtual int_type <B><A HREF="#streambuf::overflow">overflow</A></B>(int_type meta =        traits_type::eof());    };</PRE><P>The class describes an abstract base class for deriving a<B><A NAME="stream buffer">stream buffer</A></B>, which controlsthe transmission of elements to and from a specificrepresentation of a stream. An object of class<CODE>streambuf</CODE> helps controla stream with elements of type <I>char,</I> also known as<CODE><A HREF="#streambuf::char_type">char_type</A></CODE>, whose<A HREF="string2.html#character traits">character traits</A>are determined by the class<CODE><A HREF="string2.html#char_traits">char_traits</A></CODE>,also known as<CODE><A HREF="#streambuf::traits_type">traits_type</A></CODE>.</P><P>Every stream buffer conceptually controlstwo independent streams, in fact, one for extractions (input) and one forinsertions (output). A specific representation may, however, makeeither or both of these streams inaccessible. It typically maintainssome relationship between the two streams.What you insert into the output stream of a<CODE><A HREF="sstream.html#stringbuf">stringbuf</A></CODE>object, for example, is what you later extract from its input stream.And when you position one stream of a<CODE><A HREF="fstream.html#filebuf">filebuf</A></CODE>object, you position the other stream in tandem.</P><P>The public interface to template class<CODE><A HREF="#streambuf">streambuf</A></CODE>supplies the operations common to all stream buffers, howeverspecialized. The protected interface supplies the operationsneeded for a specific representation of a streamto do its work. The protected virtual member functions let youtailor the behavior of a derived stream buffer for a specificrepresentation of a stream. Each of the derived stream buffersin this library describes how it specializes thebehavior of its protected virtual member functions. Documentedhere is the <B>default behavior</B> for the base class,which is often to do nothing.</P><P>The remaining protected memberfunctions control copying to and from any storage supplied tobuffer transmissions to and from streams.An <B><A NAME="input buffer">input buffer</A></B>,for example, is characterized by:</P><UL><LI><CODE><A HREF="#streambuf::eback">eback</A>()</CODE>,a pointer to the beginning of the buffer<LI><CODE><A HREF="#streambuf::gptr">gptr</A>()</CODE>,a pointer to the next element to read<LI><CODE><A HREF="#streambuf::egptr">egptr</A>()</CODE>,a pointer just past the end of the buffer</UL><P>Similarly, an <B><A NAME="output buffer">output buffer</A></B>is characterized by:</P><UL><LI><CODE><A HREF="#streambuf::pbase">pbase</A>()</CODE>,a pointer to the beginning of the buffer<LI><CODE><A HREF="#streambuf::pptr">pptr</A>()</CODE>,a pointer to the next element to write<LI><CODE><A HREF="#streambuf::epptr">epptr</A>()</CODE>,a pointer just past the end of the buffer</UL><P>For any buffer, the protocol is:</P><UL><LI>If the next pointer is null, no buffer exists. Otherwise,all three pointers point into the same sequence. (They canbe safely compared for order.)<LI>For an output buffer, if the next pointer compares lessthan the end pointer, you can store an element at the<B><A NAME="write position">write position</A></B>designated by the next pointer.<LI>For an input buffer, if the next pointer compares lessthan the end pointer, you can read an element at the<B><A NAME="read position">read position</A></B>designated by the next pointer.<LI>For an input buffer, if the beginning pointer compares lessthan the next pointer, you can put back an element at the<B><A NAME="putback position">putback position</A></B>designated by the decremented next pointer.</UL><P>Any protected virtual member functions you write for aclass derived from <CODE>streambuf</CODE>must cooperate in maintaining this protocol.An object of class <CODE>streambuf</CODE>stores the six pointers described above.</P><H3><A NAME="streambuf::streambuf"><CODE>streambuf::streambuf</CODE></A></H3><PRE><B>streambuf</B>();</PRE><P>The protected constructor stores a null pointer in all the pointerscontrolling the<A HREF="#input buffer">input buffer</A> and the<A HREF="#output buffer">output buffer</A>.</P><H3><A NAME="streambuf::char_type"><CODE>streambuf::char_type</CODE></A></H3><PRE>typedef char <B>char_type</B>;</PRE><P>The type is a synonym for <I>char.</I></P><H3><A NAME="streambuf::eback"><CODE>streambuf::eback</CODE></A></H3><PRE>char_type *<B>eback</B>() const;</PRE><P>The member function returns a pointer to the beginning of the<A HREF="#input buffer">input buffer</A>.</P><H3><A NAME="streambuf::egptr"><CODE>streambuf::egptr</CODE></A></H3><PRE>char_type *<B>egptr</B>() const;</PRE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -