1 #ifndef __DALI_TOOLKIT_CHARACTER_SET_CONVERSION_H__
2 #define __DALI_TOOLKIT_CHARACTER_SET_CONVERSION_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
26 #include <dali/public-api/common/dali-common.h>
35 * @brief Retrieves the number of characters of the text array encoded in UTF8
37 * @param[in] utf8 The pointer to the UTF8 array.
38 * @param[in] length The length of the UTF8 array.
40 * @return The number of characters.
42 uint32_t GetNumberOfUtf8Characters( const uint8_t* const utf8, uint32_t length );
45 * @brief Retrieves the number of bytes needed to encode in UTF8 the given text array encoded in UTF32.
47 * @param[in] utf32 The pointer to the UTF32 array.
48 * @param[in] numberOfCharacters The number of characters of the UTF32 array.
50 * @return The number of bytes.
52 uint32_t GetNumberOfUtf8Bytes( const uint32_t* const utf32, uint32_t numberOfCharacters );
55 * @brief Converts a text array encoded in UTF8 into a text array encoded in UTF32.
57 * The @p utf32 buffer needs to be big enough to store all the characters.
59 * @param[in] utf8 The pointer to the UTF8 array.
60 * @param[in] length The length of the UTF8 array.
61 * @param[out] utf32 The pointer to the UTF32 array.
63 * @return The number of characters.
65 uint32_t Utf8ToUtf32( const uint8_t* const utf8, uint32_t length, uint32_t* utf32 );
68 * @brief Converts a text array encoded in UTF32 into a text array encoded in UTF8.
70 * The @p utf8 buffer needs to be big enough to store all the characters.
72 * @param[in] utf32 The pointer to the UTF32 array.
73 * @param[in] numberOfCharacters The number of characters of the UTF32 array.
74 * @param[out] utf8 The pointer to the UTF8 array.
76 * @return The number of bytes.
78 uint32_t Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, uint8_t* utf8 );
81 * @brief Converts a text array encoded in UTF32 into a text array encoded in UTF8.
83 * @param[in] utf32 The pointer to the UTF32 array.
84 * @param[in] numberOfCharacters The number of characters of the UTF32 array.
85 * @param[out] utf8 The UTF8 characters will be stored here.
87 void Utf32ToUtf8( const uint32_t* const utf32, uint32_t numberOfCharacters, std::string& utf8 );
89 } // namespace Toolkit
93 #endif // __DALI_TOOLKIT_CHARACTER_SET_CONVERSION_H__