📄 numget.htm
字号:
<html>
<head>
<title>num_get</title>
<head>
<body bgcolor="#FFFFFF">
<a name="here"></a>
<img src="numban.gif">
<pre>
<font size=5>Class Name</font> num_get
<font size=5>Header File</font> <locale>
<font size=5>Classification</font> abstract data type
</pre>
<a href="numget.htm#crd">Class Relationship Diagram</a><br>
<br>
<a href="numget.htm#class-descrip">Class Description</a>
<h1>Member Classes</h1>
<a href="numget.htm#id">locale::id</a>
<h1>Methods</h1>
<pre>
<a href="numget.htm#do-get">
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, bool& v) const;</a>
<a href="numget.htm#do-get">
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, long& v) const;</a>
<a href="numget.htm#do-get">
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, unsigned short& v) const;</a>
<a href="numget.htm#do-get">
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, unsigned int& v) const;</a>
<a href="numget.htm#do-get">
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, unsigned long& v) const;</a>
<a href="numget.htm#do-get">
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, float& v) const;</a>
<a href="numget.htm#do-get">
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, double& v) const;</a>
<a href="numget.htm#do-get">
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, long double& v) const;</a>
<a href="numget.htm#do-get">
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, void*& v) const;</a>
<a href="numget.htm#get">
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, bool& v) const;</a>
<a href="numget.htm#get">
iter_type get(iter_type in, iter_type end, ios_base& ,
ios_base::iostate& err, long& v) const;</a>
<a href="numget.htm#get">
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, unsigned short& v) const;</a>
<a href="numget.htm#get">
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, unsigned int& v) const;</a>
<a href="numget.htm#get">
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, unsigned long& v) const;</a>
<a href="numget.htm#get">
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, float& v) const;</a>
<a href="numget.htm#get">
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, double& v) const;</a>
<a href="numget.htm#get">
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, long double& v) const;</a>
<a href="numget.htm#get">
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, void*& v) const;</a>
<a href="numget.htm#num-get">
explicit num_get(size_t refs = 0);</a>
<a href="numget.htm#~num-get">
~num_get();</a>
</pre>
<hr>
<a name="class-descrip"><h3>Class Description</h3>
<p>
The num_get class describes a class used to parse numeric values from an input
sequence.
</p>
<hr>
<a name="id"><h3>locale::id</h3></a>
<p>
<em>locale::id</em> is a class used to provide an identification of a locale facet interfaces used as
an index for lookup and to encapsulate initialization.
</p>
<hr>
<pre>
<a name="do-get">
Method do_get()</a>
Access Protected
Classification Modifier
Syntax virtual iter_type do_get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
long& val) const;
virtual iter_type do_get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
unsigned short& val) const;
virtual iter_type do_get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
unsigned int& val) const;
virtual iter_type do_get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
unsigned long& val) const;
virtual iter_type do_get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
float& val) const;
virtual iter_type do_get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
double& val) const;
virtual iter_type do_get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
long double& val) const;
virtual iter_type do_get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
void*& val) const;
Parameters <em>in</em> is an input iterator that points to the beginning
character of a character sequence.
<em>end</em> is an input iterator that points to the end
character of a character sequence.
<em>str</em> is the reference of ios_base object used for
formatting information.
<em>err</em> is used to set error conditions in the calling
stream.
<em>val</em> stores the numeric value.
Returns This methods returns in.
</pre>
<h3>Description</h3>
<p>
Each version of the do_get() method reads a sequence
of characters of the range [in, end) and extracts a numeric value. The characters are
interpreted according to str.flags(), use_facet<ctype<charT> > (loc), and
use_facet<numpunct<charT> > (loc). If successful, the numeric value is returned
in <em>val</em>.
If an error does occur then <em>val</em> remains unchanged, <em>err</em> argument is assigned
failbit.<br>
<br>
The process of inputting characters that represent numbers can be summarized in two stages:<br>
<br>
Stage 1: Determine a conversion specifier:
</p>
<pre>
* initialize local variables using str.flags().
* conversion to a integral type, floating point or void*
using specifiers.
* determine length specifier if needed.
</pre>
<p>
Stage 2: Extract characters from input source and tranform them into
char according to conversion specification:
</p>
<pre>
* if the input iterator points to the end of the sequence,
terminate this stage.
* determine if the character extracted is a decimal point
* detemine if the character is a thousands separator and
determine if digit grouping length != 0. If both are true
then the position of the character in the sequence is
remembered.
* if the character is allowed to be the next character in
the sequence according to the conversion specification
then the character is accumulated.
* advance the input iterator to the next character and restart
stage 2.
</pre>
<p>
The possible results of processing the characters are:
</p>
<pre>
* ios_base::goodbit is assigned to err:
a sequence of characters has been accumulated and the value
is stored in val.
* ios_base::failbit is assigned to err:
digit grouping has been checked and the positions of discarded
separators is not consistent or scanf reports an input failure.
* ios_base::eofbit is assigned to err:
the end of the input sequence has been reached.
</pre>
<hr>
<pre>
<a name="get">
Method get()</a>
Access Public
Classification Modifier
Syntax virtual iter_type get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
long& val) const;
virtual iter_type get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
unsigned short& val) const;
virtual iter_type get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
unsigned int& val) const;
virtual iter_type get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
unsigned long& val) const;
virtual iter_type get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
short& val) const;
virtual iter_type get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
double& val) const;
virtual iter_type get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
long double& val) const;
virtual iter_type get(iter_type in, iter_type end,
ios_base& str,
ios_base::iostate& err,
void*& val) const;
Parameters <em>in</em> is an input iterator that points to the beginning
character of a character sequence.
<em>end</em> is an input iterator that points to the end
character of a character sequence.
<em>str</em> is the reference of ios_base object used for
formatting information.
<em>err</em> is used to set error conditions in the calling
stream.
<em>val</em> stores the numeric value.
Returns This methods returns in.
</pre>
<h3>Description</h3>
<p>
The get() member function returns do_get(in, end, str, err, val).
</p>
<hr>
<pre>
<a name="num-get">
Method num_get()</a>
Access Public
Classification Constructor
Syntax explicit num_get(size_t refs = 0);
Parameters <em>refs</em>, if the refs argument = 0 then the destruction
of the object is delegated to the locale or locales
which contain it. If refs = 1 then the object must
be explicitly deleted. The locale will not delete
it. The object can then be maintained across the
lifetime of multiple locales.
Returns None
</pre>
<h3>Description</h3>
<p>
This constructor constructs a num_get facet object.
</p>
<hr>
<pre>
<a name="~num-get">
Method num_get()</a>
Access Protected
Classification Destructor
Syntax ~num_get();
Parameters None
Returns None
</pre>
<h3>Description</h3>
<p>
This destructor destroys a num_get facet object.
</p>
<hr>
<a name="crd"><h2>The Class Relationship Diagram for num_get</h2></a>
<img src="numget.gif">
<hr>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -