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

📄 ios.htm

📁 这是关于VC++中的STL容器的资料,包括了STL容器各个类之间关系以及类的说明
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>
<head>
<title> The basic_ios Class</title>
</head>

<body bgcolor="#FFFFFF">


<img src="basicban.gif">

<pre>
<font size=5>Class Name</font>            basic_ios

<font size=5>Header File</font>           &lt;ios&gt;

<font size=5>Classification</font>      Input/Output (Format Class)
</pre>
<a href="ios.htm#diagram">Class Relationship Diagram</a><br>
<br>
<a href="ios.htm#desc">Class Description</a><br>
<h1>Member Classes</h1>

<a href="streabuf.htm">basic_streambuf</a>

<h1>Methods</h1>


<pre>
<a href="ios.htm#bad">bool bad() const;</a><br>
<a href="ios.htm#basic_ios1">explicit basic_ios(basic_streambuf<charT,traits>* sb);</a><br>
<a href="ios.htm#basic_ios2">basic_ios();</a><br>
<a href="ios.htm#basic_ios3">virtual ~basic_ios();</a><br>
<a href="ios.htm#clear">void clear(iostate state = goodbit);</a><br>
<a href="ios.htm#copyfmt">basic_ios& copyfmt(const basic_ios& rhs);</a><br>
<a href="ios.htm#eof">bool eof() const;</a><br>
<a href="ios.htm#exceptions1">iostate exceptions() const;</a><br>
<a href="ios.htm#exceptions2">void exceptions(iostate except);</a><br>
<a href="ios.htm#fail">bool fail() const;</a><br>
<a href="ios.htm#fill1">char_type fill() const;</a><br>
<a href="ios.htm#fill2">char_type fill(char_type ch);</a><br>
<a href="ios.htm#good">bool good() const;</a><br>
<a href="iosbase.htm#imbue">locale imbue(const locale& loc);</a><br>
<a href="ios.htm#init">void init(basic_streambuf<charT,traits>* sb);</a><br>
<a href="ctype.htm#narrow1">char narrow(char_type c, char dfault) const;</a><br>
<a href="ios.htm#rdbuf1">basic_streambuf<charT,traits>* rdbuf() const;</a><br>
<a href="ios.htm#rdbuf2">basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);</a><br>
<a href="ios.htm#rdstate">iostate rdstate() const;</a><br>
<a href="ios.htm#setstate">void setstate(iostate state);</a><br>
<a href="ios.htm#tie1">basic_ostream<charT,traits>* tie() const;</a><br>
<a href="ios.htm#tie2">basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);</a><br>
<a href="locale.htm#ctype-widen">char_type widen(char c) const;</a><br>
</pre>

<h2>OPERATORS</h2>
 
operator void*() const
operator!">bool operator!() const
 
<hr>
<a name="desc"><h3>Class Description</h3></a>
<p>
The basic_ios class is a format class. It encapsulates stream state information.
The stream state class  basic_ios&lt;T&gt;   forms an important base class for the istream, ostream
and their descendants. The basic_ios class contains information about how the stream has been 
opened.  For instance, has the stream been opened in the append mode, or can the stream be read
from and written to. Some streams are read only, and some streams are write only. Some streams 
can be opened for both read and write operations. The basic_ios class holds the  information 
that designates the attached stream as a binary stream or a text stream. The basic_ios class 
controls the information that determines the base that integers will be formatted to when being
inserted into a stream or when extracted from a stream. That is, will the integers be formatted
as decimal, hexadecimal, or octal or  will the floating point numbers be formatted as scientific
notation or in a fixed decimal format. The basic_ios class also controls precision information
for numbers entering or exiting a stream.  The basic_ios class has two standard typdefs:
</p>
<pre>
                    typedef basic_ios&lt;char&gt; ios 

                    typedef basic_ios&lt;wchar_t&gt; wios. 
</pre>
<p>
 The basic_ios class is usually referred to as either ios or wios.
</p>                      
<hr>
<pre>                                

<a name="bad">Method            bad()</a>

Access            Public

Classification    Accessor

Syntax            bool bad() const;      

Parameters        None

Return            The bad() method returns zero if the badbit is not set or a non zero
                  value otherwise.

</pre>

<h3>Description</h3>       
<p>
The bad()  method will return a non zero value if the badbit is set. The badbit is set 
when some operation on the basic_streambuf object(buffer) has failed. If  failbit or  badbit is set 
within the state variable, the buffer is said to be in a fail state.  If a buffer is in a bad
state it is also in a fail state.  However, a buffer can be in a fail state without being in
a bad state. If the buffer is in a bad state all insertion and extraction operations will be
ignored.  The buffer is unusable unless the clear() member function is called.
</p>
<hr>
<pre>

<a name="basic_ios1">Method            basic_ios()</a>

Access            Public

Classification    Constructor

Syntax            explicit basic_ios(basic_streambuf&lt;charT,traits&gt;* Sb);      

Parameters        Sb is a pointer to a basic_streambuf object.  The Sb
                  object will be used as the buffer for the connected stream. 

Return            None

</pre>



<h3>Description</h3>       
<p>
This basic_ios() method constructs a basic_ios object using Sb as the buffer component
for the stream. The constructor calls init(Sb) to perform the necessary
initializations of its members.
</p>
<hr>
<pre>

<a name="basic_ios2">Method            basic_ios()</a>

Access            Protected

Classification    Constructor

Syntax            basic_ios();      

Parameters        None

Return            None

</pre>



<h3>Description</h3>       
<p>
This basic_ios() method constructs a basic_ios object Its necessary members are not
automatically initialized.  The init() method must be manually called.
</p>
<hr>
<pre>

<a name="basic_ios3">Method           ~basic_ios()</a>

Classification    Destructor

Access            Protected

Syntax            virtual ~basic_ios();      

Parameters        None

Return            None
</pre>





<h3>Description</h3>       
<p>
This ~basic_ios() method destructs a basic_ios object.
</p>
<hr>
<pre>

<a name="clear">Method            clear()</a>

Access            Public

Classification    Modifier

Syntax            void clear(iostate St = goodbit);      

Parameters        The value in St is used to reset the  input/output state(iostate)
                  of the associated buffer.

Return            None

</pre>



<h3>Description</h3>       
<p>
The clear() member function serves two primary functions.  The first function is to clear
the error state of a buffer associated with a ios_base class.  The second primary function
of the clear member function is to set bits within the state variable. The clear() member
function takes an iostate data type as an argument and  returns and void.  If the clear() member
function is called with an argument of zero the state variable for the buffer is reset to zero.
If the clear() member function is called with the value of one of the states that the buffer can
The state is set to the value of that flag. For instance:

</p>
<p>
Object.clear(ios_base::goodbit | Object.rdstate());
</p>
<p>
then the goodbit is set in the state variable.  Notice that the technique for doing this involves
a bitwise oring of the state variable with the desired bit to be set. 
</p>
<hr>
<pre>

<a name="copyfmt">Method            copyfmt()</a>

Access            Public

Classification    Modifier

Syntax            basic_ios& copyfmt(const basic_ios& IosObj);      

Parameters        The IosObj is an object that will be copied.

Return            This method returns a referenced to the modified
                  object.

</pre>



<h3>Description</h3>       
<p>
The copyfmt() method updates the current ios object with the values from IosObj. The members
of IosObj are copied member by member. The values that the pointers point
to in iword and pword are copied. The values of rdstate() and rdbuf() are left
unchanged.
</p>
<hr>
<pre>

<a name="eof">Method            eof()</a>

Access            Public

Classification    Accessor

Syntax            bool eof() const;      

Parameters        None

Return            The eof() member function  returns a non zero value if the eof bit is set and
                  zero otherwise.

</pre>



<h3>Description</h3>       
<p>
The eof() member function returns a true if the input for the connected stream has been
exhausted.  A stream's source can be connected to the console, a file, a device or a buffer in
memory.  Each of these sources has a condition that signals the input has been exhausted. The
eof() will return true under those conditions and false otherwise. If the eofbit in rdstate()
is set then eof() will return true (non zero).
</p>
<hr>
<pre>

<a name="exceptions1">Method            exceptions()</a>

Access            Public

Classification    Accessor

Syntax            iostate exceptions() const;      

Parameters        None

Return            This method returns the current exception mask.
</pre>




<h3>Description</h3>       
<p>           
This exceptions() method returns the exception mask that is associated with the ios object.
The exception mask determines additional conditions under which the clear() method will
throw an exception.
</p>
<hr>
<pre>

<a name="exceptions2">Method            exceptions()</a>

Access            Public

Classification    Modifier

Syntax            void exceptions(iostate except);      

Parameters        None

⌨️ 快捷键说明

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