CharsetConverter Class Reference

Character set converter. More...

#include <CharsetConverter.h++>

List of all members.

Public Member Functions

 CharsetConverter (const char *fromCode, const char *toCode)
 Construct a new CharsetConverter for converting characters from one encoding to another.
 ~CharsetConverter ()
 Destructor.
bool isValid () const throw ()
 Determine if the conversion specified in the constructor is valid.
size_t convert (const byte_t **inBuf, size_t *inBytesLeft, byte_t **outBuf, size_t *outBytesLeft) throw ()
 Convert bytes of data from the source encoding to the target encoding.
void reset () throw ()
 Reset the encoder.


Detailed Description

Character set converter.

This class is simply a thin wrapper around the libiconv character set conversion library.

Author:
Mark Lindner

Constructor & Destructor Documentation

CharsetConverter ( const char *  fromCode,
const char *  toCode 
)

Construct a new CharsetConverter for converting characters from one encoding to another.

After the object is constructed, a call should be made to isValid() to determine if the conversion is valid. See the libiconv documentation for a list of supported encodings.

Parameters:
fromCode The source encoding.
toCode The target encoding.

~CharsetConverter (  ) 

Destructor.


Member Function Documentation

size_t convert ( const byte_t **  inBuf,
size_t *  inBytesLeft,
byte_t **  outBuf,
size_t *  outBytesLeft 
) throw ()

Convert bytes of data from the source encoding to the target encoding.

This method may be called repeatedly to convert a large amount of text one block at a time; the shift state is preserved between calls. To begin converting a new

Parameters:
inBuf The input buffer.
inBytesLeft The number of input bytes remaining.
outBuf The output buffer.
outBytesLeft The number of output bytes remaining.
Returns:
The number of characters converted, or (size_t)-1 on failure; see iconv(3) for details.

bool isValid (  )  const throw () [inline]

Determine if the conversion specified in the constructor is valid.

void reset (  )  throw ()

Reset the encoder.

Sets the conversion state to the initial state.


The documentation for this class was generated from the following files:

Generated on Sat Apr 17 23:03:08 2010 for libcommonc++ by  doxygen 1.5.9