} i18n_unumber_format_attribute_e;
/**
+ * @brief Enumeration for the possible values of the #I18N_UNUMBER_PADDING_POSITION attribute.
+ * @since_tizen 3.0
+ */
+typedef enum {
+ I18N_UNUMBER_PAD_BEFORE_PREFIX,
+ I18N_UNUMBER_PAD_AFTER_PREFIX,
+ I18N_UNUMBER_PAD_BEFORE_SUFFIX,
+ I18N_UNUMBER_PAD_AFTER_SUFFIX,
+} i18n_unumber_pad_position_e;
+
+/**
* @brief The possible #i18n_unumber_format_h text attributes.
* @since_tizen 2.3.1
*/
* @details An example of a numeric attribute is the number of integer digits a formatter will produce.
* If the formatter does not understand the attribute, the call is ignored. Rule-based formatters only understand
* the lenient-parse attribute. The #I18N_UNUMBER_ROUNDING_INCREMENT attribute is not supported.
+ *
+ * Note that the value for the #I18N_UNUMBER_PADDING_POSITION attribute should be one of the #i18n_unumber_pad_position_e
+ * enumeration values.
* @remarks Error codes are described in #i18n_error_code_e description.
* @since_tizen 2.3.1
*
* @return The obtained error code.
* @retval #I18N_ERROR_NONE Successful.
* @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #I18N_ERROR_NOT_SUPPORTED Not supported
*/
int i18n_unumber_set_attribute(i18n_unumber_format_h fmt, i18n_unumber_format_attribute_e attr, int32_t new_value);
} i18n_unumber_format_attribute_e;
/**
+ * @brief Enumeration for the possible values of the #I18N_UNUMBER_PADDING_POSITION attribute.
+ * @since_tizen 3.0
+ */
+typedef enum {
+ I18N_UNUMBER_PAD_BEFORE_PREFIX,
+ I18N_UNUMBER_PAD_AFTER_PREFIX,
+ I18N_UNUMBER_PAD_BEFORE_SUFFIX,
+ I18N_UNUMBER_PAD_AFTER_SUFFIX,
+} i18n_unumber_pad_position_e;
+
+/**
* @brief The possible #i18n_unumber_format_h text attributes.
* @since_tizen 2.3.1
*/
* @details An example of a numeric attribute is the number of integer digits a formatter will produce.
* If the formatter does not understand the attribute, the call is ignored. Rule-based formatters only understand
* the lenient-parse attribute. The #I18N_UNUMBER_ROUNDING_INCREMENT attribute is not supported.
+ *
+ * Note that the value for the #I18N_UNUMBER_PADDING_POSITION attribute should be one of the #i18n_unumber_pad_position_e
+ * enumeration values.
* @remarks Error codes are described in #i18n_error_code_e description.
* @since_tizen 2.3.1
*
* @return The obtained error code.
* @retval #I18N_ERROR_NONE Successful.
* @retval #I18N_ERROR_INVALID_PARAMETER Invalid function parameter
+ * @retval #I18N_ERROR_NOT_SUPPORTED Not supported
*/
int i18n_unumber_set_attribute(i18n_unumber_format_h fmt, i18n_unumber_format_attribute_e attr, int32_t new_value);
int i18n_unumber_set_attribute(i18n_unumber_format_h fmt, i18n_unumber_format_attribute_e attr,
int32_t new_value)
{
- if (fmt == NULL || attr == I18N_UNUMBER_ROUNDING_INCREMENT)
- return I18N_ERROR_INVALID_PARAMETER;
+ if (fmt == NULL) return I18N_ERROR_INVALID_PARAMETER;
+
+ if (attr == I18N_UNUMBER_ROUNDING_INCREMENT) return I18N_ERROR_NOT_SUPPORTED;
+
+ if (attr == I18N_UNUMBER_PADDING_POSITION &&
+ (new_value < I18N_UNUMBER_PAD_BEFORE_PREFIX || new_value > I18N_UNUMBER_PAD_AFTER_SUFFIX))
+ return I18N_ERROR_INVALID_PARAMETER;
unum_setAttribute(fmt, attr, new_value);
return I18N_ERROR_NONE;