📄 numput.htm
字号:
<html>
<head>
<title>num_put</title>
<head>
<body bgcolor="#FFFFFF">
<a name="here"></a>
<img src="numban.gif">
<pre>
<font size=5>Class Name</font> num_put
<font size=5>Header File</font> <locale>
<font size=5>Classification</font> abstract data type
</pre>
<a href="numput.htm#crd">Class Relationship Diagram</a><br>
<br>
<a href="numput.htm#class-descrip">Class Description</a>
<h1>Member Classes</h1>
<a href="numput.htm#id">locale::id</a>
<h1>Methods</h1>
<pre>
<a href="numput.htm#do-put">
virtual iter_type do_put(iter_type, ios_base&, char_type fill, bool v) const;</a>
<a href="numput.htm#do-put">
virtual iter_type do_put(iter_type, ios_base&, char_type fill, long v) const;</a>
<a href="numput.htm#do-put">
virtual iter_type do_put(iter_type, ios_base&, char_type fill, unsigned long) const;</a>
<a href="numput.htm#do-put">
virtual iter_type do_put(iter_type, ios_base&, char_type fill, double v) const;</a>
<a href="numput.htm#do-put">
virtual iter_type do_put(iter_type, ios_base&, char_type fill, long double v) const;</a>
<a href="numput.htm#do-put">
virtual iter_type do_put(iter_type, ios_base&, char_type fill, void* v) const;</a>
<a href="numput.htm#num-put">
explicit num_put(size_t refs = 0);</a>
<a href="numput.htm#~num-put">
~num_put();</a>
<a href="numput.htm#put">
iter_type put(iter_type s, ios_base& f, char_type fill, bool v) const;</a>
<a href="numput.htm#put">
iter_type put(iter_type s, ios_base& f, char_type fill, long v) const;</a>
<a href="numput.htm#put">
iter_type put(iter_type s, ios_base& f, char_type fill, unsigned long v) const;</a>
<a href="numput.htm#put">
iter_type put(iter_type s, ios_base& f, char_type fill, double v) const;</a>
<a href="numput.htm#put">
iter_type put(iter_type s, ios_base& f, char_type fill, long double v) const;</a>
<a href="numput.htm#put">
iter_type put(iter_type s, ios_base& f, char_type fill, void* v) const;</a>
</pre>
<hr>
<a name="class-descrip"><h3>Class Description</h3></a>
<p>
The num_put class describes a class used to format numeric values to an output
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-put">
Method do_put()</a>
Access Protected
Classification Accessor
Syntax virtual iter_type do_put(iter_type out, ios_base& str,
char_type fill,
bool v) const;
virtual iter_type do_put(iter_type out, ios_base& str,
char_type fill,
long v) const;
virtual iter_type do_put(iter_type out, ios_base& str,
char_type fill,
unsigned long v) const;
virtual iter_type do_put(iter_type out, ios_base& str,
char_type fill,
double v) const;
virtual iter_type do_put(iter_type out, ios_base& str,
char_type fill,
long double v) const;
virtual iter_type do_put(iter_type out, ios_base& str,
char_type fill,
void* m v) const;
Parameters <em>out</em> is an iterator that points to the destination
sequence.
<em>str</em> supplies the formatting specifications.
<em>fill</em> is a character used for padding.
<em>v</em> is the value to be formatted.
Returns This method returns out.
</pre>
<h3>Description</h3>
<p>
Each version of the do_put() method reads the value <em>v</em> and formats it
according to the formatting specifications obtained from <em>str</em> argument.
The fill character is used for padding. The formatted character string is inserted
into <em>out</em> argument.<br>
<br>
The process of outputting characters that represent numbers can be summarized in four stages:<br>
<br>
Stage 1: If the current locale is the "C" locale, determine a printf
conversion specifier (spec) and determine the characters that
are to be printed:
</p>
<pre>
* initialize local variables using this->flags().
* conversion to an integral type, floating point or void*
using specifiers.
* determine length specifier needed.
* representation would be char's printed by printf(s, val)
where s is the conversion specifier.
</pre>
<p>
Stage 2: Convert each char to charT using a conversion:
</p>
<pre>
* the conversion and the values are returned by members of:
use_facet<numpunct<charT> > (str.getloc()).
* any character other than the decimal point is converted.
* decimal point characters are replaced with punct.decimal_point().
* thousands separator character are inserted into the sequence
determined by the value returned by punct.do_grouping().
</pre>
<p>
Stage 3: Determine the location of any padding:
</p>
<pre>
* if width() != 0 and the number of charT's in the sequence is
less than width() then the fill characters are added at the
position indicated for padding to bring the sequence equal to
width().
</pre>
<p>
Stage 4: The sequence is sent to output:
</p>
<pre>
* the sequence is sent to output via: *out++ = c
* out is returned
</pre>
<p>
The possible results of processing the characters are:
</p>
<pre>
* out.failed() becomes true during stage 3, output is
terminated.
</pre>
<hr>
<pre>
<a name="put">
Method put()</a>
Access Public
Classification Accessor
Syntax iter_type put(iter_type out, ios_base& str,
char_type fill, bool v) const;
iter_type put(iter_type out, ios_base& str,
char_type fill, long v) const;
iter_type put(iter_type out, ios_base& str,
char_type fill, unsigned long v) const;
iter_type put(iter_type out, ios_base& str,
char_type fill, double v) const;
iter_type put(iter_type out, ios_base& str,
char_type fill,long double v) const;
iter_type put(iter_type out, ios_base& str,
char_type fill,void* m v) const;
Parameters <em>out</em> is an iterator that points to the destination
sequence.
<em>str</em> supplies the formatting specifications.
<em>fill</em> is a character used for padding.
<em>v</em> is the value to be formatted.
Returns This method returns out.
</pre>
<h3>Description</h3>
<p>
Each version of the put() method returns do_put(out, str, fill, v).
</p>
<hr>
<pre>
<a name="num-put">
Method num_put()</a>
Access Public
Classification Constructor
Syntax explicit num_put(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_put facet object.
</p>
<hr>
<pre>
<a name="~num-put">
Method num_put()</a>
Access Protected
Classification Destructor
Syntax ~num_put();
Parameters None
Returns None
</pre>
<h3>Description</h3>
<p>
This destructor destroys a num_put facet object.
</p>
<hr>
<a name="crd"><h2>The Class Relationship Diagram for num_put</h2></a>
<img src="numput.gif">
<hr>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -