|  | codecvt Class Reference[Encoders]
#include <codecvt.hpp>
Collaboration diagram for codecvt:  [legend]List of all members. 
 Detailed DescriptionClass codecvt.
A small class to wrap the libiconv library. 
 
 
Definition at line 78 of file codecvt.hpp. 
|  |  | 
 Public Types |  | typedef xchar_t | intern_type |  | typedef char | extern_type |  | typedef mbstate_t | state_type |  | 
 Public Member Functions |  |  | codecvt (const::std::string &encoding_name, size_t refs=0) |  |  | Contructor. 
 
 |  | void | delete_encoding () |  |  | Free the libiconv memory. 
 
 |  | void | create_encoding (const::std::string &encoding_name) |  |  | Allocate the libiconv memory. 
 
 |  | virtual | ~codecvt () |  |  | Destructor. 
 
 |  | 
 Protected Member Functions |  | 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_limit, extern_type *&to_next) const |  |  | Conversion internal layer to external layer. 
 
 |  | 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_limit, intern_type *&to_next) const |  |  | Conversion external layer to internal layer. 
 
 |  | virtual result | do_unshift (state_type &state, extern_type *to, extern_type *to_limit, extern_type *&to_next) const |  |  | Put unshift character. 
 
 |  | virtual int | do_encoding () const   throw () |  |  | Encoding test. 
 
 |  | virtual bool | do_always_noconv () const   throw () |  |  | The protected virtual member function returns true only. 
 
 |  | virtual int | do_length (const state_type &state, const extern_type *from, const extern_type *end, size_t max) const |  |  | Number of external char needed to produce less than max internal char. 
 
 |  | virtual int | do_max_length () const   throw () |  |  | Return the max length encoding. 
 
 |  
 Member Typedef Documentation
 
 
 
 Constructor & Destructor Documentation
 
  
    | 
        
          | codecvt::codecvt | ( | const::std::string & | encoding_name, |  
          |  |  | size_t | refs = 0 |  
          |  | ) |  [explicit] |  |  
  
    |  | 
Contructor. 
 
The constructor initializes its locale::facet base object with locale::facet(refs). 
If refs==0, the lifetime is managed by the locale that contains this. If refs==1, the memory must be explcitly managed. the behavior for refs>1 is not defined.
 
Definition at line 80 of file codecvt.cpp.
 
References create_encoding(), and xchar_t.     |  
 
 Member Function Documentation
 
  
    | 
        
          | void codecvt::create_encoding | ( | const::std::string & | encoding_name | ) |  |  |  
 
  
    | 
        
          | void codecvt::delete_encoding | ( |  | ) |  |  |  
 
  
    | 
        
          | bool codecvt::do_always_noconv | ( |  | ) | const  throw ()  [protected, virtual] |  |  
  
    |  | 
The protected virtual member function returns true only. 
 
If every call to do_in or do_out returns noconv. The template version always returns true.
 
Definition at line 237 of file codecvt.cpp.     |  
 
  
    | 
        
          | int codecvt::do_encoding | ( |  | ) | const  throw ()  [protected, virtual] |  |  
  
    |  | 
Encoding test. 
 
 Returns:The protected virtual member function returns: 
-1, if the encoding of sequences of type to_type is state dependent 
0, if the encoding involves sequences of varying lengths 
n, if the encoding involves only sequences of length n 
 
Definition at line 230 of file codecvt.cpp.     |  
 
  
    |  | 
Conversion external layer to internal layer. 
 
The protected virtual member function endeavors to convert the source sequence at [from, from_end) to a destination sequence that it stores within [to, to_limit). It always stores in from_next a pointer to the first unconverted element in the source sequence, and it always stores in to_next a pointer to the first unaltered element in the destination sequence. 
state must represent the initial conversion state at the beginning of a new source sequence. The function alters its stored value, as needed, to reflect the current state of a successful conversion. Its stored value is otherwise unspecified. 
The template version always returns noconv. 
 Parameters:
  
    | state: | state transmission. |  | from: | first external char to convert. |  | from_end: | limit external char to convert. |  | from_next: | next external char to convert in return. |  | to: | first internal char destination. |  | to_limit: | internal char destination limit. |  | to_next: | next internal char destination. | 
 Returns:The function returns: 
