X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fcharacter-set-conversion.h;h=e2306fe30a8dd98e935247e5c85c253fa8f1e8ab;hp=7a6249822478f27a20a8dd3ebdaf323abfe0a57e;hb=6b496cacd2a596235a246c912a6b507a72d67ad4;hpb=cd7d41bc8e0a0816da28401207091344fbbe0b2c diff --git a/dali-toolkit/internal/text/character-set-conversion.h b/dali-toolkit/internal/text/character-set-conversion.h index 7a62498..e2306fe 100644 --- a/dali-toolkit/internal/text/character-set-conversion.h +++ b/dali-toolkit/internal/text/character-set-conversion.h @@ -20,9 +20,7 @@ // EXTERNAL INCLUDES #include - -// INTERNAL INCLUDES -#include +#include namespace Dali { @@ -30,6 +28,18 @@ namespace Dali namespace Toolkit { +namespace Text +{ + +/** + * @brief Retrieves the number of bytes of a utf8 character. + * + * @param[in] utf8LeadByte The lead byte of the utf8 character. + * + * @return The number of bytes of the character. + */ +uint8_t GetUtf8Length( uint8_t utf8LeadByte ); + /** * @brief Retrieves the number of characters of the text array encoded in UTF8 * @@ -55,6 +65,11 @@ uint32_t GetNumberOfUtf8Bytes( const uint32_t* const utf32, uint32_t numberOfCha * * The @p utf32 buffer needs to be big enough to store all the characters. * + * If the text contains a single 'CR' character or a pair 'CR'+'LF', they are replaced by a 'LF'. + * + * @note GetNumberOfUtf8Characters() does not convert 'CR' or 'CR'+'LF' to 'LF' so the return number + * of characters of that method may be higher than the number of characters returned by this one. + * * @param[in] utf8 The pointer to the UTF8 array. * @param[in] length The length of the UTF8 array. * @param[out] utf32 The pointer to the UTF32 array. @@ -76,6 +91,17 @@ uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length, uint32_t* utf3 */ uint32_t Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, uint8_t* utf8 ); +/** + * @brief Converts a text array encoded in UTF32 into a text array encoded in UTF8. + * + * @param[in] utf32 The pointer to the UTF32 array. + * @param[in] numberOfCharacters The number of characters of the UTF32 array. + * @param[out] utf8 The UTF8 characters will be stored here. + */ +void Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, std::string& utf8 ); + +} // namespace Text + } // namespace Toolkit } // namespace Dali