From: sung.goo.kim Date: Wed, 14 Oct 2015 01:06:48 +0000 (+0900) Subject: (ACR) Integrate iotcon_state_del_xxx -> iotcon_state_del X-Git-Tag: accepted/tizen/mobile/20151201.031626~83 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=60d8eb42df9093b8eb270a34f76beef0f58e1818;p=platform%2Fcore%2Fiot%2Fiotcon.git (ACR) Integrate iotcon_state_del_xxx -> iotcon_state_del Change-Id: I031cbde4331892a1c1082068081d90f2b705df32 --- diff --git a/lib/icl-repr-state.c b/lib/icl-repr-state.c index 419e5fa..2844422 100644 --- a/lib/icl-repr-state.c +++ b/lib/icl-repr-state.c @@ -80,7 +80,7 @@ API void iotcon_state_destroy(iotcon_state_h state) } -int icl_state_del_value(iotcon_state_h state, const char *key, iotcon_types_e value_type) +int icl_state_del_value(iotcon_state_h state, const char *key) { gboolean ret = FALSE; iotcon_value_h value = NULL; @@ -94,11 +94,6 @@ int icl_state_del_value(iotcon_state_h state, const char *key, iotcon_types_e va return IOTCON_ERROR_NO_DATA; } - if (value_type != value->type) { - ERR("Type matching Fail(input:%d, saved:%d)", value_type, value->type); - return IOTCON_ERROR_INVALID_TYPE; - } - ret = g_hash_table_remove(state->hash_table, key); if (FALSE == ret) { ERR("g_hash_table_remove(%s) Fail", key); @@ -151,14 +146,14 @@ API int iotcon_state_set_int(iotcon_state_h state, const char *key, int val) return IOTCON_ERROR_NONE; } -API int iotcon_state_del_int(iotcon_state_h state, const char *key) +API int iotcon_state_del(iotcon_state_h state, const char *key) { int ret; RETV_IF(NULL == state, IOTCON_ERROR_INVALID_PARAMETER); RETV_IF(NULL == key, IOTCON_ERROR_INVALID_PARAMETER); - ret = icl_state_del_value(state, key, IOTCON_TYPE_INT); + ret = icl_state_del_value(state, key); if (IOTCON_ERROR_NONE != ret) ERR("icl_state_del_value() Fail(%d)", ret); @@ -209,20 +204,6 @@ API int iotcon_state_set_bool(iotcon_state_h state, const char *key, bool val) return IOTCON_ERROR_NONE; } -API int iotcon_state_del_bool(iotcon_state_h state, const char *key) -{ - int ret; - - RETV_IF(NULL == state, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == key, IOTCON_ERROR_INVALID_PARAMETER); - - ret = icl_state_del_value(state, key, IOTCON_TYPE_BOOL); - if (IOTCON_ERROR_NONE != ret) - ERR("icl_state_del_value() Fail(%d)", ret); - - return ret; -} - API int iotcon_state_get_double(iotcon_state_h state, const char *key, double *val) { icl_basic_s *real = NULL; @@ -267,20 +248,6 @@ API int iotcon_state_set_double(iotcon_state_h state, const char *key, double va return IOTCON_ERROR_NONE; } -API int iotcon_state_del_double(iotcon_state_h state, const char *key) -{ - int ret; - - RETV_IF(NULL == state, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == key, IOTCON_ERROR_INVALID_PARAMETER); - - ret = icl_state_del_value(state, key, IOTCON_TYPE_DOUBLE); - if (IOTCON_ERROR_NONE != ret) - ERR("icl_state_del_value() Fail(%d)", ret); - - return ret; -} - API int iotcon_state_get_str(iotcon_state_h state, const char *key, char **val) { icl_basic_s *real = NULL; @@ -326,20 +293,6 @@ API int iotcon_state_set_str(iotcon_state_h state, const char *key, char *val) return IOTCON_ERROR_NONE; } -API int iotcon_state_del_str(iotcon_state_h state, const char *key) -{ - int ret; - - RETV_IF(NULL == state, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == key, IOTCON_ERROR_INVALID_PARAMETER); - - ret = icl_state_del_value(state, key, IOTCON_TYPE_STR); - if (IOTCON_ERROR_NONE != ret) - ERR("icl_state_del_value() Fail(%d)", ret); - - return ret; -} - API int iotcon_state_is_null(iotcon_state_h state, const char *key, bool *is_null) { icl_basic_s *real = NULL; @@ -378,20 +331,6 @@ API int iotcon_state_set_null(iotcon_state_h state, const char *key) return IOTCON_ERROR_NONE; } -API int iotcon_state_del_null(iotcon_state_h state, const char *key) -{ - int ret; - - RETV_IF(NULL == state, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == key, IOTCON_ERROR_INVALID_PARAMETER); - - ret = icl_state_del_value(state, key, IOTCON_TYPE_NULL); - if (IOTCON_ERROR_NONE != ret) - ERR("icl_state_del_value() Fail(%d)", ret); - - return ret; -} - API int iotcon_state_get_list(iotcon_state_h state, const char *key, iotcon_list_h *list) { iotcon_value_h value = NULL; @@ -438,21 +377,6 @@ API int iotcon_state_set_list(iotcon_state_h state, const char *key, iotcon_list return IOTCON_ERROR_NONE; } -API int iotcon_state_del_list(iotcon_state_h state, const char *key) -{ - int ret; - - RETV_IF(NULL == state, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == key, IOTCON_ERROR_INVALID_PARAMETER); - - ret = icl_state_del_value(state, key, IOTCON_TYPE_LIST); - if (IOTCON_ERROR_NONE != ret) - ERR("icl_state_del_value() Fail(%d)", ret); - - return ret; -} - - API int iotcon_state_get_state(iotcon_state_h src, const char *key, iotcon_state_h *dest) { icl_val_state_s *real = NULL; @@ -499,20 +423,6 @@ API int iotcon_state_set_state(iotcon_state_h state, const char *key, iotcon_sta return IOTCON_ERROR_NONE; } -API int iotcon_state_del_state(iotcon_state_h state, const char *key) -{ - int ret; - - RETV_IF(NULL == state, IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == key, IOTCON_ERROR_INVALID_PARAMETER); - - ret = icl_state_del_value(state, key, IOTCON_TYPE_STATE); - if (IOTCON_ERROR_NONE != ret) - ERR("icl_state_del_value() Fail(%d)", ret); - - return ret; -} - API int iotcon_state_get_type(iotcon_state_h state, const char *key, int *type) { iotcon_value_h value = NULL; diff --git a/lib/icl-repr-state.h b/lib/icl-repr-state.h index b796e8d..4b99808 100644 --- a/lib/icl-repr-state.h +++ b/lib/icl-repr-state.h @@ -23,8 +23,7 @@ void icl_state_inc_ref_count(iotcon_state_h val); int icl_state_dec_ref_count(iotcon_state_h val); -int icl_state_del_value(iotcon_state_h state, const char *key, - iotcon_types_e value_type); +int icl_state_del_value(iotcon_state_h state, const char *key); int icl_state_set_value(iotcon_state_h state, const char *key, iotcon_value_h value); diff --git a/lib/include/iotcon-representation.h b/lib/include/iotcon-representation.h index 03360f7..7695018 100644 --- a/lib/include/iotcon-representation.h +++ b/lib/include/iotcon-representation.h @@ -479,7 +479,7 @@ int iotcon_state_get_state(iotcon_state_h src, const char *key, iotcon_state_h * int iotcon_state_is_null(iotcon_state_h state, const char *key, bool *is_null); /** - * @brief Deletes the key and its associated integer value from the state. + * @brief Deletes the key and its associated value from the state. * * @since_tizen 3.0 * @@ -490,105 +490,8 @@ int iotcon_state_is_null(iotcon_state_h state, const char *key, bool *is_null); * @retval #IOTCON_ERROR_NONE Successful * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter * @retval #IOTCON_ERROR_NO_DATA No data available - * @retval #IOTCON_ERROR_INVALID_TYPE Invalid type - */ -int iotcon_state_del_int(iotcon_state_h state, const char *key); - -/** - * @brief Deletes the key and its associated boolean value from the state. - * - * @since_tizen 3.0 - * - * @param[in] state The state handle - * @param[in] key The key - * - * @return 0 on success, otherwise a negative error value. - * @retval #IOTCON_ERROR_NONE Successful - * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #IOTCON_ERROR_NO_DATA No data available - * @retval #IOTCON_ERROR_INVALID_TYPE Invalid type - */ -int iotcon_state_del_bool(iotcon_state_h state, const char *key); - -/** - * @brief Deletes the key and its associated double value from the state. - * - * @since_tizen 3.0 - * - * @param[in] state The state handle - * @param[in] key The key - * - * @return 0 on success, otherwise a negative error value. - * @retval #IOTCON_ERROR_NONE Successful - * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #IOTCON_ERROR_NO_DATA No data available - * @retval #IOTCON_ERROR_INVALID_TYPE Invalid type - */ -int iotcon_state_del_double(iotcon_state_h state, const char *key); - -/** - * @brief Deletes the key and its associated string value from the state. - * - * @since_tizen 3.0 - * - * @param[in] state The state handle - * @param[in] key The key - * - * @return 0 on success, otherwise a negative error value. - * @retval #IOTCON_ERROR_NONE Successful - * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #IOTCON_ERROR_NO_DATA No data available - * @retval #IOTCON_ERROR_INVALID_TYPE Invalid type - */ -int iotcon_state_del_str(iotcon_state_h state, const char *key); - -/** - * @brief Deletes the key and its associated list value from the state. - * - * @since_tizen 3.0 - * - * @param[in] state The state handle - * @param[in] key The key - * - * @return 0 on success, otherwise a negative error value. - * @retval #IOTCON_ERROR_NONE Successful - * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #IOTCON_ERROR_NO_DATA No data available - * @retval #IOTCON_ERROR_INVALID_TYPE Invalid type - */ -int iotcon_state_del_list(iotcon_state_h state, const char *key); - -/** - * @brief Deletes the key and its associated state value from the state. - * - * @since_tizen 3.0 - * - * @param[in] state The state handle - * @param[in] key The key - * - * @return 0 on success, otherwise a negative error value. - * @retval #IOTCON_ERROR_NONE Successful - * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #IOTCON_ERROR_NO_DATA No data available - * @retval #IOTCON_ERROR_INVALID_TYPE Invalid type - */ -int iotcon_state_del_state(iotcon_state_h state, const char *key); - -/** - * @brief Deletes the key from the state. - * - * @since_tizen 3.0 - * - * @param[in] state The state handle - * @param[in] key The key - * - * @return 0 on success, otherwise a negative error value. - * @retval #IOTCON_ERROR_NONE Successful - * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #IOTCON_ERROR_NO_DATA No data available - * @retval #IOTCON_ERROR_INVALID_TYPE Invalid type */ -int iotcon_state_del_null(iotcon_state_h state, const char *key); +int iotcon_state_del(iotcon_state_h state, const char *key); /** * @brief Gets the type of a value at the given key.