[Base-utils][Unumber] Missing description added 04/76304/1 accepted/tizen/common/20160624.134233 accepted/tizen/ivi/20160624.064955 accepted/tizen/mobile/20160624.065001 accepted/tizen/tv/20160624.064908 accepted/tizen/wearable/20160624.065016 submit/tizen/20160624.055318
authorRafał Szczekutek <r.szczekutek@samsung.com>
Thu, 23 Jun 2016 10:03:07 +0000 (12:03 +0200)
committerRafał Szczekutek <r.szczekutek@samsung.com>
Thu, 23 Jun 2016 10:03:07 +0000 (12:03 +0200)
The description for the possible values that can be set with the
i18n_unumber_set_attribute() function for the
I18N_UNUMBER_PADDING_POSITION attribute.

Related enumeration added.
Validation added, to prevent from casting invalid values to the enumeration.

Change-Id: I97bec5c1c8238a49732dfd20b520b8a730438856
Signed-off-by: Rafał Szczekutek <r.szczekutek@samsung.com>
src/include/mobile/utils_i18n_types.h
src/include/mobile/utils_i18n_unumber.h
src/include/wearable/utils_i18n_types.h
src/include/wearable/utils_i18n_unumber.h
src/utils_i18n_unumber.c

index 833d356..24b92ce 100644 (file)
@@ -2180,6 +2180,17 @@ typedef enum {
 } 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
  */
index 996bb25..b0ab229 100644 (file)
@@ -481,6 +481,9 @@ int32_t i18n_unumber_get_attribute(const i18n_unumber_format_h fmt, i18n_unumber
  * @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
  *
@@ -498,6 +501,7 @@ int32_t i18n_unumber_get_attribute(const i18n_unumber_format_h fmt, i18n_unumber
  * @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);
 
index 4800a5d..e999e64 100644 (file)
@@ -2180,6 +2180,17 @@ typedef enum {
 } 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
  */
index 996bb25..b0ab229 100644 (file)
@@ -481,6 +481,9 @@ int32_t i18n_unumber_get_attribute(const i18n_unumber_format_h fmt, i18n_unumber
  * @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
  *
@@ -498,6 +501,7 @@ int32_t i18n_unumber_get_attribute(const i18n_unumber_format_h fmt, i18n_unumber
  * @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);
 
index 6edabac..de5229d 100644 (file)
@@ -320,8 +320,13 @@ int32_t i18n_unumber_get_attribute(const i18n_unumber_format_h fmt,
 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;