📄 codecvt.htm
字号:
<html>
<head>
<title>codecvt</title>
<head>
<body bgcolor="#FFFFFF">
<pre>
<font size=5><b>Class Name</b></font> codecvt
<font size=5><b>Header File</b></font> <locale>
<font size=5><b>Classification</b></font> abstract data type
</pre>
<a href="codecvt.htm#crd">Class Relationship Diagram</a><br>
<br>
<a href="codecvt.htm#class-descrip">Class Description</a>
<h1>Member Classes</h1>
<a href="codecvt.htm#id">locale::id</a>
<h1>Methods</h1>
<pre>
<a href="codecvt.htm#always-noconv">
bool always_noconv() const throw();</a>
<a href="codecvt.htm#codecvt">
explicit codecvt(size_t refs = 0);</a>
<a href="locale.htm#~codecvt">
~codecvt();</a>
<a href="codecvt.htm#do-always-noconv">
virtual bool do_always_noconv() const throw();</a>
<a href="codecvt.htm#do-encoding">
virtual int do_encoding() const throw();</a>
<a href="codecvt.htm#do-in">
virtual result do_in(stateT& state, const externT* from,
const externT* from_end, const externT*& from_next, internT* to,
internT* to_limit, internT*& to_next) const;</a>
<a href="codecvt.htm#do-length">
virtual int do_length(const stateT&, const externT* from,
const externT* end, size_t max) const;</a>
<a href="codecvt.htm#do-max-length">
virtual int do_max_length() const throw();</a>
<a href="codecvt.htm#do-out">
virtual result do_out(stateT& state, const internT* from,
const internT* from_end, const internT*& from_next, externT* to,
externT* to_limit, externT*& to_next) const;</a>
<a href="codecvt.htm#do-unshift">
virtual result do_unshift(stateT& state, externT* to,
externT* to_limit, externT*& to_next) const;</a>
<a href="codecvt.htm#encoding">
int encoding() const throw();</a>
<a href="codecvt.htm#in">
result in(stateT& state, const externT* from, const externT* from_end,
const externT*& from_next, internT* to, internT* to_limit,
internT*& to_next) const;</a>
<a href="codecvt.htm#length">
int length(const stateT&, const externT* from, const externT* end,
size_t max) const;</a>
<a href="codecvt.htm#max-length">
int max_length() const throw();</a>
<a href="codecvt.htm#out">
result out(stateT& state, const internT* from, const internT* from_end,
const internT*& from_next, externT* to, externT* to_
limit, externT*& to_next) const;</a>
<a href="codecvt.htm#unshift">
result unshift(stateT& state, externT* to, externT* to_limit,
externT*& to_next) const;</a>
</pre>
<a name="class-descrip"><h3>Class Description</h3></a>
<p>
The codecvt template class describes an object that controls conversions
between one codeset to another. For example, this class is used to convert
wide characters to multibyte characters. The template parameter stateT
selects the pair of codesets used in the mapping.
</p>
<hr>
<a name="id"><h3>locale::id</h3></a>
<p>
The id class is 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="always-noconv">
Method always_noconv()</a>
Access Public
Classification Modifier
Syntax bool always_noconv() const throw();
Parameters None
Returns This method returns true if do_convert() returns
noconv for all valid argument values.
</pre>
<h3>Description</h3>
<p>
The always_noconv() member function returns do_always_noconv().
<p>
<hr>
<pre>
<a name="codecvt">
Method codecvt()</a>
Access Public
Classification Constructor
Syntax explicit codecvt(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>
The constructor constructs a codecvt facet object.
</p>
<hr>
<pre>
<a name="~codecvt">
Method codecvt()</a>
Access Protected
Classification Destructor
Syntax ~codecvt();
Parameters None
Returns None
</pre>
<h3>Description</h3>
<p>
The destructor destroys a codecvt facet object.
</p>
<hr>
<pre>
<a name="do-always-noconv">
Method do_always_noconv()</a>
Access Protected
Classification Accessor
Syntax virtual bool do_always_noconv() const throw();
Parameters None
Return Type bool
</pre>
<h3>Description</h3>
<p>
The do_always_noconv() method will return true
only if for all valid arguments value do_convert() returns noconv.
</p>
<hr>
<pre>
<a name="do-encoding">
Method do_encoding()</a>
Access Protected
Classification Accessor
Syntax virtual int do_encoding() const throw();
Parameters None
Return This method returns an int which contains the
constant number of externT characters needed to
produce an internal character.
</pre>
<h3>Description</h3>
<p>
The do_encoding() method returns -1 if the
encoding of the externT sequence is state dependent. The method returns the constant
number of externT characters that are needed in the encoding to produce an
internal character or returns 0 if that number is not a constant.
</p>
<hr>
<pre>
<a name="do-in">
Method do_in()
Access Protected
Classification Modifier
Syntax virtual result do_in(stateT& state, const externT* from,
const externT* from_end,
const externT*& from_next,
internT* to, internT* to_limit,
internT*& to_next) const;
Parameters <em>state</em> is unspecified.
<em>from</em> is the beginning of the source character sequence.
<em>from_end</em> is the end of the source character sequence.
<em>from_next</em> points to character in the source sequence.
<em>to</em> is the beginning of the destination sequence.
<em>to_limit</em> is the end of the destination sequence.
<em>to_next</em> points to character in the destination sequence.
Return Type <a href="codecvt.htm#Table1">result</a>
</pre>
<h3>Description</h3>
<p>
The do_in() method translates the sequence at [from,from_end)
to a destination sequence stored at [to, to_limit). It translates no more than
(from_end - from) source character elements and stores no more than (to_limit - to)
destination character elements. The method will stop when it encounters
a character in the source sequence that it cannot convert. The <em>from_next</em> and <em>to_next</em>
pointers will point one beyond the last element that was successfully translated.<br>
<br>
If no translation takes place then the member function will return <em>noconv</em>. The
pointer <em>to_next</em> will be equal to the argument <em>to</em> and the pointer <em>from_next</em> will
be equal to the argument <em>from</em>. If only some of the characters are translated then
the method will return <em>partial</em>. If <em>from_next</em> == <em>from_end</em> then either
the destination character sequence has not taken in all of the available
destination character elements or that additional source character elements
are required before any another destination character elements can be produced.
</p>
<hr>
<pre>
<a name="do-length">
Method do_length()</a>
Access Protected
Classification Accessor
Syntax virtual int do_length(stateT& state, const externT* from,
const externT* end,
size_t max) const throw();
Parameters <em>state</em> is initialized either for the beginning of a
sequence or equal to the result of the previous
conversion of the sequence.
<em>from</em> is the beginning of the character sequence.
<em>end</em> is the end of the character sequence.
<em>max</em> is maximum value of internT characters available
in the specified range.
Return Type int
</pre>
<h3>Description</h3>
<p>
The do_length() method returns the largest number of characters less than max internT
characters that are available in the range [from, end].
</p>
<hr>
<pre>
<a name="do-max-length">
Method do_max_length()</a>
Access Protected
Classification Accessor
Syntax virtual int do_max_length() const throw();
Parameters None
Returns This method returns an int that contains the maximum
value that do_length() returns.
</pre>
<h3>Description</h3>
<p>
The do_max_length() method returns the maximum value
that can be returned by do_length(state, from, from_end, 1) for any valid range
[from,from_end) and state value.
</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -