Standard C++ Library Reference ISO/IEC (VERSION3)
: public locale::facet, codecvt_base {
public:
typedef Elem intern_type;
typedef Byte extern_type;
typedef Statype state_type;
explicit codecvt(size_t refs = 0);
result in(Statype& state,
const Byte *first1, const Byte *last1,
const Byte *next1,
Elem *first2, Elem *last2, Elem *next2);
result out(Statype& state,
const Elem *first1, const Elem *last1,
const Elem *next1,
Byte *first2, Byte *last2, Byte *next2);
result unshift(Statype& state,
Byte *first2, Byte *last2, Byte *next2);
bool always_noconv() const throw();
int max_length() const throw();
int length(const Statype& state,
const Byte *first1, const Byte *last1,
size_t _N2) const throw();
int encoding() const throw();
static locale::id id;
protected:
~codecvt();
virtual result do_in(Statype& state,
const Byte *first1, const Byte *last1,
const Byte *next1,
Elem *first2, Elem *last2, Elem *next2);
virtual result do_out(Statype& state,
const Elem *first1, const Elem *last1,
const Elem *next1,
Byte *first2, Byte *last2, Byte *next2);
virtual result do_unshift(Statype& state,
Byte *first2, Byte *last2, Byte *next2);
virtual bool do_always_noconv() const throw();
virtual int do_max_length() const throw();
virtual int do_encoding() const throw();
virtual int do_length(const Statype& state,
const Byte *first1, const Byte *last1,
size_t len2) const throw();
};
The template class describes an object that can serve as a locale facet, to control conversions between a sequence of
values of type Elem and a sequence of values of type Byte. The class Statype characterizes the transformation -- and
an object of class Statype stores any necessary state information during a conversion.
As with any locale facet, the static object id has an initial stored value of zero. The first attempt to access its stored
value stores a unique positive value in id.
The template versions of do_in and do_out always return codecvt_base::noconv. The Standard C++ library
defines an explicit specialization, however, that is more useful:
template<>
codecvt<wchar_t, char, mbstate_t>