---
name: "__codecvt_abstract_base"
section: "3"
platform: "linux"
package: "libstdc++6-4.1-doc"
version: "4.1.2-25"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/__codecvt_abstract_base"
---

# \_\_codecvt\_abstract\_base(3)

## NAME

\_\_codecvt\_abstract\_base -

## SYNOPSIS

Inherits locale::facet, and **codecvt\_base**.

Inherited by **codecvt**, and **codecvt\< \_InternT, \_ExternT, encoding\_state \>**.

## Detailed Description

### template\<typename \_InternT, typename \_ExternT, typename \_StateT\> class \_\_codecvt\_abstract\_base\< \_InternT, \_ExternT, \_StateT \>

This template class provides implementations of the public functions that forward to the protected virtual functions.

This template also provides abstract stubs for the protected virtual functions.

Definition at line 70 of file codecvt.h.

### Public Types

typedef \_ExternT **extern\_type**\
 typedef \_InternT **intern\_type**\
 typedef codecvt\_base::result **result**\
 typedef \_StateT **state\_type**\

### Public Member Functions

bool **always\_noconv** () const   throw ()\
 int **encoding** () const   throw ()\
 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 \
 int **length** (state\_type &\_\_state, const extern\_type \*\_\_from, const extern\_type \*\_\_end, size\_t \_\_max) const \
 int **max\_length** () const   throw ()\
 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 \
 result **unshift** (state\_type &\_\_state, extern\_type \*\_\_to, extern\_type \*\_\_to\_end, extern\_type \*&\_\_to\_next) const \

### Protected Member Functions

**\_\_codecvt\_abstract\_base** (size\_t \_\_refs=0)\
 virtual bool **do\_always\_noconv** () const =0  throw ()\
 virtual int **do\_encoding** () const =0  throw ()\
 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 =0\
 virtual int **do\_length** (state\_type &, const extern\_type \*\_\_from, const extern\_type \*\_\_end, size\_t \_\_max) const =0\
 virtual int **do\_max\_length** () const =0  throw ()\
 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 =0\
 virtual result **do\_unshift** (state\_type &\_\_state, extern\_type \*\_\_to, extern\_type \*\_\_to\_end, extern\_type \*&\_\_to\_next) const =0\

## Member Function Documentation

### 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` [protected, pure 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.

Implemented in **codecvt**, **codecvt\< char, char, mbstate\_t \>**, and **codecvt\< wchar\_t, char, mbstate\_t \>**.

Referenced by \_\_codecvt\_abstract\_base\< \_InternT, \_ExternT, \_\_gnu\_cxx::encoding\_state \>::out().

### 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` [inline]`

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 198 of file codecvt.h.

Referenced by basic\_filebuf::underflow().

### 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` [inline]`

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 118 of file codecvt.h.

### result unshift (state\_type & \_\_state, extern\_type \* \_\_to, extern\_type \* \_\_to\_end, extern\_type \*& \_\_to\_next) const` [inline]`

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 157 of file codecvt.h.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
