std::codecvt<InternT,ExternT,State>::in,std::codecvt<InternT,ExternT,State>::do_in (3) - Linux Manuals
std::codecvt<InternT,ExternT,State>::in,std::codecvt<InternT,ExternT,State>::do_in: std::codecvt<InternT,ExternT,State>::in,std::codecvt<InternT,ExternT,State>::do_in
NAME
std::codecvt<InternT,ExternT,State>::in,std::codecvt<InternT,ExternT,State>::do_in - std::codecvt<InternT,ExternT,State>::in,std::codecvt<InternT,ExternT,State>::do_in
Synopsis
Defined in header <locale>
public:
result in( StateT& state,
const ExternT* from,
const ExternT* from_end, (1)
const ExternT*& from_next,
InternT* to,
InternT* to_end,
InternT*& to_next ) const;
protected:
virtual result do_in( StateT& state,
const ExternT* from,
const ExternT* from_end, (2)
const ExternT*& from_next,
InternT* to,
InternT* to_end,
InternT*& to_next ) const;
1) Public member function, calls the member function do_in of the most derived class.
2) If this codecvt facet defines a conversion, translates the external characters from the source range [from, from_end) to internal characters, placing the results in the subsequent locations starting at to. Converts no more than from_end - from external characters and writes no more than to_end - to internal characters. Leaves from_next and to_next pointing one beyond the last element successfully converted.
If this codecvt facet does not define a conversion, no characters are converted. to_next is set to be equal to to, state is unchanged, and std::codecvt_base::noconv is returned.
Return value
A value of type std::codecvt_base::result, indicating the success status as follows:
ok conversion completed
partial not enough space in the output buffer or unexpected end of source buffer
error encountered a character that could not be converted
noconv this facet is non-converting, no output written
The non-converting specialization std::codecvt<char, char, std::mbstate_t> always returns std::codecvt_base::noconv
Notes
Requires that from <= from_end && to <= to_end and that state either representing the initial shift state or obtained by converting the preceding characters in the sequence.
The effect on state is deliberately unspecified. In standard facets, it is used to maintain shift state like when calling std::mbsrtowcs, and is therefore updated to reflect the conversion state after the last processed external character, but a user-defined facet is free to use it to maintain any other state, e.g. count the number of special characters encountered.
Example
// Run this code
Output:
See also
underflow reads from the associated file
[virtual]
from_bytes (public member function of std::wstring_convert<Codecvt,Elem,Wide_alloc,Byte_alloc>)
mbsrtowcs (function)
do_out converts a string from internT to externT, such as when writing to file
[virtual]