Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
Miscellaneous
complex
exception
functional
iterator
limits
locale
memory
new
numeric
stdexcept
typeinfo
utility
valarray
locale
has_facet
isalnum
isalpha
iscntrl
isdigit
isgraph
islower
isprint
ispunct
isspace
isupper
isxdigit
locale
tolower
toupper
use_facet
standard facets:
codecvt
codecvt_base
codecvt_byname
collate
collate_byname
ctype
ctype_base
ctype_byname
messages
messages_base
messages_byname
moneypunct
moneypunct_byname
money_base
money_get
money_put
numpunct
numpunct_byname
num_get
num_put
time_base
time_get
time_get_byname
time_put
time_put_byname
codecvt
codecvt::codecvt
public member functions:
codecvt::always_noconv
codecvt::encoding
codecvt::in
codecvt::length
codecvt::max_length
codecvt::out
codecvt::unshift
public member types:
codecvt::extern_type
codecvt::intern_type
codecvt::result
codecvt::state_type
protected members:
codecvt::do_always_noconv
codecvt::do_encoding
codecvt::do_in
codecvt::do_length
codecvt::do_max_length
codecvt::do_out
codecvt::do_unshift
codecvt::~codecvt


codecvt::unshift

public member function
result unshift ( stateT& state, 
        externT* to, externT* to_limit, externT*& to_next ) const;

Unshift translation state

During a character encoding translation initiated by codecvt::out the state may be shifted to some state other than the state by default if the destination range could not absorb all the characters produced by the translation.

By calling member unshift the translation of the particular sequence can be finished properly by providing more storage capacity where to write the remainder at the location pointed by to. The function does not attempt to store more characters once to_limit is reached.

When the function returns, to_next points to one beyond the last element successfully converted.

If the destination range can still not absorb all the characters remaining to be translated, it returns codecvt::partial.

On success, it returns codecvt::ok.

During its operation, this function simply calls the virtual protected member codecvt::do_unshift, which is the member function in charge of performing the actions described above.

Parameters

state
State object to keep track of the state of a multibyte character conversion. Typically, this is an object of type mbstate_t with its state shifted to some value other than its default value by a call to codecvt::out.
stateT is the state type (i.e., the third template parameter of codecvt).
to, to_limit
Pointer to the initial and final characters of the destination sequence. The range used is [to,to_limit), which contains all the characters between to and to_limit, including the character pointed by to but not the character pointed by to_limit.
A translation does not necessarily need to fill up the range to its limit, and may also exhaust it (in which case it returns codecvt::partial).
externT is the external character type (i.e., the second template parameter of codecvt).
to_next
Pointer type able to point to an element in the above range. Once the function returns, this object points to the element in the destination range beyond the last one successfully translated.

Return value

An object of type codecvt::result, with the following possible values:
valueresult
okSequence conversion completed
partialSequence not completed. More characters needed to complete sequence conversion.
errorArgument state has an invalid value
noconvThis type of stateT object does not require termination

See also