codecvt_base::error if the source sequence is ill formed. 
codecvt_base::noconv if the function performs no conversion. 
codecvt_base::ok if the conversion succeeds. 
codecvt_base::partial if the source is insufficient, or if the destination is not large enough, for the conversion to succeed 
 
Definition at line 175 of file codecvt.cpp.
 
References codecvt_state::conv_out_in, extern_type, intern_type, and state_type.     |  
 
  
    |  | 
Number of external char needed to produce less than max internal char. 
 
The protected virtual member function effectively calls do_in(mystate, from, end, next1, buf, buf + max, next2) for mystate a copy of state, some buffer buf, and pointers next1 and next2. It then returns next2 - buf. (Thus, it counts the maximum number of conversions, not greater than max, defined by the source sequence at [from, end).) 
The template version always returns the lesser of last1 - first1 and len2.
 
Definition at line 244 of file codecvt.cpp.
 
References extern_type, state_type, and XIMOL_MIN.     |  
 
  
    | 
        
          | int codecvt::do_max_length | ( |  | ) | const  throw ()  [protected, virtual] |  |  
  
    |  | 
Return the max length encoding. 
 
The protected virtual member function returns the largest permissible value that can be returned by do_length(first1, last1, 1), for arbitrary valid values of first1 and last1. 
The template version always returns 1.
 
Definition at line 254 of file codecvt.cpp.     |  
 
  
    |  | 
Conversion internal layer to external layer. 
 
The protected virtual member function endeavors to convert the source sequence at [from, from_end) to a destination sequence that it stores within [to, to_limit). It always stores in from_next a pointer to the first unconverted element in the source sequence, and it always stores in to_next a pointer to the first unaltered element in the destination sequence. 
state must represent the initial conversion state at the beginning of a new source sequence. The function alters its stored value, as needed, to reflect the current state of a successful conversion. Its stored value is otherwise unspecified. 
The template version always returns noconv. 
 Parameters:
  
    | state: | state transmission. |  | from: | first internal char to convert. |  | from_end: | limit internal char to convert. |  | from_next: | next internal char to convert in return. |  | to: | first external char destination. |  | to_limit: | external char destination limit. |  | to_next: | next external char destination. | 
 Returns:The function returns: 
codecvt_base::error if the source sequence is ill formed. 
codecvt_base::noconv if the function performs no conversion. 
codecvt_base::ok if the conversion succeeds. 
codecvt_base::partial if the source is insufficient, or if the destination is not large enough, for the conversion to succeed. 
 
Definition at line 131 of file codecvt.cpp.
 
References codecvt_state::conv_in_out, extern_type, intern_type, and state_type.     |  
 
  
    |  | 
Put unshift character. 
 
The protected virtual member function endeavors to convert the source element intern_type(0) to a destination sequence that it stores within [to, to_limit), except for the terminating element extern_type(0). It always stores in to_next a pointer to the first unaltered element in the destination sequence. 
state must represent the initial conversion state at the beginning of a new source sequence. The function alters its stored value, as needed, to reflect the current state of a successful conversion. Typically, converting the source element intern_type(0) leaves the current state in the initial conversion state. 
The template version always returns noconv. 
 Parameters:
  
    | state: | state transmission. |  | to: | first external char destination. |  | to_limit: | external char destination limit. |  | to_next: | next external char destination. | 
 Returns:The function returns:
codecvt_base::error if state represents an invalid state 
codecvt_base::noconv if the function performs no conversion 
codecvt_base::ok if the conversion succeeds 
codecvt_base::partial if the destination is not large enough for the conversion to succeed 
 
Definition at line 219 of file codecvt.cpp.
 
References extern_type, and state_type.     |  The documentation for this class was generated from the following files:
 | 
 |