Namespaces
Variants
Views
Actions

std::codecvt::unshift, std::codecvt::do_unshift

From cppreference.com
Defined in header <locale>
public:

result unshift( stateT& state,
                externT* to,
                externT* to_end,

                externT*& to_next) const
(1)
protected:

result do_unshift( stateT& state,
                   externT* to,
                   externT* to_end,

                   externT*& to_next) const
(2)

1) public member function, calls the member function do_unshift of the most derived class.

2) if the encoding represented by this codecvt facet is state-dependent, and state represents a conversion state that is not the initial shift state, writes the characters necessary to return to the initial shift state. The characters are written to a character array whose first element is pointed to by to. No more than to_end-to characters are written. The parameter to_next is updated to point one past the last character written.

Contents

[edit] Return value

A value of type std::codecvt_base::result, indicating the success status as follows:

ok all necessary characters were written. state now represents initial shift state
partial not enough space in the output buffer. to_next == to_end
error unspecified error occurred
noconv the encoding is not state-dependent, no termination sequence necessary

The non-converting specialization std::codecvt<char, char, std::mbstate_t> always returns std::codecvt_base::noconv

[edit] Notes

This function is called by std::basic_filebuf::close() and in other situations when finalizing a state-dependent multibyte character sequence.

[edit] Example

[edit] See also

converts a wide character to its multibyte representation, given state
(function) [edit]
[virtual]
converts a string from internT to externT, such as when writing to file
(virtual protected member function) [edit]