codecvt< InternT, ExternT, __enc_traits > Class Template Reference

Inheritance diagram for codecvt< InternT, ExternT, __enc_traits >:

Inheritance graph
[legend]
Collaboration diagram for codecvt< InternT, ExternT, __enc_traits >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef codecvt_base::result result
typedef InternT intern_type
typedef ExternT extern_type
typedef __enc_traits state_type
typedef __enc_traits::__desc_type __desc_type
typedef __enc_traits __enc_type

Public Member Functions

 codecvt (size_t __refs=0)
 codecvt (__enc_type *__enc, size_t __refs=0)
result out (state_type &state, const intern_type *__from, const intern_type *__from_end, const intern_type *&__from_next, extern_type *__to, extern_type *__to_end, extern_type *&__to_next) const
 Convert from internal to external character set.
result unshift (state_type &state, extern_type *__to, extern_type *__to_end, extern_type *&__to_next) const
 Reset conversion state.
result in (state_type &state, const extern_type *__from, const extern_type *__from_end, const extern_type *&__from_next, intern_type *__to, intern_type *__to_end, intern_type *&__to_next) const
 Convert from external to internal character set.
int encoding () const throw ()
bool always_noconv () const throw ()
int length (state_type &state, const extern_type *__from, const extern_type *__end, size_t __max) const
int max_length () const throw ()

Static Public Attributes

static locale::id id

Protected Member Functions

virtual ~codecvt ()
virtual result do_out (state_type &state, const intern_type *__from, const intern_type *__from_end, const intern_type *&__from_next, extern_type *__to, extern_type *__to_end, extern_type *&__to_next) const
 Convert from internal to external character set.
virtual result do_unshift (state_type &state, extern_type *__to, extern_type *__to_end, extern_type *&__to_next) const
virtual result do_in (state_type &state, const extern_type *__from, const extern_type *__from_end, const extern_type *&__from_next, intern_type *__to, intern_type *__to_end, intern_type *&__to_next) const
virtual int do_encoding () const throw ()
virtual bool do_always_noconv () const throw ()
virtual int do_length (state_type &, const extern_type *__from, const extern_type *__end, size_t __max) const
virtual int do_max_length () const throw ()

Detailed Description

template<typename InternT, typename ExternT>
class codecvt< InternT, ExternT, __enc_traits >

Definition at line 199 of file codecvt_specializations.h.


Member Function Documentation

template<typename InternT, typename ExternT>
codecvt_base::result codecvt< InternT, ExternT, __enc_traits >::do_out state_type state,
const intern_type __from,
const intern_type __from_end,
const intern_type *&  __from_next,
extern_type __to,
extern_type __to_end,
extern_type *&  __to_next
const [protected, virtual]
 

Convert from internal to external character set.

Converts input string of intern_type to output string of extern_type. This function is a hook for derived classes to change the value returned.

See also:
out for more information.

Implements codecvt_abstract_base< InternT, ExternT, __enc_traits >.

Definition at line 276 of file codecvt_specializations.h.

References std::copy().

result codecvt_abstract_base< InternT , ExternT , __enc_traits >::in state_type state,
const extern_type __from,
const extern_type __from_end,
const extern_type *&  __from_next,
intern_type __to,
intern_type __to_end,
intern_type *&  __to_next
const [inline, inherited]
 

Convert from external to internal character set.

Converts input string of extern_type to output string of intern_type. This is analogous to mbsrtowcs. It does this by calling codecvt::do_in.

The source and destination character sets are determined by the facet's locale, internal and external types.

The characters in [from,from_end) are converted and written to [to,to_end). from_next and to_next are set to point to the character following the last successfully converted character, respectively. If the result needed no conversion, from_next and to_next are not affected.

The state argument should be intialized if the input is at the beginning and carried from a previous call if continuing conversion. There are no guarantees about how state is used.

The result returned is a member of codecvt_base::result. If all the input is converted, returns codecvt_base::ok. If no conversion is necessary, returns codecvt_base::noconv. If the input ends early or there is insufficient space in the output, returns codecvt_base::partial. Otherwise the conversion failed and codecvt_base::error is returned.

Parameters:
state Persistent conversion state data.
from Start of input.
from_end End of input.
from_next Returns start of unconverted data.
to Start of output buffer.
to_end End of output buffer.
to_next Returns start of unused output area.
Returns:
codecvt_base::result.

Definition at line 200 of file codecvt.h.

result codecvt_abstract_base< InternT , ExternT , __enc_traits >::out state_type state,
const intern_type __from,
const intern_type __from_end,
const intern_type *&  __from_next,
extern_type __to,
extern_type __to_end,
extern_type *&  __to_next
const [inline, inherited]
 

Convert from internal to external character set.

Converts input string of intern_type to output string of extern_type. This is analogous to wcsrtombs. It does this by calling codecvt::do_out.

The source and destination character sets are determined by the facet's locale, internal and external types.

The characters in [from,from_end) are converted and written to [to,to_end). from_next and to_next are set to point to the character following the last successfully converted character, respectively. If the result needed no conversion, from_next and to_next are not affected.

The state argument should be intialized if the input is at the beginning and carried from a previous call if continuing conversion. There are no guarantees about how state is used.

The result returned is a member of codecvt_base::result. If all the input is converted, returns codecvt_base::ok. If no conversion is necessary, returns codecvt_base::noconv. If the input ends early or there is insufficient space in the output, returns codecvt_base::partial. Otherwise the conversion failed and codecvt_base::error is returned.

Parameters:
state Persistent conversion state data.
from Start of input.
from_end End of input.
from_next Returns start of unconverted data.
to Start of output buffer.
to_end End of output buffer.
to_next Returns start of unused output area.
Returns:
codecvt_base::result.

Definition at line 121 of file codecvt.h.

result codecvt_abstract_base< InternT , ExternT , __enc_traits >::unshift state_type state,
extern_type __to,
extern_type __to_end,
extern_type *&  __to_next
const [inline, inherited]
 

Reset conversion state.

Writes characters to output that would restore state to initial conditions. The idea is that if a partial conversion occurs, then the converting the characters written by this function would leave the state in initial conditions, rather than partial conversion state. It does this by calling codecvt::do_unshift().

For example, if 4 external characters always converted to 1 internal character, and input to in() had 6 external characters with state saved, this function would write two characters to the output and set the state to initialized conditions.

The source and destination character sets are determined by the facet's locale, internal and external types.

The result returned is a member of codecvt_base::result. If the state could be reset and data written, returns codecvt_base::ok. If no conversion is necessary, returns codecvt_base::noconv. If the output has insufficient space, returns codecvt_base::partial. Otherwise the reset failed and codecvt_base::error is returned.

Parameters:
state Persistent conversion state data.
to Start of output buffer.
to_end End of output buffer.
to_next Returns start of unused output area.
Returns:
codecvt_base::result.

Definition at line 160 of file codecvt.h.


The documentation for this class was generated from the following file:
Generated on Thu Mar 16 10:41:15 2006 for libstdc++-v3 Source by  doxygen 1.4.6