Thin iconv() wrapper.
More...
#include <glibmm/convert.h>
Thin iconv() wrapper.
glibmm provides
Glib::convert()
and
Glib::locale_to_utf8()
which are likely more convenient than the raw iconv wrappers. However, creating an
IConv
object once and using the
convert()
method could be useful when converting multiple times between the same charsets.
Open new conversion descriptor.
-
Parameters
-
to_codeset
|
Destination codeset.
|
from_codeset
|
Source codeset.
|
-
Exceptions
-
Glib::IConv::IConv
|
(
|
const
IConv
&
|
|
)
|
|
|
delete
|
Glib::IConv::IConv
|
(
|
GIConv
|
gobject
|
)
|
|
|
explicit
|
Close conversion descriptor.
Convert from one encoding to another.
-
Parameters
-
str
|
The string to convert.
|
-
Returns
-
The converted string.
-
Exceptions
-
GIConv Glib::IConv::gobj
|
(
|
|
)
|
|
|
inline
|
std::size_t Glib::IConv::iconv
|
(
|
char **
|
inbuf
,
|
|
|
gsize *
|
inbytes_left
,
|
|
|
char **
|
outbuf
,
|
|
|
gsize *
|
outbytes_left
|
|
)
|
|
|
Same as the standard UNIX routine iconv(), but may be implemented via libiconv on UNIX flavors that lack a native implementation.
glibmm provides
Glib::convert()
and
Glib::locale_to_utf8()
which are likely more convenient than the raw iconv wrappers.
-
Parameters
-
inbuf
|
Bytes
to convert.
|
inbytes_left
|
In/out parameter, bytes remaining to convert in
inbuf
.
|
outbuf
|
Converted output bytes.
|
outbytes_left
|
In/out parameter, bytes available to fill in
outbuf
.
|
-
Returns
-
Count of non-reversible conversions, or
static_cast<std::size_t>(-1)
on error.
void Glib::IConv::reset
|
(
|
|
)
|
|
Reset conversion descriptor to initial state.
Same as
iconv(0, 0, 0, 0)
, but implemented slightly differently in order to work on Sun Solaris <= 7. It's also more obvious so you're encouraged to use it.