.. index:: pair: class; EE::Utf<16> .. _doxid-class_e_e_1_1_utf_3_0116_01_4: template class EE::Utf<16> ========================== .. toctree:: :hidden: Overview ~~~~~~~~ Specialization of the :ref:`Utf ` template for UTF-16. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include template <> class Utf<16> { public: // methods template static In :ref:`decode`(In begin, In end, :ref:`Uint32`& output, :ref:`Uint32` replacement = 0, bool byteSwap = false); template static Out :ref:`encode`(:ref:`Uint32` input, Out output, :ref:`Uint16` replacement = 0); template static In :ref:`next`(In begin, In end); template static std::size_t :ref:`count`(In begin, In end); template static Out :ref:`fromAnsi`(In begin, In end, Out output, const std::locale& locale = std::locale()); template static Out :ref:`fromWide`(In begin, In end, Out output); template static Out :ref:`fromLatin1`(In begin, In end, Out output); template static Out :ref:`toAnsi`(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); template static Out :ref:`toWide`(In begin, In end, Out output, wchar_t replacement = 0); template static Out :ref:`toLatin1`(In begin, In end, Out output, char replacement = 0); template static Out :ref:`toUtf8`(In begin, In end, Out output); template static Out :ref:`toUtf16`(In begin, In end, Out output); template static Out :ref:`toUtf32`(In begin, In end, Out output, bool byteSwap = false); }; .. _details-class_e_e_1_1_utf_3_0116_01_4: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Specialization of the :ref:`Utf ` template for UTF-16. Methods ------- .. index:: pair: function; decode .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1ab50caa64b136a3a7f57ce905b66c6bca: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static In decode(In begin, In end, :ref:`Uint32`& output, :ref:`Uint32` replacement = 0, bool byteSwap = false) Decode a single UTF-16 character. Decoding a character means finding its unique 32-bits code (called the codepoint) in the Unicode standard. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence * - output - Codepoint of the decoded UTF-16 character * - replacement - Replacement character to use in case the UTF-8 sequence is invalid .. rubric:: Returns: Iterator pointing to one past the last read element of the input sequence .. index:: pair: function; encode .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1af4389b5fdaa44a7b965f0cedf0219f0b: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static Out encode(:ref:`Uint32` input, Out output, :ref:`Uint16` replacement = 0) Encode a single UTF-16 character. Encoding a character means converting a unique 32-bits code (called the codepoint) in the target encoding, UTF-16. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - input - Codepoint to encode as UTF-16 * - output - Iterator pointing to the beginning of the output sequence * - replacement - Replacement for characters not convertible to UTF-16 (use 0 to skip them) .. rubric:: Returns: Iterator to the end of the output sequence which has been written .. index:: pair: function; next .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1a000793818493b87091c232438bdc61d1: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static In next(In begin, In end) Advance to the next UTF-16 character. This function is necessary for multi-elements encodings, as a single character may use more than 1 storage element. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence .. rubric:: Returns: Iterator pointing to one past the last read element of the input sequence .. index:: pair: function; count .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1ad7c927cc90f55de4278c7055d60d762e: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static std::size_t count(In begin, In end) Count the number of characters of a UTF-16 sequence. This function is necessary for multi-elements encodings, as a single character may use more than 1 storage element, thus the total size can be different from (begin - end). .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence .. rubric:: Returns: Iterator pointing to one past the last read element of the input sequence .. index:: pair: function; fromAnsi .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1aa5b21395788a56e7302bea2867c1168a: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static Out fromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()) Convert an ANSI characters range to UTF-16. The current global locale will be used by default, unless you pass a custom one in the *locale* parameter. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence * - output - Iterator pointing to the beginning of the output sequence * - locale - Locale to use for conversion .. rubric:: Returns: Iterator to the end of the output sequence which has been written .. index:: pair: function; fromWide .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1a79161b7c31e82866fa110b1e5679df08: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static Out fromWide(In begin, In end, Out output) Convert a wide characters range to UTF-16. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence * - output - Iterator pointing to the beginning of the output sequence .. rubric:: Returns: Iterator to the end of the output sequence which has been written .. index:: pair: function; fromLatin1 .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1af443003894b9511e827c93794a1963b7: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static Out fromLatin1(In begin, In end, Out output) Convert a latin-1 (ISO-8859-1) characters range to UTF-16. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence * - output - Iterator pointing to the beginning of the output sequence .. rubric:: Returns: Iterator to the end of the output sequence which has been written .. index:: pair: function; toAnsi .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1acc14614a8166fbf9d001e2944cda8ecc: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static Out toAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()) Convert an UTF-16 characters range to ANSI characters. The current global locale will be used by default, unless you pass a custom one in the *locale* parameter. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence * - output - Iterator pointing to the beginning of the output sequence * - replacement - Replacement for characters not convertible to ANSI (use 0 to skip them) * - locale - Locale to use for conversion .. rubric:: Returns: Iterator to the end of the output sequence which has been written .. index:: pair: function; toWide .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1af92726f4cb8e5737b05f8a5cd0016c49: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static Out toWide(In begin, In end, Out output, wchar_t replacement = 0) Convert an UTF-16 characters range to wide characters. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence * - output - Iterator pointing to the beginning of the output sequence * - replacement - Replacement for characters not convertible to wide (use 0 to skip them) .. rubric:: Returns: Iterator to the end of the output sequence which has been written .. index:: pair: function; toLatin1 .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1a1ffdaddc21d66377a761a57bdb21d9da: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static Out toLatin1(In begin, In end, Out output, char replacement = 0) Convert an UTF-16 characters range to latin-1 (ISO-8859-1) characters. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence * - output - Iterator pointing to the beginning of the output sequence * - replacement - Replacement for characters not convertible to wide (use 0 to skip them) .. rubric:: Returns: Iterator to the end of the output sequence which has been written .. index:: pair: function; toUtf8 .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1a430ba1ec99eb4c5dad566b9e197f2c52: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static Out toUtf8(In begin, In end, Out output) Convert a UTF-16 characters range to UTF-8. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence * - output - Iterator pointing to the beginning of the output sequence .. rubric:: Returns: Iterator to the end of the output sequence which has been written .. index:: pair: function; toUtf16 .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1a4ccf7fa0b7aac6cae03cf21688e540c2: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static Out toUtf16(In begin, In end, Out output) Convert a UTF-16 characters range to UTF-16. This functions does nothing more than a direct copy; it is defined only to provide the same interface as other specializations of the EE::Utf<> template, and allow generic code to be written on top of it. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence * - output - Iterator pointing to the beginning of the output sequence .. rubric:: Returns: Iterator to the end of the output sequence which has been written .. index:: pair: function; toUtf32 .. _doxid-class_e_e_1_1_utf_3_0116_01_4_1abd2aed6168d9ddfea331a5096db1f6ef: .. ref-code-block:: cpp :class: doxyrest-title-code-block template static Out toUtf32(In begin, In end, Out output, bool byteSwap = false) Convert a UTF-16 characters range to UTF-32. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - begin - Iterator pointing to the beginning of the input sequence * - end - Iterator pointing to the end of the input sequence * - output - Iterator pointing to the beginning of the output sequence .. rubric:: Returns: Iterator to the end of the output sequence which has been written