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

📄 strstrea.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<P>The member function calls<CODE><A HREF="#strstreambuf::freeze">freeze</A>()</CODE>, thenreturns a pointer to the beginning of the controlled sequence.(Note that no terminating null element exists, unless you insertone explicitly.)</P><H3><A NAME="strstreambuf::strstreambuf"><CODE>strstreambuf::strstreambuf</CODE></A></H3><PRE>explicit <B>strstreambuf</B>(streamsize count = 0);<B>strstreambuf</B>(void (*allocfunc)(size_t),    void (*freefunc)(void *));<B>strstreambuf</B>(char *getptr, streamsize count,    char *putptr = 0);<B>strstreambuf</B>(signed char *getptr, streamsize count,    signed char *putptr = 0);<B>strstreambuf</B>(unsigned char *getptr, streamsize count,    unsigned char *putptr = 0);<B>strstreambuf</B>(const char *getptr, streamsize count);<B>strstreambuf</B>(const signed char *getptr, streamsize count);<B>strstreambuf</B>(const unsigned char *getptr, streamsize count);</PRE><P>The first constructor stores a null pointer in all the pointerscontrolling the<A HREF="streambu.html#input buffer">input buffer</A>, the<A HREF="streambu.html#output buffer">output buffer</A>, and<A HREF="#strstreambuf allocation">strstreambuf allocation</A>.It sets the stored<A HREF="#strstreambuf mode">strstreambuf mode</A> to make thecontrolled sequence modifiable and extendable.And it accepts <CODE>count</CODE> as a suggested initial allocation size.</P><P>The second constructor behaves much as the first, except thatit stores <CODE>allocfunc</CODE> as the pointer to the function tocall to allocate storage, and <CODE>freefunc</CODE> as the pointerto the function to call to free that storage.</P><P>The three constructors:</P><PRE><B>strstreambuf</B>(char *getptr, streamsize count,    char *putptr = 0);<B>strstreambuf</B>(signed char *getptr, streamsize count,    signed char *putptr = 0);<B>strstreambuf</B>(unsigned char *getptr, streamsize count,    unsigned char *putptr = 0);</PRE><P>also behave much as the first, except that <CODE>getptr</CODE>designates the array object used to hold the controlledsequence. (Hence, it must not be a null pointer.) The numberof elements <CODE>N</CODE> in the array is determined asfollows:</P><UL><LI>If <CODE>(count &gt; 0)</CODE>, then <CODE>N</CODE> is <CODE>count</CODE>.</LI><LI>If <CODE>(count == 0)</CODE>, then <CODE>N</CODE> is<CODE><A HREF="string.html#strlen">strlen</A>((const char *)getptr)</CODE>.</LI><LI>If <CODE>(count &lt; 0)</CODE>, then <CODE>N</CODE> is<CODE><A HREF="limits.html#INT_MAX">INT_MAX</A></CODE>.</LI></UL><P>If <CODE>putptr</CODE> is a null pointer, the function establishesjust an input buffer, by executing:</P><PRE><A HREF="streambu.html#streambuf::setg">setg</A>(getptr, getptr, getptr + N);</PRE><P>Otherwise, it establishes both input and output buffers, byexecuting:</P><PRE>setg(getptr, getptr, putptr);<A HREF="streambu.html#streambuf::setp">setp</A>(putptr, getptr + N);</PRE><P>In this case, <CODE>putptr</CODE> must be in the interval<CODE>[getptr, getptr + N]</CODE>.<P>Finally, the three constructors:</P><PRE><B>strstreambuf</B>(const char *getptr, streamsize count);<B>strstreambuf</B>(const signed char *getptr, streamsize count);<B>strstreambuf</B>(const unsigned char *getptr, streamsize count);</PRE><P>all behave the same as:</P><PRE>streambuf((char *)getptr, count);</PRE><P>except that the stored mode makes the controlled sequence neithermodifiable not extendable.</P><H3><A NAME="strstreambuf::underflow"><CODE>strstreambuf::underflow</CODE></A></H3><PRE>virtual int <B>underflow</B>();</PRE><P>The protected virtual member function endeavors to extract the currentelement <CODE>ch</CODE> from the<A HREF="streambu.html#input buffer">input buffer</A>,then advance the current stream position, and return the element as<CODE>(int)(unsigned char)ch</CODE>.It can do so in only one way:If a <A HREF="streambu.html#read position">read position</A>is available, it takes <CODE>ch</CODE> as the element storedin the read position and advances the next pointer for the input buffer.</P><P>If the function cannot succeed, it returns<CODE><A HREF="stdio.html#EOF">EOF</A></CODE>. Otherwise,it returns the current element in the input stream,converted as described above.</P><H2><A NAME="istrstream"><CODE>istrstream</CODE></A></H2><PRE>class <B>istrstream</B> : public istream {public:    explicit <B><A HREF="#istrstream::istrstream">istrstream</A></B>(const char *ptr);    explicit <B><A HREF="#istrstream::istrstream">istrstream</A></B>(char *ptr);    <B><A HREF="#istrstream::istrstream">istrstream</A></B>(const char *ptr, streamsize count);    <B><A HREF="#istrstream::istrstream">istrstream</A></B>(char *ptr, streamsize count);    strstreambuf *<B><A HREF="#istrstream::rdbuf">rdbuf</A></B>() const;    char *<B><A HREF="#istrstream::str">str</A></B>();    };</PRE><P>The class describes an object that controlsextraction of elements and encoded objects from a<A HREF="streambu.html#stream buffer">stream buffer</A> of class<CODE><A HREF="#strstreambuf">strstreambuf</A></CODE>.The object stores an ojbect of class<CODE>strstreambuf</CODE>.</P><H3><A NAME="istrstream::istrstream"><CODE>istrstream::istrstream</CODE></A></H3><PRE>explicit <B>istrstream</B>(const char *ptr);explicit <B>istrstream</B>(char *ptr);<B>istrstream</B>(const char *ptr, streamsize count);<B>istrstream</B>(char *ptr, streamsize count);</PRE><P>All the constructors initialize the base class by calling<CODE><A HREF="istream.html#istream::istream">istream</A>(sb)</CODE>,where <CODE>sb</CODE> is the stored object of class<CODE><A HREF="#strstreambuf">strstreambuf</A></CODE>.The first two constructors also initialize <CODE>sb</CODE> by calling<CODE><A HREF="#strstreambuf::strstreambuf">strstreambuf</A>((constchar *)ptr, 0)</CODE>. The remaining two constructors instead call<CODE>strstreambuf((const char *)ptr, count)</CODE>.</P><H3><A NAME="istrstream::rdbuf"><CODE>istrstream::rdbuf</CODE></A></H3><PRE>strstreambuf *<B>rdbuf</B>() const</PRE><P>The member function returns the address of the storedstream buffer, of type pointer to<CODE><A HREF="#strstreambuf">strstreambuf</A></CODE>.</P><H3><A NAME="istrstream::str"><CODE>istrstream::str</CODE></A></H3><PRE>char *<B>str</B>();</PRE><P>The member function returns<CODE><A HREF="#istrstream::rdbuf">rdbuf</A>()-&gt;<A HREF="#strstreambuf::str">str</A>()</CODE>.</P><H2><A NAME="ostrstream"><CODE>ostrstream</CODE></A></H2><PRE>class <B>ostrstream</B> : public ostream {public:    <B><A HREF="#ostrstream::ostrstream">ostrstream</A></B>();    <B><A HREF="#ostrstream::ostrstream">ostrstream</A></B>(char *ptr, streamsize count,        ios_base::openmode mode = ios_base::out);    strstreambuf *<B><A HREF="#ostrstream::rdbuf">rdbuf</A></B>() const;    void <B><A HREF="#ostrstream::freeze">freeze</A></B>(bool freezeit = true);    char *<B><A HREF="#ostrstream::str">str</A></B>();    streamsize <B><A HREF="#ostrstream::pcount">pcount</A></B>() const;    };</PRE><P>The class describes an object that controlsinsertion of elements and encoded objects into a<A HREF="streambu.html#stream buffer">stream buffer</A> of class<CODE><A HREF="#strstreambuf">strstreambuf</A></CODE>.The object stores an ojbect of class<CODE>strstreambuf</CODE>.</P><H3><A NAME="ostrstream::freeze"><CODE>ostrstream::freeze</CODE></A></H3><PRE>void <B>freeze</B>(bool freezeit = true)</PRE><P>The member function calls<CODE><A HREF="#ostrstream::rdbuf">rdbuf</A>()-&gt;<A HREF="#strstreambuf::freeze">freeze</A>(freezeit)</CODE>.</P><H3><A NAME="ostrstream::ostrstream"><CODE>ostrstream::ostrstream</CODE></A></H3><PRE><B>ostrstream</B>();<B>ostrstream</B>(char *ptr, streamsize count,    ios_base::openmode mode = ios_base::out);</PRE><P>Both constructors initialize the base class by calling<CODE><A HREF="ostream.html#ostream::ostream">ostream</A>(sb)</CODE>,where <CODE>sb</CODE> is the stored object of class<CODE><A HREF="#strstreambuf">strstreambuf</A></CODE>.The first constructor also initializes <CODE>sb</CODE> by calling<CODE><A HREF="#strstreambuf::strstreambuf">strstreambuf</A>()</CODE>.The second constructor initializes the base class one of two ways:</P><UL><LI>If <CODE>mode &amp;ios_base::<A HREF="ios.html#ios_base::app">app</A> == 0</CODE>, then<CODE>ptr</CODE> must designate the first element of an array of <CODE>count</CODE>elements, and the constructor calls<CODE>strstreambuf(ptr, count, ptr)</CODE>.</LI><LI>Otherwise, <CODE>ptr</CODE> must designate the first element of anarray of <CODE>count</CODE> elements that contains a<A HREF="lib_over.html#C string">C string</A>whose first element is designatedby <CODE>ptr</CODE>, and the constructor calls<CODE>strstreambuf(ptr, count, ptr +<A HREF="string.html#strlen">strlen</A>(ptr)</CODE>.</LI></UL><H3><A NAME="ostrstream::pcount"><CODE>ostrstream::pcount</CODE></A></H3><PRE>streamsize <B>pcount</B>() const;</PRE><P>The member function returns<CODE><A HREF="#ostrstream::rdbuf">rdbuf</A>()-&gt;<A HREF="#strstreambuf::pcount">pcount</A>()</CODE>.</P><H3><A NAME="ostrstream::rdbuf"><CODE>ostrstream::rdbuf</CODE></A></H3><PRE>strstreambuf *<B>rdbuf</B>() const</PRE><P>The member function returns the address of the storedstream buffer, of type pointer to<CODE><A HREF="#strstreambuf">strstreambuf</A></CODE>.</P><H3><A NAME="ostrstream::str"><CODE>ostrstream::str</CODE></A></H3><PRE>char *<B>str</B>();</PRE><P>The member function returns<CODE><A HREF="#ostrstream::rdbuf">rdbuf</A>()-&gt;<A HREF="#strstreambuf::str">str</A>()</CODE>.</P><HR><P>See also the<B><A HREF="index.html#Table of Contents">Table of Contents</A></B> and the<B><A HREF="_index.html">Index</A></B>.</P><P><I><A HREF="crit_pjp.html">Copyright</A> &#169; 1992-2002by P.J. Plauger. All rights reserved.</I></P><!--V4.01:1125--></BODY></HTML>

⌨️ 快捷键说明

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