From 0f9e2bbdc4930e519cdf6903ae486e49e6fdadbb Mon Sep 17 00:00:00 2001 From: Hyunjee Kim Date: Thu, 10 Nov 2016 10:56:05 +0900 Subject: [PATCH] Change the structure due to remove deprecated API Change-Id: I8b94806e4bc952116b83d99b709394b2d3593bd1 Signed-off-by: Hyunjee Kim --- packaging/capi-base-utils.spec | 65 +- src/CMakeLists.txt | 9 +- src/include/cleaned/utils_i18n_timezone.h | 474 --------- src/include/cleaned/utils_i18n_usearch.h | 182 ---- src/include/cleaned/utils_i18n_ustring.h | 1326 ------------------------- src/include/deprecated/utils_i18n_timezone.h | 490 --------- src/include/deprecated/utils_i18n_usearch.h | 208 ---- src/include/deprecated/utils_i18n_ustring.h | 1367 -------------------------- src/include/utils_i18n_timezone.h | 15 - src/include/utils_i18n_usearch.h | 27 +- src/include/utils_i18n_ustring.h | 41 - src/utils_i18n_timezone.cpp | 16 - src/utils_i18n_usearch.c | 15 - src/utils_i18n_ustring.c | 19 - 14 files changed, 12 insertions(+), 4242 deletions(-) delete mode 100644 src/include/cleaned/utils_i18n_timezone.h delete mode 100644 src/include/cleaned/utils_i18n_usearch.h delete mode 100644 src/include/cleaned/utils_i18n_ustring.h delete mode 100644 src/include/deprecated/utils_i18n_timezone.h delete mode 100644 src/include/deprecated/utils_i18n_usearch.h delete mode 100644 src/include/deprecated/utils_i18n_ustring.h diff --git a/packaging/capi-base-utils.spec b/packaging/capi-base-utils.spec index 0b8277e..2d501ed 100755 --- a/packaging/capi-base-utils.spec +++ b/packaging/capi-base-utils.spec @@ -1,7 +1,7 @@ Name: capi-base-utils Summary: Base Utils -Version: 1.2.7 -Release: 2 +Version: 2.0.0 +Release: 1 Group: Base License: Apache-2.0 and ICU Source0: %{name}-%{version}.tar.gz @@ -12,7 +12,7 @@ BuildRequires: pkgconfig(dlog) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig - + %description The base utils library for internationalization and localization @@ -21,38 +21,20 @@ License: Apache-2.0 and ICU Summary: The Base Utils Library (Development) Group: Base Requires: %{name} = %{version}-%{release} -Provides: capi-base-utils-devel-profile_ivi -Provides: capi-base-utils-devel-profile_tv -Provides: capi-base-utils-devel-profile_wearable +Provides: capi-base-utils-devel-profile_common = %{version}-%{release} +Provides: capi-base-utils-devel-profile_mobile = %{version}-%{release} +Provides: capi-base-utils-devel-profile_ivi = %{version}-%{release} +Provides: capi-base-utils-devel-profile_tv = %{version}-%{release} +Provides: capi-base-utils-devel-profile_wearable = %{version}-%{release} %description devel The base utils library for internationalization and localization (Development) -%package devel-support-deprecated -License: Apache-2.0 and ICU -Summary: The Base Utils Library (Development) -Group: Base -Requires: capi-base-utils-devel = %{version}-%{release} -Provides: capi-base-utils-devel-profile_common -Provides: capi-base-utils-devel-profile_mobile - -%description devel-support-deprecated -The base utils library for internationalization and localization (Development) -with support of deprecated APIs for mobile/common/common-iot profiles in -Tizen 3. - - %prep %setup -q %build #export CFLAGS="$CFLAGS -Wall -Werror -Wno-unused-function" - -#internally, using headers with additional deprecated API does not affect those who do not want deprecated APIs. -cp src/include/deprecated/utils_i18n_timezone.h src/include/ -cp src/include/deprecated/utils_i18n_usearch.h src/include/ -cp src/include/deprecated/utils_i18n_ustring.h src/include/ - cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIB_INSTALL_DIR:PATH=%{_libdir} -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \ -DPKG_NAME=%{name} -DPKG_VERSION=%{version} \ @@ -69,32 +51,6 @@ cat LICENSE.ICU >> %{buildroot}/usr/share/license/%{name} %postun -p /sbin/ldconfig -%post devel -ln -s %{_includedir}/base/cleaned/utils_i18n_timezone.h %{_includedir}/base/ -ln -s %{_includedir}/base/cleaned/utils_i18n_usearch.h %{_includedir}/base/ -ln -s %{_includedir}/base/cleaned/utils_i18n_ustring.h %{_includedir}/base/ - -%postun devel -rm %{_includedir}/base/utils_i18n_timezone.h -rm %{_includedir}/base/utils_i18n_usearch.h -rm %{_includedir}/base/utils_i18n_ustring.h - -%post devel-support-deprecated -rm %{_includedir}/base/utils_i18n_timezone.h -rm %{_includedir}/base/utils_i18n_usearch.h -rm %{_includedir}/base/utils_i18n_ustring.h -ln -s %{_includedir}/base/deprecated/utils_i18n_timezone.h %{_includedir}/base/ -ln -s %{_includedir}/base/deprecated/utils_i18n_usearch.h %{_includedir}/base/ -ln -s %{_includedir}/base/deprecated/utils_i18n_ustring.h %{_includedir}/base/ - -%postun devel-support-deprecated -rm %{_includedir}/base/utils_i18n_timezone.h -rm %{_includedir}/base/utils_i18n_usearch.h -rm %{_includedir}/base/utils_i18n_ustring.h -ln -s %{_includedir}/base/cleaned/utils_i18n_timezone.h %{_includedir}/base/ -ln -s %{_includedir}/base/cleaned/utils_i18n_usearch.h %{_includedir}/base/ -ln -s %{_includedir}/base/cleaned/utils_i18n_ustring.h %{_includedir}/base/ - %files %manifest capi-base-utils.manifest %{_libdir}/libbase-utils-i18n.so* @@ -103,9 +59,4 @@ ln -s %{_includedir}/base/cleaned/utils_i18n_ustring.h %{_includedir}/base/ %files devel %defattr(-,root,root,-) %{_includedir}/base/utils_i18n*.h -%{_includedir}/base/cleaned/utils_i18n*.h %{_libdir}/pkgconfig/*.pc - -%files devel-support-deprecated -%defattr(-,root,root,-) -%{_includedir}/base/deprecated/utils_i18n*.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f0d3397..48fd25d 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -61,17 +61,14 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_types.h DESTINAT INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_uchar.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_ucollator.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_unormalization.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/cleaned/utils_i18n_usearch.h DESTINATION ${INCLUDE_INSTALL_DIR}/base/cleaned) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/deprecated/utils_i18n_usearch.h DESTINATION ${INCLUDE_INSTALL_DIR}/base/deprecated) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/cleaned/utils_i18n_ustring.h DESTINATION ${INCLUDE_INSTALL_DIR}/base/cleaned) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/deprecated/utils_i18n_ustring.h DESTINATION ${INCLUDE_INSTALL_DIR}/base/deprecated) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_usearch.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_ustring.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_ucalendar.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_udate.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_udatepg.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_ulocale.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_unumber.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/cleaned/utils_i18n_timezone.h DESTINATION ${INCLUDE_INSTALL_DIR}/base/cleaned) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/deprecated/utils_i18n_timezone.h DESTINATION ${INCLUDE_INSTALL_DIR}/base/deprecated) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_timezone.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_uenumeration.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_uset.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_ubrk.h DESTINATION ${INCLUDE_INSTALL_DIR}/base) diff --git a/src/include/cleaned/utils_i18n_timezone.h b/src/include/cleaned/utils_i18n_timezone.h deleted file mode 100644 index f8ddec0..0000000 --- a/src/include/cleaned/utils_i18n_timezone.h +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __UTILS_I18N_TIMEZONE_H__ -#define __UTILS_I18N_TIMEZONE_H__ - -#include - -/** - * @file utils_i18n_timezone.h - * @version 0.1 - * @brief utils_i18n_timezone - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup CAPI_BASE_UTILS_I18N_MODULE - * @defgroup CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE Timezone - * @brief The Timezone module represents a time zone offset, and also figures out daylight savings. - * @section CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE_OVERVIEW Overview - * @details The Timezone module represents a time zone offset, and also figures out daylight savings.\n - * Typically, you get an i18n_timezone_h using #i18n_timezone_create_default which creates a TimeZone based on the time zone - * where the program is running. For example, for a program running in Japan, - * #i18n_timezone_create_default creates an i18n_timezone_h based on Japanese Standard Time.\n - * You can also get an i18n_timezone_h using #i18n_timezone_create along with a time zone ID. - * For instance, the time zone ID for the US Pacific Time zone is "America/Los_Angeles". - * So, you can get a Pacific Time i18n_timezone_h with:\n - * - * i18n_timezone_h timezone;\n - * i18n_timezone_create(&timezone, "America/Los_Angeles");\n - * - * To create a new i18n_timezone_h, you call the factory function #i18n_timezone_create() and pass it a time zone ID. - * You can use the int #i18n_timezone_foreach_timezone_id() function to obtain a list of all the time zone IDs recognized by #i18n_timezone_create().\n - * You can also use #i18n_timezone_create_default() to create an i18n_timezone_h. This function uses platform-specific APIs to produce - * an i18n_timezone_h for the time zone corresponding to the client's computer's physical location. - * For example, if you're in Japan (assuming your machine is set up correctly), #i18n_timezone_create_default() - * will return an i18n_timezone_h for Japanese Standard Time ("Asia/Tokyo"). - */ - -/** - * @addtogroup CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE - * @{ - */ - -/** - * @brief Returns the "unknown" time zone. - * @details #i18n_timezone_create() returns a mutable clone of this time zone if the input ID is not recognized. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] timezone the "unknown" time zone. - * - * @retval #I18N_ERROR_NONE Successful - * @see i18n_timezone_create() - * @see i18n_timezone_create_gmt() - */ -int i18n_timezone_create_unknown(i18n_timezone_h *timezone); - -/** - * @brief The GMT (=UTC) time zone has a raw offset of zero and does not use daylight savings time. - * @details This is a commonly used time zone.\n - * Note: For backward compatibility reason, the ID used by the time zone returned by this method is "GMT", although the I18N's canonical ID for the GMT time zone is "Etc/GMT". - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] timezone the GMT/UTC time zone. - * - * @retval #I18N_ERROR_NONE Successful - * @see i18n_timezone_create_unknown() - */ -int i18n_timezone_create_gmt(i18n_timezone_h *timezone); - -/** - * @brief Creates an i18n_timezone_h for the given timezone_id. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] timezone the GMT/UTC time zone. - * @param[in] timezone_id the ID for an i18n_timezone_h, such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_create(i18n_timezone_h *timezone, const char *timezone_id); - -/** - * @brief Destroys an i18n_timezone_h. - * @details Once destroyed, an i18n_timezone_h may no longer be used. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to destroy. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_destroy(i18n_timezone_h timezone); - -/** - * @brief Returns an enumeration over system time zone IDs with the given filter conditions. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone_type The system time zone type. - * @param[in] region The ISO 3166 two-letter country code or UN M.49 three-digit area code. When NULL, no filtering done by region. - * @param[in] raw_offset An offset from GMT in milliseconds, ignoring the effect of daylight savings time, if any. When NULL, no filtering done by zone offset. - * @param[in] cb The callback function to get an enumeration object, owned by the caller. - * @param[in] user_data The user data to be passed to the callback function. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_foreach_timezone_id_by_region(i18n_system_timezone_type_e timezone_type, const char *region, const int32_t *raw_offset, i18n_timezone_id_cb cb, void *user_data); - -/** - * @brief Returns an enumeration over all recognized time zone IDs. - * (i.e., all strings that #i18n_timezone_create() accepts) - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] cb The callback function to get an enumeration object, owned by the caller. - * @param[in] user_data The user data to be passed to the callback function. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_foreach_timezone_id(i18n_timezone_id_cb cb, void *user_data); - -/** - * @brief Returns an enumeration over time zone IDs with a given raw offset from GMT. - * @details There may be several times zones with the same GMT offset that differ in the way they - * handle daylight savings time. For example, the state of Arizona doesn't observe daylight - * savings time. If you ask for the time zone IDs corresponding to GMT-7:00, - * you'll get back an enumeration over two time zone IDs: "America/Denver," - * which corresponds to Mountain Standard Time in the winter and Mountain Daylight Time in the summer, - * and "America/Phoenix", which corresponds to Mountain Standard Time year-round, even in the summer. - * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] raw_offset an offset from GMT in milliseconds, ignoring the effect of daylight savings time, if any - * @param[in] cb The callback function to get an enumeration object, owned by the caller. - * @param[in] user_data The user data to be passed to the callback function. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_foreach_timezone_id_with_offset(int32_t raw_offset, i18n_timezone_id_cb cb, void *user_data); - -/** - * @brief Returns an enumeration over time zone IDs associated with the given country. - * @details Some zones are affiliated with no country (e.g., "UTC"); these may also be retrieved, as a group. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] country The ISO 3166 two-letter country code, or NULL to retrieve zones not affiliated with any country. - * @param[in] cb The callback function to get an enumeration object, owned by the caller. - * @param[in] user_data The user data to be passed to the callback function. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_foreach_timezone_id_by_country(const char *country, i18n_timezone_id_cb cb, void *user_data); - -/** - * @brief Returns the number of IDs in the equivalency group that includes the given ID. - * @details An equivalency group contains zones that have the same GMT offset and rules.\n - * The returned count includes the given ID; it is always >= 1. The given ID must be a system time zone. If it is not, returns zero. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone_id a system time zone ID - * @param[out] count the number of zones in the equivalency group containing 'timezone_id', or zero if 'timezone_id' is not a valid system ID - * - * @retval #I18N_ERROR_NONE Successful - * @see i18n_timezone_get_equivalent_id() - */ -int i18n_timezone_count_equivalent_ids(const char *timezone_id, int32_t *count); - -/** - * @brief Returns an ID in the equivalency group that includes the given ID. - * @details An equivalency group contains zones that have the same GMT offset and rules.\n - * The given index must be in the range 0..n-1, where n is the out parameter value - * from i18n_timezone_count_equivalent_ids(timezone_id, &n). - * For some value of 'index', the returned value will be equal to the given id. - * If the given id is not a valid system time zone, - * or if 'index' is out of range, then returns an empty string. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone_id a system time zone ID - * @param[in] index a value from 0 to n-1, where n is the out parameter value from i18n_timezone_count_equivalent_ids(timezone_id, &n) - * @param[out] equivalent_timezone_id the ID of the index-th zone in the equivalency group containing 'timezone_id', - * or an empty string if 'timezone_id' is not a valid system ID or 'index' is out of range - * - * @retval #I18N_ERROR_NONE Successful - * @see i18n_timezone_count_equivalent_ids() - */ -int i18n_timezone_get_equivalent_id(const char *timezone_id, int32_t index, char **equivalent_timezone_id); - -/** - * @brief Creates a new copy of the default i18n_timezone_h for this host. - * @details Unless the default time zone has already been set using #i18n_timezone_set_default(), - * the default is determined by querying the system using methods in TPlatformUtilities. - * If the system routines fail, or if they specify an i18n_timezone_h or i18n_timezone_h offset - * which is not recognized, the i18n_timezone_h indicated by the ID kLastResortID - * is instantiated and made the default. - * - * This function determines the default timezone by querying the system once and storing the - * obtained timezone as default until the application terminates. - * - * To query the system for the current timezone, use i18n_timezone_detect_host_timezone(). - * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] timezone A default i18n_timezone_h. Clients are responsible for deleting the time zone object returned. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_create_default(i18n_timezone_h *timezone); - -/** - * @brief Sets the default time zone (i.e., what's returned by #i18n_timezone_create_default()) to be the specified time zone. - * @details If NULL is specified for the time zone, the default time zone is set to the default host time zone. - * The caller remains responsible for deleting it. \n - * This function is not thread safe. It is an error for multiple threads to concurrently attempt to set - * the default time zone, or for any thread to attempt to reference the default zone while another thread is setting it. - * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * @remarks Do not use unless you know what you are doing. - * - * @param[in] timezone The given timezone. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_set_default(i18n_timezone_h timezone); - -/** - * @brief Returns the timezone data version currently used by I18N. - * @remarks The specific error code can be obtained using the get_last_result() - * method. Error codes are described in #i18n_error_code_e description. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @return the version string, such as "2007f" - * @exception #I18N_ERROR_NONE Successful - */ -const char *i18n_timezone_get_tzdata_version(void); - -/** - * @brief Gets the region code associated with the given system time zone ID. - * @details The region code is either ISO 3166 2-letter country code or UN M.49 3-digit area code. - * When the time zone is not associated with a specific location, for example - "Etc/UTC", - * "EST5EDT", then this method returns "001" (UN M.49 area code for World). - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone_id The system time zone ID. - * @param[out] region Output buffer for receiving the region code. - * @param[out] region_len The length of the region code. - * @param[in] region_capacity The size of the output buffer. If it is lower than required @a region buffer size, - * then I18N_ERROR_BUFFER_OVERFLOW error is returned. - * - * @return the version string, such as "2007f" - */ -int i18n_timezone_get_region(const char *timezone_id, char *region, int32_t *region_len, int32_t region_capacity); - -/** - * @brief Returns the time zone raw and GMT offset for the given moment in time. - * @details Upon return, local-millis = GMT-millis + rawOffset + dstOffset. All computations are performed - * in the proleptic Gregorian calendar. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get an offset. - * @param[in] date moment in time for which to return offsets, in units of milliseconds from January 1, 1970 0:00 GMT, either GMT time or local wall time, depending on `local'. - * @param[in] local output if true, `date' is local wall time; otherwise it is in GMT time. - * @param[out] raw_offset parameter to receive the raw offset, that is, the offset not including DST adjustments - * @param[out] dst_offset output parameter to receive the DST offset, that is, the offset to be added to `raw_offset' to obtain the total offset between local and GMT time. If DST is not in effect, this value is zero; otherwise it is a positive value, typically one hour. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_offset_with_date(i18n_timezone_h timezone, i18n_udate date, i18n_ubool local, int32_t *raw_offset, int32_t *dst_offset); - -/** - * @brief Sets the i18n_timezone_h's raw GMT offset - * (i.e., the number of milliseconds to add to GMT to get local time, before taking daylight savings time into account). - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to set a raw offset. - * @param[in] offset_milliseconds The new raw GMT offset for this time zone. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_set_raw_offset(i18n_timezone_h timezone, int32_t offset_milliseconds); - -/** - * @brief Gets the i18n_timezone_h's raw GMT offset (i.e., the number of milliseconds - * to add to GMT to get local time, before taking daylight savings time into account). - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a raw offset. - * @param[out] offset_milliseconds The i18n_timezone_h's raw GMT offset. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_raw_offset(i18n_timezone_h timezone, int32_t *offset_milliseconds); - -/** - * @brief Fills in "timezone_id" with the i18n_timezone_h's ID. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a timezone ID. - * @param[out] timezone_id Receives this i18n_timezone_h's ID. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_id(i18n_timezone_h timezone, char **timezone_id); - -/** - * @brief Sets the i18n_timezone_h's ID to the specified value. - * @details This doesn't affect any other fields. for example,\n - * \n - * i18n_timezone_h timezone = NULL;\n - * i18n_timezone_create ( &timezone, "America/New_York" );\n - * i18n_timezone_set_id ( "America/Los_Angeles" );\n - * \n - * the timezone's GMT offset and daylight-savings rules don't change to those for Los Angeles. - * They're still those for New York. Only the ID has changed. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to set a timezone ID. - * @param[in] timezone_id The new time zone ID. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_set_id(i18n_timezone_h timezone, const char *timezone_id); - -/** - * @brief Returns a name of this time zone suitable for presentation to the user in the default locale. - * @details This method returns the long name, not including daylight savings. - * If the display name is not available for the locale, then this method returns a string in the localized GMT offset format such as GMT[+-]HH:mm. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a display name. - * @param[out] display_name The human-readable name of this time zone in the default locale. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_display_name(i18n_timezone_h timezone, char **display_name); - -/** - * @brief Returns a name of this time zone suitable for presentation to the user in the default locale. - * @details This method returns the long name, not including daylight savings. - * If the display name is not available for the locale, then this method returns a string in the localized GMT offset format such as GMT[+-]HH:mm. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a display name. - * @param[in] language The language in which to supply the display name. This parameter can be NULL; if so, the locale is initialized to match the current default locale. - * @param[in] country The country in which to supply the display name. This parameter can be NULL. - * @param[out] display_name The human-readable name of this time zone in the default locale. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_display_name_with_locale(i18n_timezone_h timezone, const char *language, const char *country , char **display_name); - -/** - * @brief Returns a name of this time zone suitable for presentation to the user in the default locale. - * @details If the display name is not available for the locale, - * then this method returns a string in the localized GMT offset format such as GMT[+-]HH:mm. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a display name. - * @param[in] daylight If true, display_name is filled with the daylight savings name. - * @param[in] style The style displayed on. - * @param[out] display_name The human-readable name of this time zone in the default locale. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_display_name_with_type(i18n_timezone_h timezone, i18n_ubool daylight, i18n_timezone_display_type_e style, char **display_name); - -/** - * @brief Returns a name of this time zone suitable for presentation to the user in the default locale. - * @details If the display name is not available for the locale, - * then this method returns a string in the localized GMT offset format such as GMT[+-]HH:mm. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a display name. - * @param[in] daylight If true, display_name is filled with the daylight savings name. - * @param[in] style The style displayed on. - * @param[in] language The language in which to supply the display name. This parameter can be NULL; if so, the locale is initialized to match the current default locale. - * @param[in] country The country in which to supply the display name. This parameter can be NULL. - * @param[out] display_name The human-readable name of this time zone in the default locale. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_display_name_with_type_locale(i18n_timezone_h timezone, i18n_ubool daylight, i18n_timezone_display_type_e style, const char *language, const char *country, char **display_name); - -/** - * @brief Queries if this time zone uses daylight savings time. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to know whether uses daylight savings time or not. - * @param[out] daylight_time True if this time zone uses daylight savings time, False, otherwise. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_use_daylight_time(i18n_timezone_h timezone, i18n_ubool *daylight_time); - -/** - * @brief Returns true if this zone has the same rule and offset as another zone. - * @details That is, if this zone differs only in ID, if at all. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to know whether has the same rule or not. - * @param[in] other The i18n_timezone_h to be compared with. - * @param[out] same_rule True if the given zone is the same as this one, with the possible exception of the ID. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_has_same_rule(i18n_timezone_h timezone, i18n_timezone_h other, i18n_ubool *same_rule); - -/** - * @brief Clones i18n_timezone_h polymorphically. - * @details Clients are responsible for deleting the i18n_timezone_h cloned. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to clone. - * @param[out] clone A new copy of this i18n_timezone_h. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_clone(i18n_timezone_h timezone, i18n_timezone_h *clone); - -/** - * @brief Returns the amount of time to be added to local standard time to get local wall clock time. - * @details The default implementation always returns 3600000 milliseconds (i.e., one hour) if this time zone observes Daylight Saving Time. - * Otherwise, 0 (zero) is returned.\n - * If an underlying TimeZone implementation subclass supports historical Daylight Saving Time changes, - * this method returns the known latest daylight saving value. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get DST savings. - * @param[out] dst_savings The amount of saving time in milliseconds. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_dst_savings(i18n_timezone_h timezone, int32_t *dst_savings); - -/** - * @brief Creates an #i18n_timezone_h detected from the current host system configuration. - * @details This function does not change the default time zone and does not update the current - * ICU's default. It may return a different #i18n_timezone_h from the one returned by - * i18n_timezone_create_default(). - * @since_tizen 3.0 - * - * @param[out] timezone A new instance of #i18n_timezone_h detected from the current host system - * configuration. Users are responsible for deleting the returned time zone object with - * i18n_timezone_destroy(). - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_timezone_detect_host_timezone(i18n_timezone_h *timezone); - -#ifdef __cplusplus -} -#endif - -/** - * @} - * @} - */ -#endif /* __UTILS_I18N_TIMEZONE_H__*/ diff --git a/src/include/cleaned/utils_i18n_usearch.h b/src/include/cleaned/utils_i18n_usearch.h deleted file mode 100644 index 35b7d03..0000000 --- a/src/include/cleaned/utils_i18n_usearch.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __UTILS_I18N_USEARCH_H__ -#define __UTILS_I18N_USEARCH_H__ - -#include - -/** - * @file utils_i18n_usearch.h - * @version 0.1 - * @brief utils_i18n_usearch - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup CAPI_BASE_UTILS_I18N_MODULE - * @defgroup CAPI_BASE_UTILS_I18N_USEARCH_MODULE Usearch - * @brief The Usearch module provides language-sensitive text searching based on the comparison rules defined in a ucollator data struct. - * - * @section CAPI_BASE_UTILS_I18N_USEARCH_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_BASE_UTILS_I18N_USEARCH_MODULE_OVERVIEW Overview - * @details The Usearch module provides language-sensitive text searching based on the comparison rules defined in a ucollator data struct. - * - * @section CAPI_BASE_UTILS_I18N_USEARCH_MODULE_SAMPLE_CODE_1 Sample Code 1 - * @brief Searches the pattern and gets the matched text. - * @code - char *string = "TIZEN"; - char *keyword = "ZE"; - i18n_uchar target[16] = {0,}; - i18n_uchar pattern[16] = {0,}; - i18n_uchar u_matched[16] = {0,}; - char tmp[1] = {0}; - i18n_usearch_h search = NULL; - int pos = 0; - int matched_text_len = 0; - int i = 0; - i18n_error_code_e error_code; - - i18n_ustring_from_UTF8( target, 16, NULL, string, -1, &error_code ); - i18n_ustring_from_UTF8( pattern, 16, NULL, keyword, -1, &error_code ); - - // creates a search - i18n_usearch_create_new( pattern, -1, target, -1, "en_US", NULL, &search ); - - // gets the first index of the target that matches with the pattern - i18n_usearch_first( search, &pos ); - dlog_print(DLOG_INFO, LOG_TAG, "the first index = %d", pos ); // The first index = 2 - - // gets the matched text - i18n_usearch_get_matched_text( search, u_matched, 16, &matched_text_len ); - for ( i = 0; i < matched_text_len; i++) { - i18n_ustring_copy_au_n( tmp, &u_matched[i], 1 ); - dlog_print(DLOG_INFO, LOG_TAG, "u_matched[%d] = %c", i, tmp[0] ); // u_matched[0] = Z, u_matched[1] = E - } - i18n_usearch_destroy( search ); - * @endcode - */ - -/** - * @addtogroup CAPI_BASE_UTILS_I18N_USEARCH_MODULE - * @{ - */ - -/** - * @brief Creates an #i18n_usearch_h using the argument locale language rule set. - * @details A collator will be created in the process, which will be owned by - * this search and will be deleted in i18n_usearch_destroy(). - * @remarks Must release @a search_iter using i18n_usearch_destroy(). - * @since_tizen 2.3.1 - * - * @param[in] pattern The pattern for matching - * @param[in] pattern_len The length of the pattern, otherwise @c -1 for NULL-termination - * @param[in] text The text string - * @param[in] text_len The length of the text string, otherwise @c -1 for NULL-termination - * @param[in] locale The name of the locale for the rules to be used - * @param[in] break_iter An #i18n_ubreak_iterator_h that will be used to restrict the points at which matches are detected. If a match is found,\n - * but the match's start or end index is not a boundary as determined by the #i18n_ubreak_iterator_h, - * the match will be rejected and another will be searched for. If this parameter is @c NULL,\n - * no break detection is attempted. - * @param[out] search_iter The #i18n_usearch_h, otherwise @c NULL if there is an error - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_usearch_create_new(const i18n_uchar *pattern, int32_t pattern_len, const i18n_uchar *text, - int32_t text_len, const char *locale, i18n_ubreak_iterator_h break_iter, i18n_usearch_h *search_iter); - -/** - * @brief Destroys and cleans up the i18n_usearch_h. - * @details If a collator is created in i18n_usearch_create(), it will be destroyed here. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] search_iter The i18n_usearch_h to clean up - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_usearch_destroy(i18n_usearch_h search_iter); - -/** - * @brief Returns the text that matches by the most recent call to i18n_usearch_first(), or so on. - * @details If the iterator is not pointing at a valid match (e.g. just after - * construction or after #I18N_USEARCH_DONE has been returned, it returns - * an empty string. If the result is not large enough to store the matched text, - * the result will be filled with the partial text and an #I18N_ERROR_BUFFER_OVERFLOW - * will be returned in status. The result will be NULL-terminated whenever - * possible. If the buffer fits the matched text exactly, a NULL-termination - * is not possible. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] search_iter The search iterator handle - * @param[out] result i18n_uchar The buffer to store the matched string - * @param[in] result_capacity The length of the result buffer - * @param[out] len_matched_text The exact length of the matched text, not counting the NULL-termination - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @retval #I18N_ERROR_BUFFER_OVERFLOW A result would not fit in the supplied buffer - */ -int i18n_usearch_get_matched_text(const i18n_usearch_h search_iter, i18n_uchar *result, int32_t result_capacity, int32_t *len_matched_text); - -/** - * @brief Gets the collator used for the language rules. - * @details Deleting the returned i18n_ucollator_h before calling - * i18n_usearch_destroy() would cause the string search to fail. - * i18n_usearch_destroy() will delete the collator if this search owns it. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] search_iter The search iterator handle - * @param[out] collator The collator - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_usearch_get_collator(const i18n_usearch_h search_iter, i18n_ucollator_h *collator); - -/** - * @brief Returns the first index at which the string text matches the search pattern. - * @details The iterator is adjusted so that its current index - * is the match position if one is found. - * If a match is not found, #I18N_USEARCH_DONE will be returned and - * the iterator will be adjusted to the index #I18N_USEARCH_DONE. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] search_iter The search iterator handle - * @param[out] index_first The character index of the first match, - * otherwise #I18N_USEARCH_DONE if there are no matches. - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_usearch_first(i18n_usearch_h search_iter, int32_t *index_first); - -#ifdef __cplusplus -} -#endif - -/** - * @} - * @} - */ - -#endif /* __UTILS_I18N_USEARCH_H__*/ diff --git a/src/include/cleaned/utils_i18n_ustring.h b/src/include/cleaned/utils_i18n_ustring.h deleted file mode 100644 index ce2d838..0000000 --- a/src/include/cleaned/utils_i18n_ustring.h +++ /dev/null @@ -1,1326 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright (C) 1998-2012, International Business Machines - * Corporation and others. All Rights Reserved. - */ - -#ifndef __UTILS_I18N_USTRING_H__ -#define __UTILS_I18N_USTRING_H__ - -#include - -/** - * @file utils_i18n_ustring.h - * @version 0.1 - * @brief utils_i18n_ustring - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup CAPI_BASE_UTILS_I18N_MODULE - * @defgroup CAPI_BASE_UTILS_I18N_USTRING_MODULE Ustring - * @brief The Ustring module provides general unicode string handling information. - * - * @section CAPI_BASE_UTILS_I18N_USTRING_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_BASE_UTILS_I18N_USTRING_MODULE_OVERVIEW Overview - * @details The Ustring module provides general unicode string handling information. - * - * @section CAPI_BASE_UTILS_I18N_USTIRING_MODULE_SAMPLE_CODE_1 Sample Code 1 - * @brief It converts a byte string to a unicode string and then to uppercase letters. - * @code - char str_1[64] = {0,}; - i18n_uchar uchar_str_1[64] = {0,}; - i18n_uchar uchar_str_2[64] = {0,}; - int uchar_len = 0; - i18n_uerror_code_e err_code = I18N_ERROR_NONE; - - strcpy(str_1, "tizen"); - dlog_print(DLOG_INFO, LOG_TAG, "str_1 is %s\n", str_1); // str_1 is tizen - - // converts a byte string to a unicode string - i18n_ustring_copy_ua_n(uchar_str_1, str_1, strlen(str_1)); - - // converts to uppercase letters - i18n_ustring_to_upper(uchar_str_2, 64, uchar_str_1, i18n_ustring_get_length( uchar_str_1 ), "en_US", &err_code); - - i18n_ustring_copy_au(str_1, uchar_str_2); - dlog_print(DLOG_INFO, LOG_TAG, "str_1 is %s\n", str_1); // str_1 is TIZEN - * @endcode - */ - -/** - * @addtogroup CAPI_BASE_UTILS_I18N_USTRING_MODULE - * @{ - */ - -/** - * @brief Determines the length of an array of #i18n_uchar. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The array of #i18n_uchar characters, @c NULL (U+0000) terminated. - * - * @return The number of #i18n_uchar characters in @c chars, minus the terminator - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_get_length(const i18n_uchar *s); - -/** - * @brief Counts Unicode code points in the length #i18n_uchar code units of the string. - * @details A code point may occupy either one or two #i18n_uchar code units. - * Counting code points involves reading all code units. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The input string. - * @param[in] length The number of #i18n_uchar code units to be checked, or @c -1 to count - * all code points before the first NULL (U+0000). - * - * @return The number of code points in the specified code units. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_count_char32(const i18n_uchar *s, int32_t length); - -/** - * @brief Checks if the string contains more Unicode code points than a certain number. - * @details This is more efficient than counting all code points in the entire string and comparing that number with a threshold. - * This function may not need to scan the string at all if the length is known (not @c -1 for NULL-termination) and falls within a certain range, - * and never needs to count more than 'number+1' code points. - * Logically equivalent to ( i18n_ustring_count_char32 (s, length, &number_of_code_points); number_of_code_points > number ). - * A Unicode code point may occupy either one or two #i18n_uchar code units. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The input string. - * @param[in] length The length of the string, or @c -1 if it is NULL-terminated. - * @param[in] number The number of code points in the string is compared against the @a number parameter. - * - * @return Boolean value for whether the string contains more Unicode code points than @a number. Same as ( i18n_ustring_count_char32 (s, length, &number_of_code_points); number_of_code_points > number). - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_ubool i18n_ustring_has_more_char32_than(const i18n_uchar *s, int32_t length, int32_t number); - -/** - * @brief Concatenates two ustrings. - * @details Appends a copy of @a src, including the NULL terminator, to @a dest. - * The initial copied character from @a src overwrites the NULL terminator in @a dest. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string. - * @param[in] src The source string. - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_cat(i18n_uchar *dest, const i18n_uchar *src); - -/** - * @brief Concatenate two ustrings. - * @details Appends a copy of @a src, including the NULL terminator, to @a dest. - * The initial copied character from @a src overwrites the NULL terminator in @a dest. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string. - * @param[in] src The source string. - * @param[in] n The maximum number of characters to append; no-op if <=0. - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_cat_n(i18n_uchar *dest, const i18n_uchar *src, int32_t n); - -/** - * @brief Finds the first occurrence of a substring in a string. - * @details The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate - * or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. - * Otherwise, the substring edge units would be matched against halves of surrogate pairs. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] sub_string The substring to find (NULL-terminated). - * - * @return A pointer to the first occurrence of @a sub_string in @a s, - * or @a s itself if the @a sub_string is empty, - * or @c NULL if @a sub_string is not in @a s. - * - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * - * @see i18n_ustring_r_string() - * @see i18n_ustring_find_first() - * @see i18n_ustring_find_last() - */ -i18n_uchar *i18n_ustring_string(const i18n_uchar *s, const i18n_uchar *sub_string); - -/** - * @brief Finds the first occurrence of a substring in a string. - * @details The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate - * or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. - * Otherwise, the substring edge units would be matched against halves of surrogate pairs. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] length The length of @a s (number of #i18n_uchar characters), or @c -1 if it is NULL-terminated. - * @param[in] sub_string The substring to find (NULL-terminated). - * @param[in] sub_length The length of substring (number of #i18n_uchar characters), or @c -1 if it is NULL-terminated. - * - * @return A pointer to the first occurrence of @a sub_string in @a s, - * or @a s itself if the @a sub_string is empty, - * or @c NULL if @a sub_string is not in @a s. - * - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * - * @see i18n_ustring_string() - * @see i18n_ustring_find_last() - */ -i18n_uchar *i18n_ustring_find_first(const i18n_uchar *s, int32_t length, const i18n_uchar *sub_string, int32_t sub_length); - -/** - * @brief Finds the first occurrence of a BMP code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] c The BMP code point to find. - * - * @return A pointer to the first occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_char32() - * @see i18n_ustring_mem_char() - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_char(const i18n_uchar *s, i18n_uchar c); - -/** - * @brief Finds the first occurrence of a code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] c The code point to find. - * - * @return A pointer to the first occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_char() - * @see i18n_ustring_mem_char32() - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_char32(const i18n_uchar *s, i18n_uchar32 c); - -/** - * @brief Finds the last occurrence of a substring in a string. - * @details The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate - * or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. - * Otherwise, the substring edge units would be matched against halves of surrogate pairs. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] sub_string The substring to find (NULL-terminated). - * - * @return A pointer to the last occurrence of @a substring in @a s, - * or @a s itself if the @a sub_string is empty, - * or @c NULL if @a sub_string is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - * @see i18n_ustring_find_last() - */ -i18n_uchar *i18n_ustring_r_string(const i18n_uchar *s, const i18n_uchar *sub_string); - -/** - * @brief Finds the last occurrence of a substring in a string. - * @details The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate - * or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. - * Otherwise, the substring edge units would be matched against halves of surrogate pairs. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search. - * @param[in] length The length of s (number of #i18n_uchar), or @c -1 if it is NULL-terminated. - * @param[in] sub_string The sub_string to find (NULL-terminated). - * @param[in] sub_length The length of sub_string (number of #i18n_uchar), or @c -1 if it is NULL-terminated. - * - * @return A pointer to the last occurrence of @a sub_string in @a s, - * or @a s itself if the @a substring is empty, - * or @c NULL if @a sub_string is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_find_last(const i18n_uchar *s, int32_t length, const i18n_uchar *sub_string, int32_t sub_length); - -/** - * @brief Finds the last occurrence of a BMP code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] c The BMP code point to find. - * - * @return A pointer to the last occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_char32() - * @see i18n_ustring_mem_char() - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_r_char(const i18n_uchar *s, i18n_uchar c); - -/** - * @brief Finds the last occurrence of a code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] c The code point to find. - * - * @return A pointer to the last occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_char() - * @see i18n_ustring_mem_char32() - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_r_char32(const i18n_uchar *s, i18n_uchar32 c); - -/** - * @brief Locates the first occurrence in the string of any of the characters in the string matchSet. - * @details Works just like C's strpbrk but with Unicode. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] string The string in which to search, NULL-terminated. - * @param[in] match_set A NULL-terminated string defining a set of code points for which to search in the text string. - * - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @return A pointer to the character in @a string that matches one of the - * characters in @a match_set, or NULL if no such character is found. - */ -i18n_uchar *i18n_ustring_pbrk(const i18n_uchar *string, const i18n_uchar *match_set); - -/** - * @brief Returns the number of consecutive characters in string, beginning with the first, that do not occur somewhere in match_set. - * @details Works just like C's strcspn but with Unicode. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] string The string in which to search, NULL-terminated. - * @param[in] match_set A NULL-terminated string defining a set of code points for which to search in the text string. - * - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @return The number of initial characters in @a string that do not - * occur in @a match_set. - */ -int32_t i18n_ustring_cspn(const i18n_uchar *string, const i18n_uchar *match_set); - -/** - * @brief Returns the number of consecutive characters in string, beginning with the first, that occur somewhere in match_set. - * @details Works just like C's strspn but with Unicode. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] string The string in which to search, NULL-terminated. - * @param[in] match_set A NULL-terminated string defining a set of code points for which to search in the text string. - * @return The number of initial characters in @a string that do - * occur in @a match_set. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_spn() - */ -int32_t i18n_ustring_spn(const i18n_uchar *string, const i18n_uchar *match_set); - -/** - * @brief The string tokenizer API allows an application to break a string into tokens. - * @details Works just like C's strspn but with Unicode. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] src String containing token(s). This string will be modified. After the first call to #i18n_ustring_tokenizer_r(), this argument must be NULL to get to the next token. - * @param[in] delim Set of delimiter characters (Unicode code points). - * @param[out] save_state The current pointer within the original string, which is set by this function. - * The save_state parameter should the address of a local variable of type #i18n_uchar *. - * @return A pointer to the next token found in src, or NULL - * when there are no more tokens. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_tokenizer_r(i18n_uchar *src, const i18n_uchar *delim, i18n_uchar **save_state); - -/** - * @brief Compares two Unicode strings for bitwise equality (code unit order). - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @return 0 if @a s1 and @a s2 are bitwise equal; a negative - * value if @a s1 is bitwise less than @a s2; a positive - * value if @a s1 is bitwise greater than @a s2. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_compare(const i18n_uchar *s1, const i18n_uchar *s2); - -/** - * @brief Compare two Unicode strings in code point order. - * @details See #i18n_ustring_compare() for details. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @return a negative/zero/positive integer corresponding to whether - * the first string is less than/equal to/greater than the second one - * in code point order - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_compare_code_point_order(const i18n_uchar *s1, const i18n_uchar *s2); - -/** - * @brief Compare two Unicode strings (binary order). - * @details The comparison can be done in code unit order or in code point order. They differ only in UTF-16 when comparing supplementary code points - * (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). In code unit order, high BMP code points sort after - * supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff.\n - * This functions works with strings of different explicitly specified lengths unlike the ANSI C-like #i18n_ustring_compare() and #i18n_ustring_mem_compare() etc. - * NULL-terminated strings are possible with length arguments of -1. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 First source string. - * @param[in] length1 Length of first source string, or @c -1 if NULL-terminated. - * @param[in] s2 Second source string. - * @param[in] length2 Length of second source string, or @c -1 if NULL-terminated. - * @param[in] code_point_order Choose between code unit order (false) and code point order (true). - * @return < 0, 0 or > 0 as usual for string comparisons - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_compare_binary_order(const i18n_uchar *s1, int32_t length1, const i18n_uchar *s2, int32_t length2, i18n_ubool code_point_order); - -/** - * @brief Compare two strings case-insensitively using full case folding. - * @details The comparison can be done in UTF-16 code unit order or in code point order. They differ only when comparing - * supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). - * In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff.\n - * This functions works with strings of different explicitly specified lengths unlike the ANSI C-like #i18n_ustring_compare() and i18n_ustring_mem_compare() etc. - * NULL-terminated strings are possible with length arguments of -1. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 First source string. - * @param[in] length1 Length of first source string, or @c -1 if NULL-terminated. - * @param[in] s2 Second source string. - * @param[in] length2 Length of second source string, or @c -1 if NULL-terminated. - * @param[in] options A bit set of options:\n - * - #I18N_USTRING_U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding.\n - * - #I18N_USTRING_U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see i18n_ustring_compare_code_pointer_order() for details).\n - * - #I18N_USTRING_U_FOLD_CASE_EXCLUDE_SPECIAL_I - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return <0 or 0 or >0 as usual for string comparisons - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_case_compare_with_length(const i18n_uchar *s1, int32_t length1, const i18n_uchar *s2, int32_t length2, uint32_t options, i18n_error_code_e *error_code); - -/** - * @brief Compare two ustrings for bitwise equality. - * @details Compares at most n characters. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare (can be NULL/invalid if n<=0). - * @param[in] s2 A string to compare (can be NULL/invalid if n<=0). - * @param[in] n The maximum number of characters to compare; always returns 0 if n<=0. - * @return 0 if @a s1 and @a s2 are bitwise equal; a negative - * value if @a s1 is bitwise less than @a s2; a positive - * value if @a s1 is bitwise greater than @a s2. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_compare_n(const i18n_uchar *s1, const i18n_uchar *s2, int32_t n); - -/** - * @brief Compare two Unicode strings in code point order. - * @details This is different in UTF-16 from #i18n_ustring_compare_n() if supplementary characters are present. For details, see #i18n_ustring_compare_binary_order(). - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @param[in] n The maximum number of characters to compare. - * @return a negative/zero/positive integer corresponding to whether - * the first string is less than/equal to/greater than the second one - * in code point order - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_compare_n_code_point_order(const i18n_uchar *s1, const i18n_uchar *s2, int32_t n); - -/** - * @brief Compare two strings case-insensitively using full case folding. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @param[in] options bit set of options:\n - * - #I18N_USTRING_U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding. - * - #I18N_USTRING_U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details). - * - #I18N_USTRING_U_FOLD_CASE_EXCLUDE_SPECIAL_I - * @return A negative, zero, or positive integer indicating the comparison result. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_case_compare(const i18n_uchar *s1, const i18n_uchar *s2, uint32_t options); - -/** - * @brief Compare two strings case-insensitively using full case folding. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @param[in] n The maximum number of characters each string to case-fold and then compare. - * @param[in] options A bit set of options:\n - * - #I18N_USTRING_U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding. - * - #I18N_USTRING_U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details). - * - #I18N_USTRING_U_FOLD_CASE_EXCLUDE_SPECIAL_I - * @return A negative, zero, or positive integer indicating the comparison result. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_case_compare_n(const i18n_uchar *s1, const i18n_uchar *s2, int32_t n, uint32_t options); - -/** - * @brief Compare two strings case-insensitively using full case folding. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @param[in] length The number of characters in each string to case-fold and then compare. - * @param[in] options A bit set of options:\n - * - #I18N_USTRING_U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding. - * - #I18N_USTRING_U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details). - * - #I18N_USTRING_U_FOLD_CASE_EXCLUDE_SPECIAL_I - * @return A negative, zero, or positive integer indicating the comparison result. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_mem_case_compare(const i18n_uchar *s1, const i18n_uchar *s2, int32_t length, uint32_t options); - -/** - * @brief Copies a ustring. Adds a NULL terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_copy(i18n_uchar *dest, const i18n_uchar *src); - -/** - * @brief Copies a ustring. - * @details Copies at most @a n characters. The result will be NULL terminated - * if the length of @a src is less than @a n. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * @param[in] n The maximum number of characters to copy - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_copy_n(i18n_uchar *dest, const i18n_uchar *src, int32_t n); - -/** - * @brief Copies a byte string encoded in the default codepage to a ustring. - * @details Adds a NULL terminator. Performs a host byte to #i18n_uchar conversion. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_copy_ua(i18n_uchar *dest, const char *src); - -/** - * @brief Copies a byte string encoded in the default codepage to a ustring. - * @details Copies at most @a n characters. The result will be NULL terminated - * if the length of @a src is less than @a n. - * Performs a host byte to #i18n_uchar conversion. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * @param[in] n The maximum number of characters to copy - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_copy_ua_n(i18n_uchar *dest, const char *src, int32_t n); - -/** - * @brief Copies a ustring to a byte string encoded in the default codepage. - * @details Adds a NULL terminator. Performs an #i18n_uchar to host byte conversion. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -char *i18n_ustring_copy_au(char *dest, const i18n_uchar *src); - -/** - * @brief Copies a ustring to a byte string encoded in the default codepage. - * @details Copies at most @a n characters. The result will be NULL terminated - * if the length of @a src is less than @a n. - * Performs an #i18n_uchar to host byte conversion. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * @param[in] n The maximum number of characters to copy - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -char *i18n_ustring_copy_au_n(char *dest, const i18n_uchar *src, int32_t n); - -/** - * @brief Synonym for memcpy(), but with #i18n_uchar characters only. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string (can be NULL/invalid if count<=0) - * @param[in] count The number of characters to copy; no-op if <=0 - * - * @return A pointer to @a dest - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_mem_copy(i18n_uchar *dest, const i18n_uchar *src, int32_t count); - -/** - * @brief Synonym for memmove(), but with #i18n_uchar characters only. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string (can be NULL/invalid if count<=0) - * @param[in] count The number of characters to copy; no-op if <=0 - * - * @return A pointer to @a dest - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_mem_move(i18n_uchar *dest, const i18n_uchar *src, int32_t count); - -/** - * @brief Initialize count characters of dest to c. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] c The character to initialize the string. - * @param[in] count The maximum number of characters to set. - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_mem_set(i18n_uchar *dest, const i18n_uchar c, int32_t count); - -/** - * @brief Compare the first count #i18n_uchar characters of each buffer. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] buf1 The first string to compare. - * @param[in] buf2 The second string to compare. - * @param[in] count The maximum number of #i18n_uchar characters to compare. - * @return When buf1 < buf2, a negative number is returned. - * When buf1 == buf2, 0 is returned. - * When buf1 > buf2, a positive number is returned. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_mem_compare(const i18n_uchar *buf1, const i18n_uchar *buf2, int32_t count); - -/** - * @brief Compare two Unicode strings in code point order. - * @details This is different in UTF-16 from #i18n_ustring_mem_compare() if supplementary characters are present. For details, see #i18n_ustring_compare_binary_order(). - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @param[in] count The maximum number of characters to compare. - * @return a negative/zero/positive integer corresponding to whether - * the first string is less than/equal to/greater than the second one - * in code point order - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_mem_compare_code_point_order(const i18n_uchar *s1, const i18n_uchar *s2, int32_t count); - -/** - * @brief Finds the first occurrence of a BMP code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (contains count #i18n_uchar characters). - * @param[in] c The BMP code point to find. - * @param[in] count The length of the string. - * @return A pointer to the first occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_char() - * @see i18n_ustring_mem_char32() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_mem_char(const i18n_uchar *s, i18n_uchar c, int32_t count); - -/** - * @brief Finds the first occurrence of a code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (contains count #i18n_uchar characters). - * @param[in] c The code point to find. - * @param[in] count The length of the string. - * @return A pointer to the first occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_mem_char32(const i18n_uchar *s, i18n_uchar32 c, int32_t count); - -/** - * @brief Finds the last occurrence of a BMP code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (contains count #i18n_uchar characters). - * @param[in] c The BMP code point to find. - * @param[in] count The length of the string. - * @return A pointer to the last occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see #i18n_ustring_r_char - * @see #i18n_ustring_mem_r_char32 - * @see #i18n_ustring_find_last - */ -i18n_uchar *i18n_ustring_mem_r_char(const i18n_uchar *s, i18n_uchar c, int32_t count); - -/** - * @brief Finds the last occurrence of a code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (contains count #i18n_uchar characters). - * @param[in] c The code point to find. - * @param[in] count The length of the string. - * @return A pointer to the last occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see #i18n_ustring_r_char32 - * @see #i18n_ustring_mem_r_char - * @see #i18n_ustring_find_last - */ -i18n_uchar *i18n_ustring_mem_r_char32(const i18n_uchar *s, i18n_uchar32 c, int32_t count); - -/** - * @brief Unescape a string of characters and write the resulting Unicode characters to the destination buffer. - * @details The following escape sequences are recognized:\n - * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] \\Uhhhhhhhh 8 hex digits \\xhh 1-2 hex digits \\x{h...} 1-8 hex digits \\ooo 1-3 octal digits; o in [0-7] \\cX control-X; X is masked with 0x1F\n - * as well as the standard ANSI C escapes:\n - * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C\n - * Anything else following a backslash is generically escaped. For example, "[a\-z]" returns "[a-z]".\n - * If an escape sequence is ill-formed, this method returns an empty string. An example of an ill-formed sequence is "\\u" followed by fewer than 4 hex digits. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] src a zero-terminated string of invariant characters - * @param[in] dest pointer to buffer to receive converted and unescaped text and, if there is room, a zero terminator. May be NULL for preflighting, in which case no #i18n_uchar characters will be written, - * but the return value will still be valid. On error, an empty string is stored here (if possible). - * @param[in] dest_capacity the number of #i18n_uchar characters that may be written at dest. Ignored if dest == NULL. - * @return the length of unescaped string. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_unescape_at() - */ -int32_t i18n_ustring_unescape(const char *src, i18n_uchar *dest, int32_t dest_capacity); - -/** - * @brief Unescape a single sequence. - * @details The character at offset-1 is assumed (without checking) to be a backslash. This method takes a callback pointer to a function that returns the #i18n_uchar at a given offset. - * By varying this callback, I18N functions are able to unescape char* strings, and UnicodeString objects.\n - * If offset is out of range, or if the escape sequence is ill-formed, (i18n_uchar32)0xFFFFFFFF is returned. - * See documentation of #i18n_ustring_unescape() for a list of recognized sequences. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] char_at callback function that returns a #i18n_uchar of the source text given an offset and a context pointer. - * @param[in] offset pointer to the offset that will be passed to char_at. The offset value will be updated upon return to point after the last parsed character of the escape sequence. - * On error the offset is unchanged. - * @param[in] length the number of #i18n_uchar characters that may be written at dest. Ignored if dest == NULL. - * @param[in] context an opaque pointer passed directly into char_at. - * - * @return the character represented by the escape sequence at - * offset, or (i18n_uchar32)0xFFFFFFFF on error. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_unescape() - */ -i18n_uchar32 i18n_ustring_unescape_at(i18n_ustring_unescape_char_at_cb char_at, int32_t *offset, int32_t length, void *context); - -/** - * @brief Uppercases the characters in a string. - * @details Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * The source string and the destination buffer are allowed to overlap. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string\n The result will be zero-terminated if - * the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string. - * @param[in] src The original string - * @param[in] src_len The length of the original string\n - * If @c -1, then @a src must be zero-terminated. - * @param[in] locale The locale to consider, or "" for the root locale or @c NULL for the default locale. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The length of the result string. It may be greater than destCapacity. In that case, - * only some of the result was written to the destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_to_upper(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, const char *locale, i18n_error_code_e *error_code); - -/** - * @brief Lowercase the characters in a string. - * @details Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. The source string and the destination buffer are allowed to overlap. - * The result may be longer or shorter than the original. - * The source string and the destination buffer are allowed to overlap. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string. The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string. - * @param[in] src The original string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[in] locale The locale to consider, or "" for the root locale or @c NULL for the default locale. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The length of the result string. It may be greater than destCapacity. In that case, - * only some of the result was written to the destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_to_lower(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, const char *locale, i18n_error_code_e *error_code); - -/** - * @brief Titlecases a string. - * @details Casing is locale-dependent and context-sensitive. - * Titlecasing uses a break iterator to find the first characters of words - * that are to be titlecased. It titlecases those characters and lowercases - * all others. - * - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section and in #i18n_error_code_e description. - * - * The titlecase break iterator can be provided to customize arbitrary - * styles, using rules and dictionaries beyond the standard iterators. - * It may be more efficient to always provide an iterator to avoid - * opening and closing one for each string. - * The standard titlecase iterator for the root locale implements the - * algorithm of Unicode TR 21.\n - * The result may be longer or shorter than the original. - * The source string and the destination buffer are allowed to overlap. - * @since_tizen 2.3.1 - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters.\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string. - * @param[in] src The original string - * @param[in] src_len The length of the original string.\n If @c -1, then @a src must be zero-terminated. - * @param[in] title_iter A break iterator to find the first characters of words - * that are to be titlecased.\n - * If none are provided (@c NULL), then a standard titlecase - * break iterator is opened. - * @param[in] locale The locale to consider, or "" for the root locale or @c NULL for the default locale. - * @return The length of the result string. It may be greater than dest_capacity. In that case, - * only some of the result were written to the destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_to_title() - */ -int32_t i18n_ustring_to_title_new(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, i18n_ubreak_iterator_h title_iter, const char *locale); - -/** - * @brief Case-folds the characters in a string. - * @details Case-folding is locale-independent and not context-sensitive, - * but there is an option for whether to include or exclude mappings for dotted I and dotless i.\n - * The result may be longer or shorter than the original. - * The source string and the destination buffer are allowed to overlap. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string. - * @param[in] src The original string - * @param[in] src_len The length of the original string.\n If @c -1, then @a src must be zero-terminated. - * @param[in] options Either #I18N_USTRING_U_FOLD_CASE_DEFAULT or #I18N_USTRING_U_FOLD_CASE_EXCLUDE_SPECIAL_I - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The length of the result string. It may be greater than destCapacity. In that case, - * only some of the result was written to the destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_fold_case(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, uint32_t options, i18n_error_code_e *error_code); - -/** - * @brief Convert a UTF-16 string to a wchar_t string. - * @details If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then this function simply calls the fast, dedicated function for that. - * Otherwise, two conversions UTF-16 -> default charset -> wchar_t* are performed. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string. The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of wchar_t's).\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the number of output units corresponding to the transformation of all the input units, even in case of a buffer overflow. - * @param[in] src The original source string. - * @param[in] src_len The length of the original string.\n If @c -1, then @a src must be zero-terminated. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -wchar_t *i18n_ustring_to_WCS(wchar_t *dest, int32_t dest_capacity, int32_t *dest_len, const i18n_uchar *src, int32_t src_len, i18n_error_code_e *error_code); - -/** - * @brief Convert a wchar_t string to UTF-16. - * @details If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then this function simply calls the fast, dedicated function for that. - * Otherwise, two conversions wchar_t* -> default charset -> UTF-16 are performed. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string. The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters).\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the number of output units corresponding to the transformation of all the input units, even in case of a buffer overflow. - * @param[in] src The original source string. - * @param[in] src_len The length of the original string.\n If @c -1, then @a src must be zero-terminated. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_from_WCS(i18n_uchar *dest, int32_t dest_capacity, int32_t *dest_len, const wchar_t *src, int32_t src_len, i18n_error_code_e *error_code); - -/** - * @brief Converts a UTF-16 string to UTF-8. - * @details If the input string is not well-formed, then the #I18N_ERROR_INVALID_CHAR_FOUND error code is set. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of chars)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the - * number of output units corresponding to the transformation of - * all the input units, even in case of a buffer overflow. - * @param[in] src The original source string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_from_UTF8() - */ -char *i18n_ustring_to_UTF8(char *dest, int32_t dest_capacity, int32_t *dest_len, const i18n_uchar *src, int32_t src_len, i18n_error_code_e *error_code); - -/** - * @brief Converts a UTF-8 string to UTF-16. - * @details If the input string is not well-formed, then the #I18N_ERROR_INVALID_CHAR_FOUND error code is set. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the - * number of output units corresponding to the transformation of - * all the input units, even in case of a buffer overflow. - * @param[in] src The original source string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_from_UTF8(i18n_uchar *dest, int32_t dest_capacity, int32_t *dest_len, const char *src, int32_t src_len, i18n_error_code_e *error_code); - -/** - * @brief Convert a UTF-16 string to UTF-8. - * Same as #i18n_ustring_to_UTF8() except for the additional sub_char which is output for illegal input sequences, instead of stopping with the #I18N_ERROR_INVALID_CHAR_FOUND error code. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of chars)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the - * number of output units corresponding to the transformation of - * all the input units, even in case of a buffer overflow. - * @param[in] src The original source string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[in] sub_char The substitution character to use in place of an illegal input sequence, or U_SENTINEL if the function is to return with #I18N_ERROR_INVALID_CHAR_FOUND instead. - * A substitution character can be any valid Unicode code point (up to U+10FFFF) except for surrogate code points (U+D800..U+DFFF). - * The recommended value is U+FFFD "REPLACEMENT CHARACTER". - * @param[out] num_substitutions Output parameter receiving the number of substitutions if sub_char>=0. Set to 0 if no substitutions occur or sub_char<0. num_substitutions can be NULL. - * @param[out] error_codeMust be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_to_UTF8() - * @see i18n_ustring_from_UTF8_with_sub() - */ -char *i18n_ustring_to_UTF8_with_sub(char *dest, int32_t dest_capacity, int32_t *dest_len, const i18n_uchar *src, int32_t src_len, i18n_uchar32 sub_char, int32_t *num_substitutions, i18n_error_code_e *error_code); - -/** - * @brief Convert a UTF-8 string to UTF-16. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the - * number of output units corresponding to the transformation of - * all the input units, even in case of a buffer overflow. - * @param[in] src The original source string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[in] sub_char The substitution character to use in place of an illegal input sequence, or U_SENTINEL if the function is to return with #I18N_ERROR_INVALID_CHAR_FOUND instead. - * A substitution character can be any valid Unicode code point (up to U+10FFFF) except for surrogate code points (U+D800..U+DFFF). - * The recommended value is U+FFFD "REPLACEMENT CHARACTER". - * @param[out] num_substitutions Output parameter receiving the number of substitutions if sub_char>=0. Set to 0 if no substitutions occur or sub_char<0. num_substitutions can be NULL. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_from_UTF8() - * @see i18n_ustring_from_UTF8_lenient() - * @see i18n_ustring_to_UTF8_with_sub() - */ -i18n_uchar *i18n_ustring_from_UTF8_with_sub(i18n_uchar *dest, int32_t dest_capacity, int32_t *dest_len, const char *src, int32_t src_len, i18n_uchar32 sub_char, - int32_t *num_substitutions, i18n_error_code_e *error_code); - -/** - * @brief Convert a UTF-8 string to UTF-16. - * @details Same as i18n_ustring_from_UTF8() except that this function is designed to be very fast, which it achieves by being lenient about malformed UTF-8 sequences. - * This function is intended for use in environments where UTF-8 text is expected to be well-formed.\n - * Its semantics are: - * - Well-formed UTF-8 text is correctly converted to well-formed UTF-16 text.\n - * - The function will not read beyond the input string, nor write beyond the dest_capacity.\n - * - Malformed UTF-8 results in "garbage" 16-bit Unicode strings which may not be well-formed UTF-16. The function will resynchronize to valid code point boundaries within a small number of code points after an illegal sequence.\n - * - Non-shortest forms are not detected and will result in "spoofing" output.\n - * For further performance improvement, if src_len is given (>=0), then it must be dest_capacity>=src_len.\n - * There is no inverse i18n_ustring_to_UTF8_lenient() function because there is practically no performance gain from not checking that a UTF-16 string is well-formed. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * Unlike for other I18N functions, if src_len>=0 then it must be dest_capacity>=src_len. - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the number of output units corresponding - * to the transformation of all the input units, even in case of a buffer overflow. - * Unlike for other I18N functions, if src_len>=0 but dest_capacity=0. Set to 0 if no substitutions occur or sub_char<0. num_substitutions can be NULL. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_to_UTF32() - * @see i18n_ustring_from_UTF32_with_sub() - */ -i18n_uchar32 *i18n_ustring_to_UTF32_with_sub(i18n_uchar32 *dest, int32_t dest_capacity, int32_t *dest_len, const i18n_uchar *src, int32_t src_len, - i18n_uchar32 sub_char, int32_t *num_substitutions, i18n_error_code_e *error_code); - -/** - * @brief Convert a UTF-32 string to UTF-16. - * Same as #i18n_ustring_from_UTF32() except for the additional sub_char which is output for illegal input sequences, instead of stopping with the #I18N_ERROR_INVALID_CHAR_FOUND error code. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of i18n_chars)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the number of output units corresponding - * to the transformation of all the input units, even in case of a buffer overflow. - * @param[in] src The original source string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[in] sub_char The substitution character to use in place of an illegal input sequence, or U_SENTINEL if the function is to return with #I18N_ERROR_INVALID_CHAR_FOUND instead. - * A substitution character can be any valid Unicode code point (up to U+10FFFF) except for surrogate code points (U+D800..U+DFFF). - * The recommended value is U+FFFD "REPLACEMENT CHARACTER". - * @param[out] num_substitutions Output parameter receiving the number of substitutions if sub_char>=0. Set to 0 if no substitutions occur or sub_char<0. num_substitutions can be NULL. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_from_UTF32() - * @see i18n_ustring_to_UTF32_with_sub() - */ -i18n_uchar *i18n_ustring_from_UTF32_with_sub(i18n_uchar *dest, int32_t dest_capacity, int32_t *dest_len, const i18n_uchar32 *src, int32_t src_len, i18n_uchar32 sub_char, int32_t *num_substitutions, i18n_error_code_e *error_code); - -#ifdef __cplusplus -} -#endif - -/** - * @} - * @} - */ -#endif /* __UTILS_I18N_USTRING_H__*/ diff --git a/src/include/deprecated/utils_i18n_timezone.h b/src/include/deprecated/utils_i18n_timezone.h deleted file mode 100644 index 8f32bec..0000000 --- a/src/include/deprecated/utils_i18n_timezone.h +++ /dev/null @@ -1,490 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __UTILS_I18N_TIMEZONE_H__ -#define __UTILS_I18N_TIMEZONE_H__ - -#include -#include - -/** - * @file utils_i18n_timezone.h - * @version 0.1 - * @brief utils_i18n_timezone - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup CAPI_BASE_UTILS_I18N_MODULE - * @defgroup CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE Timezone - * @brief The Timezone module represents a time zone offset, and also figures out daylight savings. - * @section CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE_OVERVIEW Overview - * @details The Timezone module represents a time zone offset, and also figures out daylight savings.\n - * Typically, you get an i18n_timezone_h using #i18n_timezone_create_default which creates a TimeZone based on the time zone - * where the program is running. For example, for a program running in Japan, - * #i18n_timezone_create_default creates an i18n_timezone_h based on Japanese Standard Time.\n - * You can also get an i18n_timezone_h using #i18n_timezone_create along with a time zone ID. - * For instance, the time zone ID for the US Pacific Time zone is "America/Los_Angeles". - * So, you can get a Pacific Time i18n_timezone_h with:\n - * - * i18n_timezone_h timezone;\n - * i18n_timezone_create(&timezone, "America/Los_Angeles");\n - * - * To create a new i18n_timezone_h, you call the factory function #i18n_timezone_create() and pass it a time zone ID. - * You can use the int #i18n_timezone_foreach_timezone_id() function to obtain a list of all the time zone IDs recognized by #i18n_timezone_create().\n - * You can also use #i18n_timezone_create_default() to create an i18n_timezone_h. This function uses platform-specific APIs to produce - * an i18n_timezone_h for the time zone corresponding to the client's computer's physical location. - * For example, if you're in Japan (assuming your machine is set up correctly), #i18n_timezone_create_default() - * will return an i18n_timezone_h for Japanese Standard Time ("Asia/Tokyo"). - */ - -/** - * @addtogroup CAPI_BASE_UTILS_I18N_TIMEZONE_MODULE - * @{ - */ - -/** - * @brief Returns the "unknown" time zone. - * @details #i18n_timezone_create() returns a mutable clone of this time zone if the input ID is not recognized. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] timezone the "unknown" time zone. - * - * @retval #I18N_ERROR_NONE Successful - * @see i18n_timezone_create() - * @see i18n_timezone_create_gmt() - */ -int i18n_timezone_create_unknown(i18n_timezone_h *timezone); - -/** - * @brief The GMT (=UTC) time zone has a raw offset of zero and does not use daylight savings time. - * @details This is a commonly used time zone.\n - * Note: For backward compatibility reason, the ID used by the time zone returned by this method is "GMT", although the I18N's canonical ID for the GMT time zone is "Etc/GMT". - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] timezone the GMT/UTC time zone. - * - * @retval #I18N_ERROR_NONE Successful - * @see i18n_timezone_create_unknown() - */ -int i18n_timezone_create_gmt(i18n_timezone_h *timezone); - -/** - * @brief Creates an i18n_timezone_h for the given timezone_id. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] timezone the GMT/UTC time zone. - * @param[in] timezone_id the ID for an i18n_timezone_h, such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_create(i18n_timezone_h *timezone, const char *timezone_id); - -/** - * @brief Destroys an i18n_timezone_h. - * @details Once destroyed, an i18n_timezone_h may no longer be used. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to destroy. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_destroy(i18n_timezone_h timezone); - -/** - * @brief Returns an enumeration over system time zone IDs with the given filter conditions. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone_type The system time zone type. - * @param[in] region The ISO 3166 two-letter country code or UN M.49 three-digit area code. When NULL, no filtering done by region. - * @param[in] raw_offset An offset from GMT in milliseconds, ignoring the effect of daylight savings time, if any. When NULL, no filtering done by zone offset. - * @param[in] cb The callback function to get an enumeration object, owned by the caller. - * @param[in] user_data The user data to be passed to the callback function. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_foreach_timezone_id_by_region(i18n_system_timezone_type_e timezone_type, const char *region, const int32_t *raw_offset, i18n_timezone_id_cb cb, void *user_data); - -/** - * @brief Returns an enumeration over all recognized time zone IDs. - * (i.e., all strings that #i18n_timezone_create() accepts) - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] cb The callback function to get an enumeration object, owned by the caller. - * @param[in] user_data The user data to be passed to the callback function. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_foreach_timezone_id(i18n_timezone_id_cb cb, void *user_data); - -/** - * @brief Returns an enumeration over time zone IDs with a given raw offset from GMT. - * @details There may be several times zones with the same GMT offset that differ in the way they - * handle daylight savings time. For example, the state of Arizona doesn't observe daylight - * savings time. If you ask for the time zone IDs corresponding to GMT-7:00, - * you'll get back an enumeration over two time zone IDs: "America/Denver," - * which corresponds to Mountain Standard Time in the winter and Mountain Daylight Time in the summer, - * and "America/Phoenix", which corresponds to Mountain Standard Time year-round, even in the summer. - * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] raw_offset an offset from GMT in milliseconds, ignoring the effect of daylight savings time, if any - * @param[in] cb The callback function to get an enumeration object, owned by the caller. - * @param[in] user_data The user data to be passed to the callback function. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_foreach_timezone_id_with_offset(int32_t raw_offset, i18n_timezone_id_cb cb, void *user_data); - -/** - * @brief Returns an enumeration over time zone IDs associated with the given country. - * @details Some zones are affiliated with no country (e.g., "UTC"); these may also be retrieved, as a group. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] country The ISO 3166 two-letter country code, or NULL to retrieve zones not affiliated with any country. - * @param[in] cb The callback function to get an enumeration object, owned by the caller. - * @param[in] user_data The user data to be passed to the callback function. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_foreach_timezone_id_by_country(const char *country, i18n_timezone_id_cb cb, void *user_data); - -/** - * @brief Returns the number of IDs in the equivalency group that includes the given ID. - * @details An equivalency group contains zones that have the same GMT offset and rules.\n - * The returned count includes the given ID; it is always >= 1. The given ID must be a system time zone. If it is not, returns zero. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone_id a system time zone ID - * @param[out] count the number of zones in the equivalency group containing 'timezone_id', or zero if 'timezone_id' is not a valid system ID - * - * @retval #I18N_ERROR_NONE Successful - * @see i18n_timezone_get_equivalent_id() - */ -int i18n_timezone_count_equivalent_ids(const char *timezone_id, int32_t *count); - -/** - * @brief Returns an ID in the equivalency group that includes the given ID. - * @details An equivalency group contains zones that have the same GMT offset and rules.\n - * The given index must be in the range 0..n-1, where n is the out parameter value - * from i18n_timezone_count_equivalent_ids(timezone_id, &n). - * For some value of 'index', the returned value will be equal to the given id. - * If the given id is not a valid system time zone, - * or if 'index' is out of range, then returns an empty string. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone_id a system time zone ID - * @param[in] index a value from 0 to n-1, where n is the out parameter value from i18n_timezone_count_equivalent_ids(timezone_id, &n) - * @param[out] equivalent_timezone_id the ID of the index-th zone in the equivalency group containing 'timezone_id', - * or an empty string if 'timezone_id' is not a valid system ID or 'index' is out of range - * - * @retval #I18N_ERROR_NONE Successful - * @see i18n_timezone_count_equivalent_ids() - */ -int i18n_timezone_get_equivalent_id(const char *timezone_id, int32_t index, char **equivalent_timezone_id); - -/** - * @brief Creates a new copy of the default i18n_timezone_h for this host. - * @details Unless the default time zone has already been set using #i18n_timezone_set_default(), - * the default is determined by querying the system using methods in TPlatformUtilities. - * If the system routines fail, or if they specify an i18n_timezone_h or i18n_timezone_h offset - * which is not recognized, the i18n_timezone_h indicated by the ID kLastResortID - * is instantiated and made the default. - * - * This function determines the default timezone by querying the system once and storing the - * obtained timezone as default until the application terminates. - * - * To query the system for the current timezone, use i18n_timezone_detect_host_timezone(). - * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] timezone A default i18n_timezone_h. Clients are responsible for deleting the time zone object returned. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_create_default(i18n_timezone_h *timezone); - -/** - * @brief Sets the default time zone (i.e., what's returned by #i18n_timezone_create_default()) to be the specified time zone. - * @details If NULL is specified for the time zone, the default time zone is set to the default host time zone. - * The caller remains responsible for deleting it. \n - * This function is not thread safe. It is an error for multiple threads to concurrently attempt to set - * the default time zone, or for any thread to attempt to reference the default zone while another thread is setting it. - * - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * @remarks Do not use unless you know what you are doing. - * - * @param[in] timezone The given timezone. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_set_default(i18n_timezone_h timezone); - -/** - * @brief Returns the timezone data version currently used by I18N. - * @remarks The specific error code can be obtained using the get_last_result() - * method. Error codes are described in #i18n_error_code_e description. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @return the version string, such as "2007f" - * @exception #I18N_ERROR_NONE Successful - */ -const char *i18n_timezone_get_tzdata_version(void); - -/** - * @brief Gets the region code associated with the given system time zone ID. - * @details The region code is either ISO 3166 2-letter country code or UN M.49 3-digit area code. - * When the time zone is not associated with a specific location, for example - "Etc/UTC", - * "EST5EDT", then this method returns "001" (UN M.49 area code for World). - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone_id The system time zone ID. - * @param[out] region Output buffer for receiving the region code. - * @param[out] region_len The length of the region code. - * @param[in] region_capacity The size of the output buffer. If it is lower than required @a region buffer size, - * then I18N_ERROR_BUFFER_OVERFLOW error is returned. - * - * @return the version string, such as "2007f" - */ -int i18n_timezone_get_region(const char *timezone_id, char *region, int32_t *region_len, int32_t region_capacity); - -/** - * @brief Returns the time zone raw and GMT offset for the given moment in time. - * @details Upon return, local-millis = GMT-millis + rawOffset + dstOffset. All computations are performed - * in the proleptic Gregorian calendar. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get an offset. - * @param[in] date moment in time for which to return offsets, in units of milliseconds from January 1, 1970 0:00 GMT, either GMT time or local wall time, depending on `local'. - * @param[in] local output if true, `date' is local wall time; otherwise it is in GMT time. - * @param[out] raw_offset parameter to receive the raw offset, that is, the offset not including DST adjustments - * @param[out] dst_offset output parameter to receive the DST offset, that is, the offset to be added to `raw_offset' to obtain the total offset between local and GMT time. If DST is not in effect, this value is zero; otherwise it is a positive value, typically one hour. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_offset_with_date(i18n_timezone_h timezone, i18n_udate date, i18n_ubool local, int32_t *raw_offset, int32_t *dst_offset); - -/** - * @brief Sets the i18n_timezone_h's raw GMT offset - * (i.e., the number of milliseconds to add to GMT to get local time, before taking daylight savings time into account). - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to set a raw offset. - * @param[in] offset_milliseconds The new raw GMT offset for this time zone. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_set_raw_offset(i18n_timezone_h timezone, int32_t offset_milliseconds); - -/** - * @brief Gets the i18n_timezone_h's raw GMT offset (i.e., the number of milliseconds - * to add to GMT to get local time, before taking daylight savings time into account). - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a raw offset. - * @param[out] offset_milliseconds The i18n_timezone_h's raw GMT offset. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_raw_offset(i18n_timezone_h timezone, int32_t *offset_milliseconds); - -/** - * @brief Fills in "timezone_id" with the i18n_timezone_h's ID. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a timezone ID. - * @param[out] timezone_id Receives this i18n_timezone_h's ID. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_id(i18n_timezone_h timezone, char **timezone_id); - -/** - * @brief Sets the i18n_timezone_h's ID to the specified value. - * @details This doesn't affect any other fields. for example,\n - * \n - * i18n_timezone_h timezone = NULL;\n - * i18n_timezone_create ( &timezone, "America/New_York" );\n - * i18n_timezone_set_id ( "America/Los_Angeles" );\n - * \n - * the timezone's GMT offset and daylight-savings rules don't change to those for Los Angeles. - * They're still those for New York. Only the ID has changed. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to set a timezone ID. - * @param[in] timezone_id The new time zone ID. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_set_id(i18n_timezone_h timezone, const char *timezone_id); - -/** - * @brief Returns a name of this time zone suitable for presentation to the user in the default locale. - * @details This method returns the long name, not including daylight savings. - * If the display name is not available for the locale, then this method returns a string in the localized GMT offset format such as GMT[+-]HH:mm. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a display name. - * @param[out] display_name The human-readable name of this time zone in the default locale. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_display_name(i18n_timezone_h timezone, char **display_name); - -/** - * @brief Returns a name of this time zone suitable for presentation to the user in the default locale. - * @details This method returns the long name, not including daylight savings. - * If the display name is not available for the locale, then this method returns a string in the localized GMT offset format such as GMT[+-]HH:mm. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a display name. - * @param[in] language The language in which to supply the display name. This parameter can be NULL; if so, the locale is initialized to match the current default locale. - * @param[in] country The country in which to supply the display name. This parameter can be NULL. - * @param[out] display_name The human-readable name of this time zone in the default locale. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_display_name_with_locale(i18n_timezone_h timezone, const char *language, const char *country , char **display_name); - -/** - * @brief Returns a name of this time zone suitable for presentation to the user in the default locale. - * @details If the display name is not available for the locale, - * then this method returns a string in the localized GMT offset format such as GMT[+-]HH:mm. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a display name. - * @param[in] daylight If true, display_name is filled with the daylight savings name. - * @param[in] style The style displayed on. - * @param[out] display_name The human-readable name of this time zone in the default locale. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_display_name_with_type(i18n_timezone_h timezone, i18n_ubool daylight, i18n_timezone_display_type_e style, char **display_name); - -/** - * @brief Returns a name of this time zone suitable for presentation to the user in the default locale. - * @details If the display name is not available for the locale, - * then this method returns a string in the localized GMT offset format such as GMT[+-]HH:mm. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get a display name. - * @param[in] daylight If true, display_name is filled with the daylight savings name. - * @param[in] style The style displayed on. - * @param[in] language The language in which to supply the display name. This parameter can be NULL; if so, the locale is initialized to match the current default locale. - * @param[in] country The country in which to supply the display name. This parameter can be NULL. - * @param[out] display_name The human-readable name of this time zone in the default locale. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_display_name_with_type_locale(i18n_timezone_h timezone, i18n_ubool daylight, i18n_timezone_display_type_e style, const char *language, const char *country, char **display_name); - -/** - * @brief Queries if this time zone uses daylight savings time. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to know whether uses daylight savings time or not. - * @param[out] daylight_time True if this time zone uses daylight savings time, False, otherwise. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_use_daylight_time(i18n_timezone_h timezone, i18n_ubool *daylight_time); - -/** - * @brief Queries if the given date is in daylight savings time in this time zone. - * @details This method is wasteful since it creates a new GregorianCalendar and deletes it each time it is called. - * @since_tizen 2.3 - * - * @deprecated Deprecated since 2.3.1. Use i18n_ucalendar_is_in_daylight_time() instead. - * - * @param[in] timezone The i18n_timezone_h to know whether in daylight savings time or not. - * @param[in] date the given i18n_udate. - * @param[out] daylight_time True if the given date is in daylight savings time, False, otherwise. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_in_daylight_time(i18n_timezone_h timezone, i18n_udate date, i18n_ubool *daylight_time) TIZEN_DEPRECATED_API; - -/** - * @brief Returns true if this zone has the same rule and offset as another zone. - * @details That is, if this zone differs only in ID, if at all. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to know whether has the same rule or not. - * @param[in] other The i18n_timezone_h to be compared with. - * @param[out] same_rule True if the given zone is the same as this one, with the possible exception of the ID. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_has_same_rule(i18n_timezone_h timezone, i18n_timezone_h other, i18n_ubool *same_rule); - -/** - * @brief Clones i18n_timezone_h polymorphically. - * @details Clients are responsible for deleting the i18n_timezone_h cloned. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to clone. - * @param[out] clone A new copy of this i18n_timezone_h. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_clone(i18n_timezone_h timezone, i18n_timezone_h *clone); - -/** - * @brief Returns the amount of time to be added to local standard time to get local wall clock time. - * @details The default implementation always returns 3600000 milliseconds (i.e., one hour) if this time zone observes Daylight Saving Time. - * Otherwise, 0 (zero) is returned.\n - * If an underlying TimeZone implementation subclass supports historical Daylight Saving Time changes, - * this method returns the known latest daylight saving value. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] timezone The i18n_timezone_h to get DST savings. - * @param[out] dst_savings The amount of saving time in milliseconds. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_get_dst_savings(i18n_timezone_h timezone, int32_t *dst_savings); - -/** - * @brief Creates an #i18n_timezone_h detected from the current host system configuration. - * @details This function does not change the default time zone and does not update the current - * ICU's default. It may return a different #i18n_timezone_h from the one returned by - * i18n_timezone_create_default(). - * @since_tizen 3.0 - * - * @param[out] timezone A new instance of #i18n_timezone_h detected from the current host system - * configuration. Users are responsible for deleting the returned time zone object with - * i18n_timezone_destroy(). - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_timezone_detect_host_timezone(i18n_timezone_h *timezone); - -#ifdef __cplusplus -} -#endif - -/** - * @} - * @} - */ -#endif /* __UTILS_I18N_TIMEZONE_H__*/ diff --git a/src/include/deprecated/utils_i18n_usearch.h b/src/include/deprecated/utils_i18n_usearch.h deleted file mode 100644 index 3401ffa..0000000 --- a/src/include/deprecated/utils_i18n_usearch.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __UTILS_I18N_USEARCH_H__ -#define __UTILS_I18N_USEARCH_H__ - -#include -#include - -/** - * @file utils_i18n_usearch.h - * @version 0.1 - * @brief utils_i18n_usearch - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup CAPI_BASE_UTILS_I18N_MODULE - * @defgroup CAPI_BASE_UTILS_I18N_USEARCH_MODULE Usearch - * @brief The Usearch module provides language-sensitive text searching based on the comparison rules defined in a ucollator data struct. - * - * @section CAPI_BASE_UTILS_I18N_USEARCH_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_BASE_UTILS_I18N_USEARCH_MODULE_OVERVIEW Overview - * @details The Usearch module provides language-sensitive text searching based on the comparison rules defined in a ucollator data struct. - * - * @section CAPI_BASE_UTILS_I18N_USEARCH_MODULE_SAMPLE_CODE_1 Sample Code 1 - * @brief Searches the pattern and gets the matched text. - * @code - char *string = "TIZEN"; - char *keyword = "ZE"; - i18n_uchar target[16] = {0,}; - i18n_uchar pattern[16] = {0,}; - i18n_uchar u_matched[16] = {0,}; - char tmp[1] = {0}; - i18n_usearch_h search = NULL; - int pos = 0; - int matched_text_len = 0; - int i = 0; - i18n_error_code_e error_code; - - i18n_ustring_from_UTF8( target, 16, NULL, string, -1, &error_code ); - i18n_ustring_from_UTF8( pattern, 16, NULL, keyword, -1, &error_code ); - - // creates a search - i18n_usearch_create_new( pattern, -1, target, -1, "en_US", NULL, &search ); - - // gets the first index of the target that matches with the pattern - i18n_usearch_first( search, &pos ); - dlog_print(DLOG_INFO, LOG_TAG, "the first index = %d", pos ); // The first index = 2 - - // gets the matched text - i18n_usearch_get_matched_text( search, u_matched, 16, &matched_text_len ); - for ( i = 0; i < matched_text_len; i++) { - i18n_ustring_copy_au_n( tmp, &u_matched[i], 1 ); - dlog_print(DLOG_INFO, LOG_TAG, "u_matched[%d] = %c", i, tmp[0] ); // u_matched[0] = Z, u_matched[1] = E - } - i18n_usearch_destroy( search ); - * @endcode - */ - -/** - * @addtogroup CAPI_BASE_UTILS_I18N_USEARCH_MODULE - * @{ - */ - -/** - * @brief Creates an i18n_usearch_h using the argument locale language rule set. - * @details A collator will be created in the process, which will be owned by - * this search and will be deleted in i18n_usearch_destroy(). - * @remarks Must release @a search_iter using i18n_usearch_destroy(). - * @since_tizen 2.3 - * - * @deprecated Deprecated since 2.3.1. Use i18n_usearch_create_new() instead. - * - * @param[in] pattern The pattern for matching - * @param[in] pattern_len The length of the pattern, otherwise @c -1 for NULL-termination - * @param[in] text The text string - * @param[in] text_len The length of the text string, otherwise @c -1 for NULL-termination - * @param[in] locale The name of the locale for the rules to be used - * @param[in] break_iter An #i18n_ubreak_iterator_s that will be used to restrict the points at which matches are detected. If a match is found,\n - * but the match's start or end index is not a boundary as determined by the #i18n_ubreak_iterator_s, - * the match will be rejected and another will be searched for. If this parameter is @c NULL,\n - * no break detection is attempted. - * @param[out] search_iter The #i18n_usearch_h, otherwise @c NULL if there is an error - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_usearch_create(const i18n_uchar *pattern, int32_t pattern_len, const i18n_uchar *text, int32_t text_len, const char *locale, i18n_ubreak_iterator_s *break_iter, i18n_usearch_h *search_iter) TIZEN_DEPRECATED_API; - -/** - * @brief Creates an #i18n_usearch_h using the argument locale language rule set. - * @details A collator will be created in the process, which will be owned by - * this search and will be deleted in i18n_usearch_destroy(). - * @remarks Must release @a search_iter using i18n_usearch_destroy(). - * @since_tizen 2.3.1 - * - * @param[in] pattern The pattern for matching - * @param[in] pattern_len The length of the pattern, otherwise @c -1 for NULL-termination - * @param[in] text The text string - * @param[in] text_len The length of the text string, otherwise @c -1 for NULL-termination - * @param[in] locale The name of the locale for the rules to be used - * @param[in] break_iter An #i18n_ubreak_iterator_h that will be used to restrict the points at which matches are detected. If a match is found,\n - * but the match's start or end index is not a boundary as determined by the #i18n_ubreak_iterator_h, - * the match will be rejected and another will be searched for. If this parameter is @c NULL,\n - * no break detection is attempted. - * @param[out] search_iter The #i18n_usearch_h, otherwise @c NULL if there is an error - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_usearch_create_new(const i18n_uchar *pattern, int32_t pattern_len, const i18n_uchar *text, - int32_t text_len, const char *locale, i18n_ubreak_iterator_h break_iter, i18n_usearch_h *search_iter); - -/** - * @brief Destroys and cleans up the i18n_usearch_h. - * @details If a collator is created in i18n_usearch_create(), it will be destroyed here. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] search_iter The i18n_usearch_h to clean up - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_usearch_destroy(i18n_usearch_h search_iter); - -/** - * @brief Returns the text that matches by the most recent call to i18n_usearch_first(), or so on. - * @details If the iterator is not pointing at a valid match (e.g. just after - * construction or after #I18N_USEARCH_DONE has been returned, it returns - * an empty string. If the result is not large enough to store the matched text, - * the result will be filled with the partial text and an #I18N_ERROR_BUFFER_OVERFLOW - * will be returned in status. The result will be NULL-terminated whenever - * possible. If the buffer fits the matched text exactly, a NULL-termination - * is not possible. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] search_iter The search iterator handle - * @param[out] result i18n_uchar The buffer to store the matched string - * @param[in] result_capacity The length of the result buffer - * @param[out] len_matched_text The exact length of the matched text, not counting the NULL-termination - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @retval #I18N_ERROR_BUFFER_OVERFLOW A result would not fit in the supplied buffer - */ -int i18n_usearch_get_matched_text(const i18n_usearch_h search_iter, i18n_uchar *result, int32_t result_capacity, int32_t *len_matched_text); - -/** - * @brief Gets the collator used for the language rules. - * @details Deleting the returned i18n_ucollator_h before calling - * i18n_usearch_destroy() would cause the string search to fail. - * i18n_usearch_destroy() will delete the collator if this search owns it. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] search_iter The search iterator handle - * @param[out] collator The collator - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_usearch_get_collator(const i18n_usearch_h search_iter, i18n_ucollator_h *collator); - -/** - * @brief Returns the first index at which the string text matches the search pattern. - * @details The iterator is adjusted so that its current index - * is the match position if one is found. - * If a match is not found, #I18N_USEARCH_DONE will be returned and - * the iterator will be adjusted to the index #I18N_USEARCH_DONE. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] search_iter The search iterator handle - * @param[out] index_first The character index of the first match, - * otherwise #I18N_USEARCH_DONE if there are no matches. - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_usearch_first(i18n_usearch_h search_iter, int32_t *index_first); - -#ifdef __cplusplus -} -#endif - -/** - * @} - * @} - */ - -#endif /* __UTILS_I18N_USEARCH_H__*/ diff --git a/src/include/deprecated/utils_i18n_ustring.h b/src/include/deprecated/utils_i18n_ustring.h deleted file mode 100644 index 35351d6..0000000 --- a/src/include/deprecated/utils_i18n_ustring.h +++ /dev/null @@ -1,1367 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Copyright (C) 1998-2012, International Business Machines - * Corporation and others. All Rights Reserved. - */ - -#ifndef __UTILS_I18N_USTRING_H__ -#define __UTILS_I18N_USTRING_H__ - -#include -#include - -/** - * @file utils_i18n_ustring.h - * @version 0.1 - * @brief utils_i18n_ustring - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup CAPI_BASE_UTILS_I18N_MODULE - * @defgroup CAPI_BASE_UTILS_I18N_USTRING_MODULE Ustring - * @brief The Ustring module provides general unicode string handling information. - * - * @section CAPI_BASE_UTILS_I18N_USTRING_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_BASE_UTILS_I18N_USTRING_MODULE_OVERVIEW Overview - * @details The Ustring module provides general unicode string handling information. - * - * @section CAPI_BASE_UTILS_I18N_USTIRING_MODULE_SAMPLE_CODE_1 Sample Code 1 - * @brief It converts a byte string to a unicode string and then to uppercase letters. - * @code - char str_1[64] = {0,}; - i18n_uchar uchar_str_1[64] = {0,}; - i18n_uchar uchar_str_2[64] = {0,}; - int uchar_len = 0; - i18n_uerror_code_e err_code = I18N_ERROR_NONE; - - strcpy(str_1, "tizen"); - dlog_print(DLOG_INFO, LOG_TAG, "str_1 is %s\n", str_1); // str_1 is tizen - - // converts a byte string to a unicode string - i18n_ustring_copy_ua_n(uchar_str_1, str_1, strlen(str_1)); - - // converts to uppercase letters - i18n_ustring_to_upper(uchar_str_2, 64, uchar_str_1, i18n_ustring_get_length( uchar_str_1 ), "en_US", &err_code); - - i18n_ustring_copy_au(str_1, uchar_str_2); - dlog_print(DLOG_INFO, LOG_TAG, "str_1 is %s\n", str_1); // str_1 is TIZEN - * @endcode - */ - -/** - * @addtogroup CAPI_BASE_UTILS_I18N_USTRING_MODULE - * @{ - */ - -/** - * @brief Determines the length of an array of #i18n_uchar. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The array of #i18n_uchar characters, @c NULL (U+0000) terminated. - * - * @return The number of #i18n_uchar characters in @c chars, minus the terminator - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_get_length(const i18n_uchar *s); - -/** - * @brief Counts Unicode code points in the length #i18n_uchar code units of the string. - * @details A code point may occupy either one or two #i18n_uchar code units. - * Counting code points involves reading all code units. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The input string. - * @param[in] length The number of #i18n_uchar code units to be checked, or @c -1 to count - * all code points before the first NULL (U+0000). - * - * @return The number of code points in the specified code units. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_count_char32(const i18n_uchar *s, int32_t length); - -/** - * @brief Checks if the string contains more Unicode code points than a certain number. - * @details This is more efficient than counting all code points in the entire string and comparing that number with a threshold. - * This function may not need to scan the string at all if the length is known (not @c -1 for NULL-termination) and falls within a certain range, - * and never needs to count more than 'number+1' code points. - * Logically equivalent to ( i18n_ustring_count_char32 (s, length, &number_of_code_points); number_of_code_points > number ). - * A Unicode code point may occupy either one or two #i18n_uchar code units. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The input string. - * @param[in] length The length of the string, or @c -1 if it is NULL-terminated. - * @param[in] number The number of code points in the string is compared against the @a number parameter. - * - * @return Boolean value for whether the string contains more Unicode code points than @a number. Same as ( i18n_ustring_count_char32 (s, length, &number_of_code_points); number_of_code_points > number). - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_ubool i18n_ustring_has_more_char32_than(const i18n_uchar *s, int32_t length, int32_t number); - -/** - * @brief Concatenates two ustrings. - * @details Appends a copy of @a src, including the NULL terminator, to @a dest. - * The initial copied character from @a src overwrites the NULL terminator in @a dest. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string. - * @param[in] src The source string. - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_cat(i18n_uchar *dest, const i18n_uchar *src); - -/** - * @brief Concatenate two ustrings. - * @details Appends a copy of @a src, including the NULL terminator, to @a dest. - * The initial copied character from @a src overwrites the NULL terminator in @a dest. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string. - * @param[in] src The source string. - * @param[in] n The maximum number of characters to append; no-op if <=0. - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_cat_n(i18n_uchar *dest, const i18n_uchar *src, int32_t n); - -/** - * @brief Finds the first occurrence of a substring in a string. - * @details The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate - * or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. - * Otherwise, the substring edge units would be matched against halves of surrogate pairs. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] sub_string The substring to find (NULL-terminated). - * - * @return A pointer to the first occurrence of @a sub_string in @a s, - * or @a s itself if the @a sub_string is empty, - * or @c NULL if @a sub_string is not in @a s. - * - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * - * @see i18n_ustring_r_string() - * @see i18n_ustring_find_first() - * @see i18n_ustring_find_last() - */ -i18n_uchar *i18n_ustring_string(const i18n_uchar *s, const i18n_uchar *sub_string); - -/** - * @brief Finds the first occurrence of a substring in a string. - * @details The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate - * or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. - * Otherwise, the substring edge units would be matched against halves of surrogate pairs. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] length The length of @a s (number of #i18n_uchar characters), or @c -1 if it is NULL-terminated. - * @param[in] sub_string The substring to find (NULL-terminated). - * @param[in] sub_length The length of substring (number of #i18n_uchar characters), or @c -1 if it is NULL-terminated. - * - * @return A pointer to the first occurrence of @a sub_string in @a s, - * or @a s itself if the @a sub_string is empty, - * or @c NULL if @a sub_string is not in @a s. - * - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * - * @see i18n_ustring_string() - * @see i18n_ustring_find_last() - */ -i18n_uchar *i18n_ustring_find_first(const i18n_uchar *s, int32_t length, const i18n_uchar *sub_string, int32_t sub_length); - -/** - * @brief Finds the first occurrence of a BMP code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] c The BMP code point to find. - * - * @return A pointer to the first occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_char32() - * @see i18n_ustring_mem_char() - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_char(const i18n_uchar *s, i18n_uchar c); - -/** - * @brief Finds the first occurrence of a code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] c The code point to find. - * - * @return A pointer to the first occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_char() - * @see i18n_ustring_mem_char32() - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_char32(const i18n_uchar *s, i18n_uchar32 c); - -/** - * @brief Finds the last occurrence of a substring in a string. - * @details The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate - * or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. - * Otherwise, the substring edge units would be matched against halves of surrogate pairs. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] sub_string The substring to find (NULL-terminated). - * - * @return A pointer to the last occurrence of @a substring in @a s, - * or @a s itself if the @a sub_string is empty, - * or @c NULL if @a sub_string is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - * @see i18n_ustring_find_last() - */ -i18n_uchar *i18n_ustring_r_string(const i18n_uchar *s, const i18n_uchar *sub_string); - -/** - * @brief Finds the last occurrence of a substring in a string. - * @details The substring is found at code point boundaries. That means that if the substring begins with a trail surrogate - * or ends with a lead surrogate, then it is found only if these surrogates stand alone in the text. - * Otherwise, the substring edge units would be matched against halves of surrogate pairs. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search. - * @param[in] length The length of s (number of #i18n_uchar), or @c -1 if it is NULL-terminated. - * @param[in] sub_string The sub_string to find (NULL-terminated). - * @param[in] sub_length The length of sub_string (number of #i18n_uchar), or @c -1 if it is NULL-terminated. - * - * @return A pointer to the last occurrence of @a sub_string in @a s, - * or @a s itself if the @a substring is empty, - * or @c NULL if @a sub_string is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_find_last(const i18n_uchar *s, int32_t length, const i18n_uchar *sub_string, int32_t sub_length); - -/** - * @brief Finds the last occurrence of a BMP code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] c The BMP code point to find. - * - * @return A pointer to the last occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_char32() - * @see i18n_ustring_mem_char() - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_r_char(const i18n_uchar *s, i18n_uchar c); - -/** - * @brief Finds the last occurrence of a code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (NULL-terminated). - * @param[in] c The code point to find. - * - * @return A pointer to the last occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_char() - * @see i18n_ustring_mem_char32() - * @see i18n_ustring_string() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_r_char32(const i18n_uchar *s, i18n_uchar32 c); - -/** - * @brief Locates the first occurrence in the string of any of the characters in the string matchSet. - * @details Works just like C's strpbrk but with Unicode. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] string The string in which to search, NULL-terminated. - * @param[in] match_set A NULL-terminated string defining a set of code points for which to search in the text string. - * - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @return A pointer to the character in @a string that matches one of the - * characters in @a match_set, or NULL if no such character is found. - */ -i18n_uchar *i18n_ustring_pbrk(const i18n_uchar *string, const i18n_uchar *match_set); - -/** - * @brief Returns the number of consecutive characters in string, beginning with the first, that do not occur somewhere in match_set. - * @details Works just like C's strcspn but with Unicode. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] string The string in which to search, NULL-terminated. - * @param[in] match_set A NULL-terminated string defining a set of code points for which to search in the text string. - * - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @return The number of initial characters in @a string that do not - * occur in @a match_set. - */ -int32_t i18n_ustring_cspn(const i18n_uchar *string, const i18n_uchar *match_set); - -/** - * @brief Returns the number of consecutive characters in string, beginning with the first, that occur somewhere in match_set. - * @details Works just like C's strspn but with Unicode. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] string The string in which to search, NULL-terminated. - * @param[in] match_set A NULL-terminated string defining a set of code points for which to search in the text string. - * @return The number of initial characters in @a string that do - * occur in @a match_set. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_spn() - */ -int32_t i18n_ustring_spn(const i18n_uchar *string, const i18n_uchar *match_set); - -/** - * @brief The string tokenizer API allows an application to break a string into tokens. - * @details Works just like C's strspn but with Unicode. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] src String containing token(s). This string will be modified. After the first call to #i18n_ustring_tokenizer_r(), this argument must be NULL to get to the next token. - * @param[in] delim Set of delimiter characters (Unicode code points). - * @param[out] save_state The current pointer within the original string, which is set by this function. - * The save_state parameter should the address of a local variable of type #i18n_uchar *. - * @return A pointer to the next token found in src, or NULL - * when there are no more tokens. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_tokenizer_r(i18n_uchar *src, const i18n_uchar *delim, i18n_uchar **save_state); - -/** - * @brief Compares two Unicode strings for bitwise equality (code unit order). - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @return 0 if @a s1 and @a s2 are bitwise equal; a negative - * value if @a s1 is bitwise less than @a s2; a positive - * value if @a s1 is bitwise greater than @a s2. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_compare(const i18n_uchar *s1, const i18n_uchar *s2); - -/** - * @brief Compare two Unicode strings in code point order. - * @details See #i18n_ustring_compare() for details. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @return a negative/zero/positive integer corresponding to whether - * the first string is less than/equal to/greater than the second one - * in code point order - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_compare_code_point_order(const i18n_uchar *s1, const i18n_uchar *s2); - -/** - * @brief Compare two Unicode strings (binary order). - * @details The comparison can be done in code unit order or in code point order. They differ only in UTF-16 when comparing supplementary code points - * (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). In code unit order, high BMP code points sort after - * supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff.\n - * This functions works with strings of different explicitly specified lengths unlike the ANSI C-like #i18n_ustring_compare() and #i18n_ustring_mem_compare() etc. - * NULL-terminated strings are possible with length arguments of -1. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 First source string. - * @param[in] length1 Length of first source string, or @c -1 if NULL-terminated. - * @param[in] s2 Second source string. - * @param[in] length2 Length of second source string, or @c -1 if NULL-terminated. - * @param[in] code_point_order Choose between code unit order (false) and code point order (true). - * @return < 0, 0 or > 0 as usual for string comparisons - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_compare_binary_order(const i18n_uchar *s1, int32_t length1, const i18n_uchar *s2, int32_t length2, i18n_ubool code_point_order); - -/** - * @brief Compare two strings case-insensitively using full case folding. - * @details The comparison can be done in UTF-16 code unit order or in code point order. They differ only when comparing - * supplementary code points (U+10000..U+10ffff) to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). - * In code unit order, high BMP code points sort after supplementary code points because they are stored as pairs of surrogates which are at U+d800..U+dfff.\n - * This functions works with strings of different explicitly specified lengths unlike the ANSI C-like #i18n_ustring_compare() and i18n_ustring_mem_compare() etc. - * NULL-terminated strings are possible with length arguments of -1. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 First source string. - * @param[in] length1 Length of first source string, or @c -1 if NULL-terminated. - * @param[in] s2 Second source string. - * @param[in] length2 Length of second source string, or @c -1 if NULL-terminated. - * @param[in] options A bit set of options:\n - * - #I18N_USTRING_U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding.\n - * - #I18N_USTRING_U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see i18n_ustring_compare_code_pointer_order() for details).\n - * - #I18N_USTRING_U_FOLD_CASE_EXCLUDE_SPECIAL_I - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return <0 or 0 or >0 as usual for string comparisons - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_case_compare_with_length(const i18n_uchar *s1, int32_t length1, const i18n_uchar *s2, int32_t length2, uint32_t options, i18n_error_code_e *error_code); - -/** - * @brief Compare two ustrings for bitwise equality. - * @details Compares at most n characters. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare (can be NULL/invalid if n<=0). - * @param[in] s2 A string to compare (can be NULL/invalid if n<=0). - * @param[in] n The maximum number of characters to compare; always returns 0 if n<=0. - * @return 0 if @a s1 and @a s2 are bitwise equal; a negative - * value if @a s1 is bitwise less than @a s2; a positive - * value if @a s1 is bitwise greater than @a s2. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_compare_n(const i18n_uchar *s1, const i18n_uchar *s2, int32_t n); - -/** - * @brief Compare two Unicode strings in code point order. - * @details This is different in UTF-16 from #i18n_ustring_compare_n() if supplementary characters are present. For details, see #i18n_ustring_compare_binary_order(). - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @param[in] n The maximum number of characters to compare. - * @return a negative/zero/positive integer corresponding to whether - * the first string is less than/equal to/greater than the second one - * in code point order - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_compare_n_code_point_order(const i18n_uchar *s1, const i18n_uchar *s2, int32_t n); - -/** - * @brief Compare two strings case-insensitively using full case folding. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @param[in] options bit set of options:\n - * - #I18N_USTRING_U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding. - * - #I18N_USTRING_U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details). - * - #I18N_USTRING_U_FOLD_CASE_EXCLUDE_SPECIAL_I - * @return A negative, zero, or positive integer indicating the comparison result. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_case_compare(const i18n_uchar *s1, const i18n_uchar *s2, uint32_t options); - -/** - * @brief Compare two strings case-insensitively using full case folding. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @param[in] n The maximum number of characters each string to case-fold and then compare. - * @param[in] options A bit set of options:\n - * - #I18N_USTRING_U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding. - * - #I18N_USTRING_U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details). - * - #I18N_USTRING_U_FOLD_CASE_EXCLUDE_SPECIAL_I - * @return A negative, zero, or positive integer indicating the comparison result. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_case_compare_n(const i18n_uchar *s1, const i18n_uchar *s2, int32_t n, uint32_t options); - -/** - * @brief Compare two strings case-insensitively using full case folding. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @param[in] length The number of characters in each string to case-fold and then compare. - * @param[in] options A bit set of options:\n - * - #I18N_USTRING_U_FOLD_CASE_DEFAULT or 0 is used for default options: Comparison in code unit order with default case folding. - * - #I18N_USTRING_U_COMPARE_CODE_POINT_ORDER Set to choose code point order instead of code unit order (see u_strCompare for details). - * - #I18N_USTRING_U_FOLD_CASE_EXCLUDE_SPECIAL_I - * @return A negative, zero, or positive integer indicating the comparison result. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_mem_case_compare(const i18n_uchar *s1, const i18n_uchar *s2, int32_t length, uint32_t options); - -/** - * @brief Copies a ustring. Adds a NULL terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_copy(i18n_uchar *dest, const i18n_uchar *src); - -/** - * @brief Copies a ustring. - * @details Copies at most @a n characters. The result will be NULL terminated - * if the length of @a src is less than @a n. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * @param[in] n The maximum number of characters to copy - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_copy_n(i18n_uchar *dest, const i18n_uchar *src, int32_t n); - -/** - * @brief Copies a byte string encoded in the default codepage to a ustring. - * @details Adds a NULL terminator. Performs a host byte to #i18n_uchar conversion. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_copy_ua(i18n_uchar *dest, const char *src); - -/** - * @brief Copies a byte string encoded in the default codepage to a ustring. - * @details Copies at most @a n characters. The result will be NULL terminated - * if the length of @a src is less than @a n. - * Performs a host byte to #i18n_uchar conversion. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * @param[in] n The maximum number of characters to copy - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_copy_ua_n(i18n_uchar *dest, const char *src, int32_t n); - -/** - * @brief Copies a ustring to a byte string encoded in the default codepage. - * @details Adds a NULL terminator. Performs an #i18n_uchar to host byte conversion. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -char *i18n_ustring_copy_au(char *dest, const i18n_uchar *src); - -/** - * @brief Copies a ustring to a byte string encoded in the default codepage. - * @details Copies at most @a n characters. The result will be NULL terminated - * if the length of @a src is less than @a n. - * Performs an #i18n_uchar to host byte conversion. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string - * @param[in] n The maximum number of characters to copy - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -char *i18n_ustring_copy_au_n(char *dest, const i18n_uchar *src, int32_t n); - -/** - * @brief Synonym for memcpy(), but with #i18n_uchar characters only. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string (can be NULL/invalid if count<=0) - * @param[in] count The number of characters to copy; no-op if <=0 - * - * @return A pointer to @a dest - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_mem_copy(i18n_uchar *dest, const i18n_uchar *src, int32_t count); - -/** - * @brief Synonym for memmove(), but with #i18n_uchar characters only. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] src The source string (can be NULL/invalid if count<=0) - * @param[in] count The number of characters to copy; no-op if <=0 - * - * @return A pointer to @a dest - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_mem_move(i18n_uchar *dest, const i18n_uchar *src, int32_t count); - -/** - * @brief Initialize count characters of dest to c. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest The destination string - * @param[in] c The character to initialize the string. - * @param[in] count The maximum number of characters to set. - * - * @return A pointer to @a dest. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_mem_set(i18n_uchar *dest, const i18n_uchar c, int32_t count); - -/** - * @brief Compare the first count #i18n_uchar characters of each buffer. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] buf1 The first string to compare. - * @param[in] buf2 The second string to compare. - * @param[in] count The maximum number of #i18n_uchar characters to compare. - * @return When buf1 < buf2, a negative number is returned. - * When buf1 == buf2, 0 is returned. - * When buf1 > buf2, a positive number is returned. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_mem_compare(const i18n_uchar *buf1, const i18n_uchar *buf2, int32_t count); - -/** - * @brief Compare two Unicode strings in code point order. - * @details This is different in UTF-16 from #i18n_ustring_mem_compare() if supplementary characters are present. For details, see #i18n_ustring_compare_binary_order(). - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s1 A string to compare. - * @param[in] s2 A string to compare. - * @param[in] count The maximum number of characters to compare. - * @return a negative/zero/positive integer corresponding to whether - * the first string is less than/equal to/greater than the second one - * in code point order - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_mem_compare_code_point_order(const i18n_uchar *s1, const i18n_uchar *s2, int32_t count); - -/** - * @brief Finds the first occurrence of a BMP code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (contains count #i18n_uchar characters). - * @param[in] c The BMP code point to find. - * @param[in] count The length of the string. - * @return A pointer to the first occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_char() - * @see i18n_ustring_mem_char32() - * @see i18n_ustring_find_first() - */ -i18n_uchar *i18n_ustring_mem_char(const i18n_uchar *s, i18n_uchar c, int32_t count); - -/** - * @brief Finds the first occurrence of a code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (contains count #i18n_uchar characters). - * @param[in] c The code point to find. - * @param[in] count The length of the string. - * @return A pointer to the first occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_mem_char32(const i18n_uchar *s, i18n_uchar32 c, int32_t count); - -/** - * @brief Finds the last occurrence of a BMP code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (contains count #i18n_uchar characters). - * @param[in] c The BMP code point to find. - * @param[in] count The length of the string. - * @return A pointer to the last occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see #i18n_ustring_r_char - * @see #i18n_ustring_mem_r_char32 - * @see #i18n_ustring_find_last - */ -i18n_uchar *i18n_ustring_mem_r_char(const i18n_uchar *s, i18n_uchar c, int32_t count); - -/** - * @brief Finds the last occurrence of a code point in a string. - * @details A surrogate code point is found only if its match in the text is not part of a surrogate pair. A NULL character is found at the string terminator. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] s The string to search (contains count #i18n_uchar characters). - * @param[in] c The code point to find. - * @param[in] count The length of the string. - * @return A pointer to the last occurrence of @a c in @a s - * or @c NULL if @a c is not in @a s. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see #i18n_ustring_r_char32 - * @see #i18n_ustring_mem_r_char - * @see #i18n_ustring_find_last - */ -i18n_uchar *i18n_ustring_mem_r_char32(const i18n_uchar *s, i18n_uchar32 c, int32_t count); - -/** - * @brief Unescape a string of characters and write the resulting Unicode characters to the destination buffer. - * @details The following escape sequences are recognized:\n - * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] \\Uhhhhhhhh 8 hex digits \\xhh 1-2 hex digits \\x{h...} 1-8 hex digits \\ooo 1-3 octal digits; o in [0-7] \\cX control-X; X is masked with 0x1F\n - * as well as the standard ANSI C escapes:\n - * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C\n - * Anything else following a backslash is generically escaped. For example, "[a\-z]" returns "[a-z]".\n - * If an escape sequence is ill-formed, this method returns an empty string. An example of an ill-formed sequence is "\\u" followed by fewer than 4 hex digits. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] src a zero-terminated string of invariant characters - * @param[in] dest pointer to buffer to receive converted and unescaped text and, if there is room, a zero terminator. May be NULL for preflighting, in which case no #i18n_uchar characters will be written, - * but the return value will still be valid. On error, an empty string is stored here (if possible). - * @param[in] dest_capacity the number of #i18n_uchar characters that may be written at dest. Ignored if dest == NULL. - * @return the length of unescaped string. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_unescape_at() - */ -int32_t i18n_ustring_unescape(const char *src, i18n_uchar *dest, int32_t dest_capacity); - -/** - * @brief Unescape a single sequence. - * @details The character at offset-1 is assumed (without checking) to be a backslash. This method takes a callback pointer to a function that returns the #i18n_uchar at a given offset. - * By varying this callback, I18N functions are able to unescape char* strings, and UnicodeString objects.\n - * If offset is out of range, or if the escape sequence is ill-formed, (i18n_uchar32)0xFFFFFFFF is returned. - * See documentation of #i18n_ustring_unescape() for a list of recognized sequences. - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[in] char_at callback function that returns a #i18n_uchar of the source text given an offset and a context pointer. - * @param[in] offset pointer to the offset that will be passed to char_at. The offset value will be updated upon return to point after the last parsed character of the escape sequence. - * On error the offset is unchanged. - * @param[in] length the number of #i18n_uchar characters that may be written at dest. Ignored if dest == NULL. - * @param[in] context an opaque pointer passed directly into char_at. - * - * @return the character represented by the escape sequence at - * offset, or (i18n_uchar32)0xFFFFFFFF on error. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_unescape() - */ -i18n_uchar32 i18n_ustring_unescape_at(i18n_ustring_unescape_char_at_cb char_at, int32_t *offset, int32_t length, void *context); - -/** - * @brief Uppercases the characters in a string. - * @details Casing is locale-dependent and context-sensitive. - * The result may be longer or shorter than the original. - * The source string and the destination buffer are allowed to overlap. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string\n The result will be zero-terminated if - * the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string. - * @param[in] src The original string - * @param[in] src_len The length of the original string\n - * If @c -1, then @a src must be zero-terminated. - * @param[in] locale The locale to consider, or "" for the root locale or @c NULL for the default locale. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The length of the result string. It may be greater than destCapacity. In that case, - * only some of the result was written to the destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_to_upper(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, const char *locale, i18n_error_code_e *error_code); - -/** - * @brief Lowercase the characters in a string. - * @details Casing is locale-dependent and context-sensitive. The result may be longer or shorter than the original. The source string and the destination buffer are allowed to overlap. - * The result may be longer or shorter than the original. - * The source string and the destination buffer are allowed to overlap. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string. The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is 0, then dest may be NULL and the function will only return the length of the result without writing any of the result string. - * @param[in] src The original string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[in] locale The locale to consider, or "" for the root locale or @c NULL for the default locale. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The length of the result string. It may be greater than destCapacity. In that case, - * only some of the result was written to the destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_to_lower(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, const char *locale, i18n_error_code_e *error_code); - -/** - * @brief Titlecases a string. - * @details Casing is locale-dependent and context-sensitive. - * Titlecasing uses a break iterator to find the first characters of words - * that are to be titlecased. It titlecases those characters and lowercases - * all others. - * @remarks The titlecase break iterator can be provided to customize arbitrary - * styles, using rules and dictionaries beyond the standard iterators. - * It may be more efficient to always provide an iterator to avoid - * opening and closing one for each string. - * The standard titlecase iterator for the root locale implements the - * algorithm of Unicode TR 21.\n - * The result may be longer or shorter than the original. - * The source string and the destination buffer are allowed to overlap. - * @since_tizen 2.3 - * - * @deprecated Deprecated since 2.3.1. Use i18n_ustring_to_title_new() instead. - * - * @param[out] dest A buffer for the result string\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string. - * @param[in] src The original string - * @param[in] src_len The length of the original string.\n If @c -1, then @a src must be zero-terminated. - * @param[in] title_iter A break iterator to find the first characters of words - * that are to be titlecased\n - * If none are provided (NULL), then a standard titlecase - * break iterator is opened. - * @param[in] locale The locale to consider, or "" for the root locale or @c NULL for the default locale. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The length of the result string. It may be greater than destCapacity. In that case, - * only some of the result was written to the destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_to_title(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, i18n_ubreak_iterator_s *title_iter, - const char *locale, i18n_error_code_e *error_code) TIZEN_DEPRECATED_API; - -/** - * @brief Titlecases a string. - * @details Casing is locale-dependent and context-sensitive. - * Titlecasing uses a break iterator to find the first characters of words - * that are to be titlecased. It titlecases those characters and lowercases - * all others. - * - * @remarks The specific error code can be obtained using the get_last_result() method. - * Error codes are described in Exceptions section and in #i18n_error_code_e description. - * - * The titlecase break iterator can be provided to customize arbitrary - * styles, using rules and dictionaries beyond the standard iterators. - * It may be more efficient to always provide an iterator to avoid - * opening and closing one for each string. - * The standard titlecase iterator for the root locale implements the - * algorithm of Unicode TR 21.\n - * The result may be longer or shorter than the original. - * The source string and the destination buffer are allowed to overlap. - * @since_tizen 2.3.1 - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters.\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string. - * @param[in] src The original string - * @param[in] src_len The length of the original string.\n If @c -1, then @a src must be zero-terminated. - * @param[in] title_iter A break iterator to find the first characters of words - * that are to be titlecased.\n - * If none are provided (@c NULL), then a standard titlecase - * break iterator is opened. - * @param[in] locale The locale to consider, or "" for the root locale or @c NULL for the default locale. - * @return The length of the result string. It may be greater than dest_capacity. In that case, - * only some of the result were written to the destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_to_title() - */ -int32_t i18n_ustring_to_title_new(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, i18n_ubreak_iterator_h title_iter, const char *locale); - -/** - * @brief Case-folds the characters in a string. - * @details Case-folding is locale-independent and not context-sensitive, - * but there is an option for whether to include or exclude mappings for dotted I and dotless i.\n - * The result may be longer or shorter than the original. - * The source string and the destination buffer are allowed to overlap. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string. - * @param[in] src The original string - * @param[in] src_len The length of the original string.\n If @c -1, then @a src must be zero-terminated. - * @param[in] options Either #I18N_USTRING_U_FOLD_CASE_DEFAULT or #I18N_USTRING_U_FOLD_CASE_EXCLUDE_SPECIAL_I - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The length of the result string. It may be greater than destCapacity. In that case, - * only some of the result was written to the destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_fold_case(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, uint32_t options, i18n_error_code_e *error_code); - -/** - * @brief Convert a UTF-16 string to a wchar_t string. - * @details If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then this function simply calls the fast, dedicated function for that. - * Otherwise, two conversions UTF-16 -> default charset -> wchar_t* are performed. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string. The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of wchar_t's).\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the number of output units corresponding to the transformation of all the input units, even in case of a buffer overflow. - * @param[in] src The original source string. - * @param[in] src_len The length of the original string.\n If @c -1, then @a src must be zero-terminated. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -wchar_t *i18n_ustring_to_WCS(wchar_t *dest, int32_t dest_capacity, int32_t *dest_len, const i18n_uchar *src, int32_t src_len, i18n_error_code_e *error_code); - -/** - * @brief Convert a wchar_t string to UTF-16. - * @details If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then this function simply calls the fast, dedicated function for that. - * Otherwise, two conversions wchar_t* -> default charset -> UTF-16 are performed. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string. The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters).\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the number of output units corresponding to the transformation of all the input units, even in case of a buffer overflow. - * @param[in] src The original source string. - * @param[in] src_len The length of the original string.\n If @c -1, then @a src must be zero-terminated. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_from_WCS(i18n_uchar *dest, int32_t dest_capacity, int32_t *dest_len, const wchar_t *src, int32_t src_len, i18n_error_code_e *error_code); - -/** - * @brief Converts a UTF-16 string to UTF-8. - * @details If the input string is not well-formed, then the #I18N_ERROR_INVALID_CHAR_FOUND error code is set. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of chars)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the - * number of output units corresponding to the transformation of - * all the input units, even in case of a buffer overflow. - * @param[in] src The original source string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_from_UTF8() - */ -char *i18n_ustring_to_UTF8(char *dest, int32_t dest_capacity, int32_t *dest_len, const i18n_uchar *src, int32_t src_len, i18n_error_code_e *error_code); - -/** - * @brief Converts a UTF-8 string to UTF-16. - * @details If the input string is not well-formed, then the #I18N_ERROR_INVALID_CHAR_FOUND error code is set. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the - * number of output units corresponding to the transformation of - * all the input units, even in case of a buffer overflow. - * @param[in] src The original source string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -i18n_uchar *i18n_ustring_from_UTF8(i18n_uchar *dest, int32_t dest_capacity, int32_t *dest_len, const char *src, int32_t src_len, i18n_error_code_e *error_code); - -/** - * @brief Convert a UTF-16 string to UTF-8. - * Same as #i18n_ustring_to_UTF8() except for the additional sub_char which is output for illegal input sequences, instead of stopping with the #I18N_ERROR_INVALID_CHAR_FOUND error code. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of chars)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the - * number of output units corresponding to the transformation of - * all the input units, even in case of a buffer overflow. - * @param[in] src The original source string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[in] sub_char The substitution character to use in place of an illegal input sequence, or U_SENTINEL if the function is to return with #I18N_ERROR_INVALID_CHAR_FOUND instead. - * A substitution character can be any valid Unicode code point (up to U+10FFFF) except for surrogate code points (U+D800..U+DFFF). - * The recommended value is U+FFFD "REPLACEMENT CHARACTER". - * @param[out] num_substitutions Output parameter receiving the number of substitutions if sub_char>=0. Set to 0 if no substitutions occur or sub_char<0. num_substitutions can be NULL. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_to_UTF8() - * @see i18n_ustring_from_UTF8_with_sub() - */ -char *i18n_ustring_to_UTF8_with_sub(char *dest, int32_t dest_capacity, int32_t *dest_len, const i18n_uchar *src, int32_t src_len, i18n_uchar32 sub_char, int32_t *num_substitutions, i18n_error_code_e *error_code); - -/** - * @brief Convert a UTF-8 string to UTF-16. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the - * number of output units corresponding to the transformation of - * all the input units, even in case of a buffer overflow. - * @param[in] src The original source string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[in] sub_char The substitution character to use in place of an illegal input sequence, or U_SENTINEL if the function is to return with #I18N_ERROR_INVALID_CHAR_FOUND instead. - * A substitution character can be any valid Unicode code point (up to U+10FFFF) except for surrogate code points (U+D800..U+DFFF). - * The recommended value is U+FFFD "REPLACEMENT CHARACTER". - * @param[out] num_substitutions Output parameter receiving the number of substitutions if sub_char>=0. Set to 0 if no substitutions occur or sub_char<0. num_substitutions can be NULL. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_from_UTF8() - * @see i18n_ustring_from_UTF8_lenient() - * @see i18n_ustring_to_UTF8_with_sub() - */ -i18n_uchar *i18n_ustring_from_UTF8_with_sub(i18n_uchar *dest, int32_t dest_capacity, int32_t *dest_len, const char *src, int32_t src_len, i18n_uchar32 sub_char, - int32_t *num_substitutions, i18n_error_code_e *error_code); - -/** - * @brief Convert a UTF-8 string to UTF-16. - * @details Same as i18n_ustring_from_UTF8() except that this function is designed to be very fast, which it achieves by being lenient about malformed UTF-8 sequences. - * This function is intended for use in environments where UTF-8 text is expected to be well-formed.\n - * Its semantics are: - * - Well-formed UTF-8 text is correctly converted to well-formed UTF-16 text.\n - * - The function will not read beyond the input string, nor write beyond the dest_capacity.\n - * - Malformed UTF-8 results in "garbage" 16-bit Unicode strings which may not be well-formed UTF-16. The function will resynchronize to valid code point boundaries within a small number of code points after an illegal sequence.\n - * - Non-shortest forms are not detected and will result in "spoofing" output.\n - * For further performance improvement, if src_len is given (>=0), then it must be dest_capacity>=src_len.\n - * There is no inverse i18n_ustring_to_UTF8_lenient() function because there is practically no performance gain from not checking that a UTF-16 string is well-formed. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * Unlike for other I18N functions, if src_len>=0 then it must be dest_capacity>=src_len. - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the number of output units corresponding - * to the transformation of all the input units, even in case of a buffer overflow. - * Unlike for other I18N functions, if src_len>=0 but dest_capacity=0. Set to 0 if no substitutions occur or sub_char<0. num_substitutions can be NULL. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_to_UTF32() - * @see i18n_ustring_from_UTF32_with_sub() - */ -i18n_uchar32 *i18n_ustring_to_UTF32_with_sub(i18n_uchar32 *dest, int32_t dest_capacity, int32_t *dest_len, const i18n_uchar *src, int32_t src_len, - i18n_uchar32 sub_char, int32_t *num_substitutions, i18n_error_code_e *error_code); - -/** - * @brief Convert a UTF-32 string to UTF-16. - * Same as #i18n_ustring_from_UTF32() except for the additional sub_char which is output for illegal input sequences, instead of stopping with the #I18N_ERROR_INVALID_CHAR_FOUND error code. - * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * - * @param[out] dest A buffer for the result string.\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of i18n_chars)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the - * result without writing any of the result string (pre-flighting). - * @param[out] dest_len A pointer to receive the number of units written to the destination.\n - * If dest_len!=NULL then *dest_len is always set to the number of output units corresponding - * to the transformation of all the input units, even in case of a buffer overflow. - * @param[in] src The original source string - * @param[in] src_len The length of the original string.\n - * If @c -1, then @a src must be zero-terminated. - * @param[in] sub_char The substitution character to use in place of an illegal input sequence, or U_SENTINEL if the function is to return with #I18N_ERROR_INVALID_CHAR_FOUND instead. - * A substitution character can be any valid Unicode code point (up to U+10FFFF) except for surrogate code points (U+D800..U+DFFF). - * The recommended value is U+FFFD "REPLACEMENT CHARACTER". - * @param[out] num_substitutions Output parameter receiving the number of substitutions if sub_char>=0. Set to 0 if no substitutions occur or sub_char<0. num_substitutions can be NULL. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The pointer to destination buffer. - * - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_from_UTF32() - * @see i18n_ustring_to_UTF32_with_sub() - */ -i18n_uchar *i18n_ustring_from_UTF32_with_sub(i18n_uchar *dest, int32_t dest_capacity, int32_t *dest_len, const i18n_uchar32 *src, int32_t src_len, i18n_uchar32 sub_char, int32_t *num_substitutions, i18n_error_code_e *error_code); - -#ifdef __cplusplus -} -#endif - -/** - * @} - * @} - */ -#endif /* __UTILS_I18N_USTRING_H__*/ diff --git a/src/include/utils_i18n_timezone.h b/src/include/utils_i18n_timezone.h index 09d3e72..f8ddec0 100644 --- a/src/include/utils_i18n_timezone.h +++ b/src/include/utils_i18n_timezone.h @@ -408,21 +408,6 @@ int i18n_timezone_get_display_name_with_type_locale(i18n_timezone_h timezone, i1 int i18n_timezone_use_daylight_time(i18n_timezone_h timezone, i18n_ubool *daylight_time); /** - * @brief Queries if the given date is in daylight savings time in this time zone. - * @details This method is wasteful since it creates a new GregorianCalendar and deletes it each time it is called. - * @since_tizen 2.3 - * - * @deprecated Deprecated since 2.3.1. Use i18n_ucalendar_is_in_daylight_time() instead. - * - * @param[in] timezone The i18n_timezone_h to know whether in daylight savings time or not. - * @param[in] date the given i18n_udate. - * @param[out] daylight_time True if the given date is in daylight savings time, False, otherwise. - * - * @retval #I18N_ERROR_NONE Successful - */ -int i18n_timezone_in_daylight_time(i18n_timezone_h timezone, i18n_udate date, i18n_ubool *daylight_time); - -/** * @brief Returns true if this zone has the same rule and offset as another zone. * @details That is, if this zone differs only in ID, if at all. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif diff --git a/src/include/utils_i18n_usearch.h b/src/include/utils_i18n_usearch.h index d82decc..b48bc24 100644 --- a/src/include/utils_i18n_usearch.h +++ b/src/include/utils_i18n_usearch.h @@ -81,31 +81,6 @@ extern "C" { */ /** - * @brief Creates an i18n_usearch_h using the argument locale language rule set. - * @details A collator will be created in the process, which will be owned by - * this search and will be deleted in i18n_usearch_destroy(). - * @remarks Must release @a search_iter using i18n_usearch_destroy(). - * @since_tizen 2.3 - * - * @deprecated Deprecated since 2.3.1. Use i18n_usearch_create_new() instead. - * - * @param[in] pattern The pattern for matching - * @param[in] pattern_len The length of the pattern, otherwise @c -1 for NULL-termination - * @param[in] text The text string - * @param[in] text_len The length of the text string, otherwise @c -1 for NULL-termination - * @param[in] locale The name of the locale for the rules to be used - * @param[in] break_iter An #i18n_ubreak_iterator_s that will be used to restrict the points at which matches are detected. If a match is found,\n - * but the match's start or end index is not a boundary as determined by the #i18n_ubreak_iterator_s, - * the match will be rejected and another will be searched for. If this parameter is @c NULL,\n - * no break detection is attempted. - * @param[out] search_iter The #i18n_usearch_h, otherwise @c NULL if there is an error - * - * @retval #I18N_ERROR_NONE Successful - * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int i18n_usearch_create(const i18n_uchar *pattern, int32_t pattern_len, const i18n_uchar *text, int32_t text_len, const char *locale, i18n_ubreak_iterator_s *break_iter, i18n_usearch_h *search_iter); - -/** * @brief Creates an #i18n_usearch_h using the argument locale language rule set. * @details A collator will be created in the process, which will be owned by * this search and will be deleted in i18n_usearch_destroy(). @@ -131,7 +106,7 @@ int i18n_usearch_create_new(const i18n_uchar *pattern, int32_t pattern_len, cons /** * @brief Destroys and cleans up the i18n_usearch_h. - * @details If a collator is created in i18n_usearch_create(), it will be destroyed here. + * @details If a collator is created in i18n_usearch_create_new(), it will be destroyed here. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] search_iter The i18n_usearch_h to clean up diff --git a/src/include/utils_i18n_ustring.h b/src/include/utils_i18n_ustring.h index a89153a..90b648a 100644 --- a/src/include/utils_i18n_ustring.h +++ b/src/include/utils_i18n_ustring.h @@ -946,46 +946,6 @@ int32_t i18n_ustring_to_lower(i18n_uchar *dest, int32_t dest_capacity, const i18 * Titlecasing uses a break iterator to find the first characters of words * that are to be titlecased. It titlecases those characters and lowercases * all others. - * @remarks The titlecase break iterator can be provided to customize arbitrary - * styles, using rules and dictionaries beyond the standard iterators. - * It may be more efficient to always provide an iterator to avoid - * opening and closing one for each string. - * The standard titlecase iterator for the root locale implements the - * algorithm of Unicode TR 21.\n - * The result may be longer or shorter than the original. - * The source string and the destination buffer are allowed to overlap. - * @since_tizen 2.3 - * - * @deprecated Deprecated since 2.3.1. Use i18n_ustring_to_title_new() instead. - * - * @param[out] dest A buffer for the result string\n - * The result will be zero-terminated if the buffer is large enough. - * @param[in] dest_capacity The size of the buffer (number of #i18n_uchar characters)\n - * If it is @c 0, then @a dest may be @c NULL and the function will only return the length of the result - * without writing any of the result string. - * @param[in] src The original string - * @param[in] src_len The length of the original string.\n If @c -1, then @a src must be zero-terminated. - * @param[in] title_iter A break iterator to find the first characters of words - * that are to be titlecased\n - * If none are provided (NULL), then a standard titlecase - * break iterator is opened. - * @param[in] locale The locale to consider, or "" for the root locale or @c NULL for the default locale. - * @param[out] error_code Must be a valid pointer to an error code value, - * which must not indicate a failure before the function call. - * @return The length of the result string. It may be greater than destCapacity. In that case, - * only some of the result was written to the destination buffer. - * @exception #I18N_ERROR_NONE Success - * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - */ -int32_t i18n_ustring_to_title(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, i18n_ubreak_iterator_s *title_iter, - const char *locale, i18n_error_code_e *error_code); - -/** - * @brief Titlecases a string. - * @details Casing is locale-dependent and context-sensitive. - * Titlecasing uses a break iterator to find the first characters of words - * that are to be titlecased. It titlecases those characters and lowercases - * all others. * * @remarks The specific error code can be obtained using the get_last_result() method. * Error codes are described in Exceptions section and in #i18n_error_code_e description. @@ -1016,7 +976,6 @@ int32_t i18n_ustring_to_title(i18n_uchar *dest, int32_t dest_capacity, const i18 * only some of the result were written to the destination buffer. * @exception #I18N_ERROR_NONE Success * @exception #I18N_ERROR_INVALID_PARAMETER Invalid function parameter - * @see i18n_ustring_to_title() */ int32_t i18n_ustring_to_title_new(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, i18n_ubreak_iterator_h title_iter, const char *locale); diff --git a/src/utils_i18n_timezone.cpp b/src/utils_i18n_timezone.cpp index 23b4494..3ddd2dd 100755 --- a/src/utils_i18n_timezone.cpp +++ b/src/utils_i18n_timezone.cpp @@ -404,22 +404,6 @@ int i18n_timezone_use_daylight_time(i18n_timezone_h timezone, i18n_ubool *daylig return I18N_ERROR_NONE; } -int i18n_timezone_in_daylight_time(i18n_timezone_h timezone, i18n_udate date, - i18n_ubool *daylight_time) -{ - ERR("DEPRECATION WARNING: i18n_timezone_in_daylight_time() is deprecated and will be removed from next release."); - retv_if(timezone == NULL || daylight_time == NULL, I18N_ERROR_INVALID_PARAMETER); - - UErrorCode status = U_ZERO_ERROR; - - *daylight_time = ((TimeZone *) timezone)->inDaylightTime(date, status); - i18n_error_code_e i18n_error = I18N_ERROR_NONE; - ERR_MAPPING(status, i18n_error); - I18N_ERR(i18n_error); - - return i18n_error; -} - int i18n_timezone_has_same_rule(i18n_timezone_h timezone, i18n_timezone_h other, i18n_ubool *same_rule) { diff --git a/src/utils_i18n_usearch.c b/src/utils_i18n_usearch.c index acd66b3..2bd8136 100644 --- a/src/utils_i18n_usearch.c +++ b/src/utils_i18n_usearch.c @@ -57,21 +57,6 @@ int i18n_usearch_get_matched_text(const i18n_usearch_h strsrch, i18n_uchar *resu return result; } -int i18n_usearch_create(const i18n_uchar *pattern, int32_t pattern_len, const i18n_uchar *text, - int32_t text_len, const char *locale, i18n_ubreak_iterator_s *break_iter, - i18n_usearch_h *search_iter) -{ - ERR("DEPRECATION WARNING:i18n_usearch_create() is deprecated and will be removed from next release."); - retv_if(search_iter == NULL, I18N_ERROR_INVALID_PARAMETER); - i18n_error_code_e err = I18N_ERROR_NONE; - *search_iter = - usearch_open(pattern, pattern_len, text, text_len, locale, (UBreakIterator *) break_iter, - (UErrorCode *) & err); - int result = _i18n_error_mapping(err); - - return result; -} - int i18n_usearch_create_new(const i18n_uchar *pattern, int32_t pattern_len, const i18n_uchar *text, int32_t text_len, const char *locale, i18n_ubreak_iterator_h break_iter, i18n_usearch_h *search_iter) diff --git a/src/utils_i18n_ustring.c b/src/utils_i18n_ustring.c index fdb13f9..0d70c06 100644 --- a/src/utils_i18n_ustring.c +++ b/src/utils_i18n_ustring.c @@ -521,25 +521,6 @@ int32_t i18n_ustring_to_lower(i18n_uchar *dest, int32_t dest_capacity, const i18 return result; } -int32_t i18n_ustring_to_title(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, - int32_t src_len, i18n_ubreak_iterator_s *title_iter, - const char *locale, i18n_error_code_e *i18n_error) -{ - ERR("DEPRECATION WARNING: i18n_ustring_to_title() is deprecated and will be removed from next release."); - if (src == NULL) { - *i18n_error = I18N_ERROR_INVALID_PARAMETER; - return 0; - } - - UErrorCode icu_error = U_ZERO_ERROR; - int32_t result = - u_strToTitle(dest, dest_capacity, src, src_len, (UBreakIterator *) title_iter, locale, - &icu_error); - *i18n_error = _i18n_error_mapping(icu_error); - - return result; -} - int32_t i18n_ustring_to_title_new(i18n_uchar *dest, int32_t dest_capacity, const i18n_uchar *src, int32_t src_len, i18n_ubreak_iterator_h title_iter, const char *locale) -- 2.7.4