BLOCXX_NAMESPACE::IConv_t Class Reference

The IConv_t class is a wrapper to the UNIX98 iconv(3) functions. More...

#include <IConv.hpp>

List of all members.

Public Member Functions

 IConv_t ()
 Create an IConv object.
 IConv_t (const String &fromEncoding, const String &toEncoding)
 Create an IConv object and initializes its handle to convert between the specified character encodings.
 ~IConv_t ()
 Frees all resources and destroys the object.
bool open (const String &fromEncoding, const String &toEncoding)
 Initializes the IConv object handle to convert between the specified character encodings.
size_t convert (char **istr, size_t *ibytesleft, char **ostr, size_t *obytesleft)
 Converts the text in the input buffer and stores the result text in the output buffer.
bool close ()
 Frees all object resources.

Private Attributes

iconv_t m_iconv


Detailed Description

The IConv_t class is a wrapper to the UNIX98 iconv(3) functions.

See also the IConv namespace for some utility functions.

Definition at line 51 of file IConv.hpp.


Constructor & Destructor Documentation

BLOCXX_NAMESPACE::IConv_t::IConv_t (  ) 

Create an IConv object.

Definition at line 50 of file IConv.cpp.

BLOCXX_NAMESPACE::IConv_t::IConv_t ( const String fromEncoding,
const String toEncoding 
)

Create an IConv object and initializes its handle to convert between the specified character encodings.

Throws an error if the requested conversion is not available.

Parameters:
fromEncoding source encoding name
toEncoding destination encoding name
Exceptions:
StringConversionException if the conversion is not supported.

Definition at line 57 of file IConv.cpp.

References BLOCXX_THROW, BLOCXX_NAMESPACE::String::c_str(), and m_iconv.

BLOCXX_NAMESPACE::IConv_t::~IConv_t (  ) 

Frees all resources and destroys the object.

Definition at line 70 of file IConv.cpp.

References close().


Member Function Documentation

bool BLOCXX_NAMESPACE::IConv_t::open ( const String fromEncoding,
const String toEncoding 
)

Initializes the IConv object handle to convert between the specified character encodings.

See "man 3 iconv_open" for more detailed description.

Parameters:
fromEncoding source encoding name
toEncoding destination encoding name
Returns:
true on success, false and errno code on failure

Definition at line 78 of file IConv.cpp.

References BLOCXX_NAMESPACE::String::c_str(), close(), and m_iconv.

size_t BLOCXX_NAMESPACE::IConv_t::convert ( char **  istr,
size_t *  ibytesleft,
char **  ostr,
size_t *  obytesleft 
)

Converts the text in the input buffer and stores the result text in the output buffer.

See "man 3 iconv" for more detailed description.

Parameters:
istr pointer to input text buffer
ibytesleft number of bytes in ibuf
ostr pointer to output text buffer
obytesleft number of bytes in obuf
Returns:
0, number of non-reversible conversions or (size_t)-1 with reason in errno.

Definition at line 88 of file IConv.cpp.

References BLOCXX_ASSERT, and m_iconv.

Referenced by BLOCXX_NAMESPACE::IConv::fromByteString(), BLOCXX_NAMESPACE::IConv::fromWideString(), BLOCXX_NAMESPACE::IConv::toByteString(), and BLOCXX_NAMESPACE::IConv::toWideString().

bool BLOCXX_NAMESPACE::IConv_t::close (  ) 

Frees all object resources.

See "man 3 iconv_close" for more detailed description.

Returns:
true on success, false and errno code on failure

Definition at line 105 of file IConv.cpp.

References m_iconv.

Referenced by open(), and ~IConv_t().


Member Data Documentation

Definition at line 117 of file IConv.hpp.

Referenced by close(), convert(), IConv_t(), and open().


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

Generated on Wed Feb 25 19:05:05 2009 for blocxx by  doxygen 1.5.6