basic_iconvļƒ

This encoding is only available if the configuration macro/build option for ZTD_PLATFORM_LIBICONV is turned on.

This encoding is tied to the iconv library. It will attempt to use the header and the functions directly, and if not otherwise bootstrap iconv on first use of the encoding through GetProcAddress/dlsym and related. If it cannot find it will either assert, abort, or loudly annoy the user in some way. The code is retrieved dynamically where possible unless the user explicitly defines the build option for ZTD_TEXT_USE_STATIC_LIBICONV (for CMake), as iconv is under a LGPL/GPL licensed and cannot be traditionally built / statically linked with application code (though in the future we may provide a way for software to do that if the software being made with this library is also GPL-compatible software).

iconv has a fixed set of encodings it can be compiled with to support. States are pre-constructed in the encoding itself and copied as necessary when encode_state or decode_states are being created to call the iconv functions. The user can inspect the output error parameter from the basic_iconv constructor to know of failure, or not pass in the output error parameter and instead take one of a assert, thrown exception, or abort (preferred invocation in that order).

template<typename _CodeUnit, typename _CodePoint = unicode_code_point>
class basic_iconv : public ztd::text::basic_no_encoding<_CodeUnit, _CodePoint>ļƒ

An encoding which is templated on code unit and code point and provides access to the iconv library.

Remark

The type is created with a name and provides a conversion routine when used. Because it is all done at runtime, it is considered a lossy conversion and thus requires prolific use of error handlers. If libiconv cannot be found, this type will produce a hard error on use.

Template Parameters
  • _CodeUnit ā€“ The code unit type.

  • _CodePoint ā€“ The code point type.