utils_i18n_measure.cpp
utils_i18n_format.cpp
utils_i18n_measure_format.cpp
+ utils_i18n_field_position.cpp
)
ADD_LIBRARY(${target_name} SHARED ${BASEUTILS_SRCS}
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_measure.h DESTINATION ${INCLUDE_INSTALL_DIR}/base)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_format.h DESTINATION ${INCLUDE_INSTALL_DIR}/base)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_measure_format.h DESTINATION ${INCLUDE_INSTALL_DIR}/base)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n_field_position.h DESTINATION ${INCLUDE_INSTALL_DIR}/base)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${INC_DIR}/utils_i18n.h DESTINATION ${INCLUDE_INSTALL_DIR}/base)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pc_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
\ No newline at end of file
#include <utils_i18n_measure.h>
#include <utils_i18n_format.h>
#include <utils_i18n_measure_format.h>
+#include <utils_i18n_field_position.h>
/**
* @file utils_i18n.h
/**
* @ingroup CAPI_BASE_UTILS_MODULE
* @defgroup CAPI_BASE_UTILS_I18N_MODULE i18n
- * @brief The i18n module contains uchar, ucollator, unormalization, usearch, ustring, ucalendar, udate, udatepg, ulocale, unumber, alpha_idx, formattable, measure unit, measure, format and measure format.
+ * @brief The i18n module contains uchar, ucollator, unormalization, usearch, ustring, ucalendar, udate, udatepg, ulocale, unumber, alpha_idx, formattable, measure unit, measure, format, measure format and field position.
* This module provides flexible generation of number or date format patterns and helps you format and parse dates/number for any locale.
* The i18n module provides various features based on data from ICU. The following table shows the version of ICU used in each Tizen platform.
* <table>
* <td>@ref CAPI_BASE_UTILS_I18N_MEASURE_FORMAT_MODULE</td>
* <td>The Measure Format module represents a formatter for measure objects.</td>
* </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION</td>
+ * <td>The Field Position module is used to identify fields in a formatted output.</td>
+ * </tr>
* </table>
*
* @section CAPI_BASE_UTILS_I18N_MODULE_MAPPING_TABLE Mapping Table
* <td>#i18n_measure_format_create_currency_format</td>
* <td>createCurrencyFormat</td>
* </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_create</td>
+ * <td>FieldPosition</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_create_for_field</td>
+ * <td>FieldPosition</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_destroy</td>
+ * <td>~FieldPosition</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_clone</td>
+ * <td>clone</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_get_field</td>
+ * <td>getField</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_get_begin_index</td>
+ * <td>getBeginIndex</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_get_end_index</td>
+ * <td>getEndIndex</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_set_field</td>
+ * <td>setField</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_set_begin_index</td>
+ * <td>setBeginIndex</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_set_end_index</td>
+ * <td>setEndIndex</td>
+ * </tr>
* </table>
*/
--- /dev/null
+/*
+ * 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_FIELD_POSITION_H__
+#define __UTILS_I18N_FIELD_POSITION_H__
+
+#include <utils_i18n_types.h>
+
+/**
+ * @file utils_i18n_field_position.h
+ * @version 0.1
+ * @brief utils_i18n_field_position
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @ingroup CAPI_BASE_UTILS_I18N_MODULE
+ * @defgroup CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE FieldPosition
+ * @brief Field Position is a simple type used by the Format module and its submodules
+ * to identify fields in formatted output.
+ * @section CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE_HEADER Required Header
+ * \#include <utils_i18n.h>
+ *
+ * @section CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE_OVERVIEW Overview
+ * @details Fields are identified by constants, whose names typically end with _FIELD,
+ * defined in the various subclasses of Format. Field position keeps track of the position
+ * of the field within the formatted output with two indices: the index of the first
+ * character of the field and the index of the last character of the field. One version
+ * of the format method in the various Format classes requires a Field Position object
+ * as an argument. You use this format method to perform partial formatting or to get
+ * information about the formatted output (such as the position of a field).
+ * The FieldPosition class is not suitable for subclassing.
+ */
+
+/**
+ * @addtogroup CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates a field position object with a non-specified field.
+ * @remarks The created object should be released by the caller with the
+ * i18n_field_position_destroy() function.
+ * @since_tizen 3.0
+ *
+ * @param[out] field_position The created field position object
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int i18n_field_position_create(i18n_field_position_h *field_position);
+
+/**
+ * @brief Creates a field position object for the given field.
+ * @details Fields are identified by constants, whose names typically end with _FIELD,
+ * in the various subtypes of Format.
+ * @remarks The created object should be released by the caller with the
+ * i18n_field_position_destroy() function.
+ * @since_tizen 3.0
+ *
+ * @param[in] field The field value
+ * @param[out] field_position The created field position object
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int i18n_field_position_create_for_field(int32_t field, i18n_field_position_h *field_position);
+
+/**
+ * @brief Destroys the field position object.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field position object to destroy
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_destroy(i18n_field_position_h field_position);
+
+/**
+ * @brief Creates a polymorphic clone of the given @a field_position object.
+ * @remarks The @a clone object should be released by the caller with the
+ * i18n_field_position_destroy() function.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field position object to be cloned
+ * @param[out] clone The created field position object
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int i18n_field_position_clone(i18n_field_position_h field_position, i18n_field_position_h *clone);
+
+/**
+ * @brief Retrieves the field identifier.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field_position object
+ * @param[out] field The field identifier
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_get_field(i18n_field_position_h field_position, int32_t *field);
+
+/**
+ * @brief Retrieves the index of the first character in the requested field.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field position object
+ * @param[out] begin_index The index of the first character in the requested field
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_get_begin_index(i18n_field_position_h field_position, int32_t *begin_index);
+
+/**
+ * @brief Retrieves the index of the character following the last character in the requested field.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field position object
+ * @param[out] end_index The index of the character following the last character
+ * in the requested field
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_get_end_index(i18n_field_position_h field_position, int32_t *end_index);
+
+/**
+ * @brief Sets the field.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field_position object
+ * @param[in] field The new value of the field
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_set_field(i18n_field_position_h field_position, int32_t field);
+
+/**
+ * @brief Sets the begin index.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field_position object
+ * @param[in] begin_index The new value of the begin index
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_set_begin_index(i18n_field_position_h field_position, int32_t begin_index);
+
+/**
+ * @brief Sets the end index.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field_position object
+ * @param[in] end_position The new value of the end index
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_set_end_index(i18n_field_position_h field_position, int32_t end_index);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UTILS_I18N_FIELD_POSITION_H__*/
typedef void *i18n_measure_unit_h;
/**
- * @brief Callback function for the #i18n_measure_unit_get_available_types()
+ * @brief Callback function for the i18n_measure_unit_get_available_types()
* that returns an enumeration over all recognized types.
* @since_tizen 3.0
*
I18_ALPHA_IDX_OVERFLOW,
} i18_alpha_idx_label_type_e;
+/**
+ * @brief Handle to the object used by the Format and its subtypes to identify fields in a formatted output
+ * @since_tizen 3.0
+ */
+typedef void *i18n_field_position_h;
+
+/**
+ * @brief DONT_CARE may be specified as the field to indicate that the caller doesn't need to specify a field.
+ * @since_tizen 3.0
+ */
+typedef enum {
+ I18N_FIELD_POSITION_DONT_CARE = -1,
+} i18n_field_position_dont_care_e;
+
#ifdef __cplusplus
}
#endif
#include <utils_i18n_measure.h>
#include <utils_i18n_format.h>
#include <utils_i18n_measure_format.h>
+#include <utils_i18n_field_position.h>
/**
* @file utils_i18n.h
/**
* @ingroup CAPI_BASE_UTILS_MODULE
* @defgroup CAPI_BASE_UTILS_I18N_MODULE i18n
- * @brief The i18n module contains uchar, ucollator, unormalization, usearch, ustring, ucalendar, udate, udatepg, ulocale, unumber, alpha_idx, formattable, measure, format and measure format.
+ * @brief The i18n module contains uchar, ucollator, unormalization, usearch, ustring, ucalendar, udate, udatepg, ulocale, unumber, alpha_idx, formattable, measure, format, measure format and field position.
* This module provides flexible generation of number or date format patterns and helps you format and parse dates/number for any locale.
* The i18n module provides various features based on data from ICU. The following table shows the version of ICU used in each Tizen platform.
* <table>
* <td>@ref CAPI_BASE_UTILS_I18N_MEASURE_FORMAT_MODULE</td>
* <td>The Measure Format module represents a formatter for measure objects.</td>
* </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION</td>
+ * <td>The Field Position module is used to identify fields in a formatted output.</td>
+ * </tr>
* </table>
*
* @section CAPI_BASE_UTILS_I18N_MODULE_MAPPING_TABLE Mapping Table
* <td>#i18n_measure_format_create_currency_format</td>
* <td>createCurrencyFormat</td>
* </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_create</td>
+ * <td>FieldPosition</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_create_for_field</td>
+ * <td>FieldPosition</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_destroy</td>
+ * <td>~FieldPosition</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_clone</td>
+ * <td>clone</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_get_field</td>
+ * <td>getField</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_get_begin_index</td>
+ * <td>getBeginIndex</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_get_end_index</td>
+ * <td>getEndIndex</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_set_field</td>
+ * <td>setField</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_set_begin_index</td>
+ * <td>setBeginIndex</td>
+ * </tr>
+ * <tr>
+ * <td>@ref CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE</td>
+ * <td>#i18n_field_position_set_end_index</td>
+ * <td>setEndIndex</td>
+ * </tr>
* </table>
*/
--- /dev/null
+/*
+ * 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_FIELD_POSITION_H__
+#define __UTILS_I18N_FIELD_POSITION_H__
+
+#include <utils_i18n_types.h>
+
+/**
+ * @file utils_i18n_field_position.h
+ * @version 0.1
+ * @brief utils_i18n_field_position
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @ingroup CAPI_BASE_UTILS_I18N_MODULE
+ * @defgroup CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE FieldPosition
+ * @brief Field Position is a simple type used by the Format module and its submodules
+ * to identify fields in formatted output.
+ * @section CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE_HEADER Required Header
+ * \#include <utils_i18n.h>
+ *
+ * @section CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE_OVERVIEW Overview
+ * @details Fields are identified by constants, whose names typically end with _FIELD,
+ * defined in the various subclasses of Format. Field position keeps track of the position
+ * of the field within the formatted output with two indices: the index of the first
+ * character of the field and the index of the last character of the field. One version
+ * of the format method in the various Format classes requires a Field Position object
+ * as an argument. You use this format method to perform partial formatting or to get
+ * information about the formatted output (such as the position of a field).
+ * The FieldPosition class is not suitable for subclassing.
+ */
+
+/**
+ * @addtogroup CAPI_BASE_UTILS_I18N_FIELD_POSITION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates a field position object with a non-specified field.
+ * @remarks The created object should be released by the caller with the
+ * i18n_field_position_destroy() function.
+ * @since_tizen 3.0
+ *
+ * @param[out] field_position The created field position object
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int i18n_field_position_create(i18n_field_position_h *field_position);
+
+/**
+ * @brief Creates a field position object for the given field.
+ * @details Fields are identified by constants, whose names typically end with _FIELD,
+ * in the various subtypes of Format.
+ * @remarks The created object should be released by the caller with the
+ * i18n_field_position_destroy() function.
+ * @since_tizen 3.0
+ *
+ * @param[in] field The field value
+ * @param[out] field_position The created field position object
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int i18n_field_position_create_for_field(int32_t field, i18n_field_position_h *field_position);
+
+/**
+ * @brief Destroys the field position object.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field position object to destroy
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_destroy(i18n_field_position_h field_position);
+
+/**
+ * @brief Creates a polymorphic clone of the given @a field_position object.
+ * @remarks The @a clone object should be released by the caller with the
+ * i18n_field_position_destroy() function.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field position object to be cloned
+ * @param[out] clone The created field position object
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #I18N_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int i18n_field_position_clone(i18n_field_position_h field_position, i18n_field_position_h *clone);
+
+/**
+ * @brief Retrieves the field identifier.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field_position object
+ * @param[out] field The field identifier
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_get_field(i18n_field_position_h field_position, int32_t *field);
+
+/**
+ * @brief Retrieves the index of the first character in the requested field.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field position object
+ * @param[out] begin_index The index of the first character in the requested field
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_get_begin_index(i18n_field_position_h field_position, int32_t *begin_index);
+
+/**
+ * @brief Retrieves the index of the character following the last character in the requested field.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field position object
+ * @param[out] end_index The index of the character following the last character
+ * in the requested field
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_get_end_index(i18n_field_position_h field_position, int32_t *end_index);
+
+/**
+ * @brief Sets the field.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field_position object
+ * @param[in] field The new value of the field
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_set_field(i18n_field_position_h field_position, int32_t field);
+
+/**
+ * @brief Sets the begin index.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field_position object
+ * @param[in] begin_index The new value of the begin index
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_set_begin_index(i18n_field_position_h field_position, int32_t begin_index);
+
+/**
+ * @brief Sets the end index.
+ * @since_tizen 3.0
+ *
+ * @param[in] field_position The field_position object
+ * @param[in] end_position The new value of the end index
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #I18N_ERROR_NONE Successful
+ * @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ */
+int i18n_field_position_set_end_index(i18n_field_position_h field_position, int32_t end_index);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UTILS_I18N_FIELD_POSITION_H__*/
I18_ALPHA_IDX_OVERFLOW,
} i18_alpha_idx_label_type_e;
+/**
+ * @brief Handle to the object used by the Format and its subtypes to identify fields in a formatted output
+ * @since_tizen 3.0
+ */
+typedef void *i18n_field_position_h;
+
+/**
+ * @brief DONT_CARE may be specified as the field to indicate that the caller doesn't need to specify a field.
+ * @since_tizen 3.0
+ */
+typedef enum {
+ I18N_FIELD_POSITION_DONT_CARE = -1,
+} i18n_field_position_dont_care_e;
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+/*
+ * 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.
+ */
+
+#include <utils_i18n_field_position.h>
+#include <utils_i18n_private.h>
+
+#include <unicode/fieldpos.h>
+
+int i18n_field_position_create(i18n_field_position_h *field_position)
+{
+ retv_if(field_position == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+ *field_position = new FieldPosition();
+ retv_if(*field_position == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+ return I18N_ERROR_NONE;
+}
+
+int i18n_field_position_create_for_field(int32_t field, i18n_field_position_h *field_position)
+{
+ retv_if(field_position == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+ *field_position = new FieldPosition(field);
+ retv_if(*field_position == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+ return I18N_ERROR_NONE;
+}
+
+int i18n_field_position_destroy(i18n_field_position_h field_position)
+{
+ retv_if(field_position == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+ delete((FieldPosition *) field_position);
+
+ return I18N_ERROR_NONE;
+}
+
+int i18n_field_position_clone(i18n_field_position_h field_position, i18n_field_position_h *clone)
+{
+ retv_if(field_position == NULL || clone == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+ *clone = ((FieldPosition *) field_position)->clone();
+ retv_if(*clone == NULL, I18N_ERROR_OUT_OF_MEMORY);
+
+ return I18N_ERROR_NONE;
+}
+
+int i18n_field_position_get_field(i18n_field_position_h field_position, int32_t *field)
+{
+ retv_if(field_position == NULL, I18N_ERROR_INVALID_PARAMETER);
+ retv_if(field == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+ *field = ((FieldPosition *) field_position)->getField();
+
+ return I18N_ERROR_NONE;
+}
+
+int i18n_field_position_get_begin_index(i18n_field_position_h field_position, int32_t *begin_index)
+{
+ retv_if(field_position == NULL, I18N_ERROR_INVALID_PARAMETER);
+ retv_if(begin_index == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+ *begin_index = ((FieldPosition *) field_position)->getBeginIndex();
+
+ return I18N_ERROR_NONE;
+}
+
+int i18n_field_position_get_end_index(i18n_field_position_h field_position, int32_t *end_index)
+{
+ retv_if(field_position == NULL, I18N_ERROR_INVALID_PARAMETER);
+ retv_if(end_index == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+ *end_index = ((FieldPosition *) field_position)->getEndIndex();
+
+ return I18N_ERROR_NONE;
+}
+
+int i18n_field_position_set_field(i18n_field_position_h field_position, int32_t field)
+{
+ retv_if(field_position == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+ ((FieldPosition *) field_position)->setField(field);
+
+ return I18N_ERROR_NONE;
+}
+
+int i18n_field_position_set_begin_index(i18n_field_position_h field_position, int32_t begin_index)
+{
+ retv_if(field_position == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+ ((FieldPosition *) field_position)->setBeginIndex(begin_index);
+
+ return I18N_ERROR_NONE;
+}
+
+int i18n_field_position_set_end_index(i18n_field_position_h field_position, int32_t end_index)
+{
+ retv_if(field_position == NULL, I18N_ERROR_INVALID_PARAMETER);
+
+ ((FieldPosition *) field_position)->setEndIndex(end_index);
+
+ return I18N_ERROR_NONE;
+}