modify naming of repr
authorMinchul Lee <slotus.lee@samsung.com>
Wed, 3 Jun 2015 05:54:31 +0000 (14:54 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Mon, 8 Jun 2015 10:41:11 +0000 (19:41 +0900)
Change-Id: I6704f86ca0f3a4c577daa2dec0a7c619fa918488
Signed-off-by: Minchul Lee <slotus.lee@samsung.com>
lib/ic-repr-list.c
lib/ic-repr.c
lib/include/iotcon-representation.h
test/repr-test-client.c

index 485cae0..5171034 100755 (executable)
@@ -191,7 +191,7 @@ API int iotcon_list_insert_repr(iotcon_list_h list, iotcon_repr_h val, int pos)
 }
 
 
-API int iotcon_list_get_nth_int(iotcon_list_h list, int index, int *val)
+API int iotcon_list_get_nth_int(iotcon_list_h list, int pos, int *val)
 {
        int ival, ret;
        iotcon_value_h value;
@@ -200,7 +200,7 @@ API int iotcon_list_get_nth_int(iotcon_list_h list, int index, int *val)
        RETV_IF(NULL == list->list, IOTCON_ERROR_PARAM);
        RETV_IF(NULL == val, IOTCON_ERROR_PARAM);
 
-       value = g_list_nth_data(list->list, index);
+       value = g_list_nth_data(list->list, pos);
        if (NULL == value) {
                ERR("g_list_nth_data() Fail");
                return IOTCON_ERROR_NO_DATA;
@@ -218,7 +218,7 @@ API int iotcon_list_get_nth_int(iotcon_list_h list, int index, int *val)
 }
 
 
-API int iotcon_list_get_nth_bool(iotcon_list_h list, int index, bool *val)
+API int iotcon_list_get_nth_bool(iotcon_list_h list, int pos, bool *val)
 {
        int ret;
        bool bval;
@@ -228,7 +228,7 @@ API int iotcon_list_get_nth_bool(iotcon_list_h list, int index, bool *val)
        RETV_IF(NULL == list->list, IOTCON_ERROR_PARAM);
        RETV_IF(NULL == val, IOTCON_ERROR_PARAM);
 
-       value = g_list_nth_data(list->list, index);
+       value = g_list_nth_data(list->list, pos);
        if (NULL == value) {
                ERR("g_list_nth_data() Fail");
                return IOTCON_ERROR_NO_DATA;
@@ -246,7 +246,7 @@ API int iotcon_list_get_nth_bool(iotcon_list_h list, int index, bool *val)
 }
 
 
-API int iotcon_list_get_nth_double(iotcon_list_h list, int index, double *val)
+API int iotcon_list_get_nth_double(iotcon_list_h list, int pos, double *val)
 {
        int ret;
        double dbval;
@@ -256,7 +256,7 @@ API int iotcon_list_get_nth_double(iotcon_list_h list, int index, double *val)
        RETV_IF(NULL == list->list, IOTCON_ERROR_PARAM);
        RETV_IF(NULL == val, IOTCON_ERROR_PARAM);
 
-       value = g_list_nth_data(list->list, index);
+       value = g_list_nth_data(list->list, pos);
        if (NULL == value) {
                ERR("g_list_nth_data() Fail");
                return IOTCON_ERROR_NO_DATA;
@@ -274,7 +274,7 @@ API int iotcon_list_get_nth_double(iotcon_list_h list, int index, double *val)
 }
 
 
-API int iotcon_list_get_nth_str(iotcon_list_h list, int index, const char **val)
+API int iotcon_list_get_nth_str(iotcon_list_h list, int pos, const char **val)
 {
        int ret;
        const char *strval;
@@ -284,7 +284,7 @@ API int iotcon_list_get_nth_str(iotcon_list_h list, int index, const char **val)
        RETV_IF(NULL == list->list, IOTCON_ERROR_PARAM);
        RETV_IF(NULL == val, IOTCON_ERROR_PARAM);
 
-       value = g_list_nth_data(list->list, index);
+       value = g_list_nth_data(list->list, pos);
        if (NULL == value) {
                ERR("g_list_nth_data() Fail");
                return IOTCON_ERROR_NO_DATA;
@@ -302,7 +302,7 @@ API int iotcon_list_get_nth_str(iotcon_list_h list, int index, const char **val)
 }
 
 
-API int iotcon_list_get_nth_list(iotcon_list_h src, int index, iotcon_list_h *dest)
+API int iotcon_list_get_nth_list(iotcon_list_h src, int pos, iotcon_list_h *dest)
 {
        int ret;
        iotcon_value_h value;
@@ -312,7 +312,7 @@ API int iotcon_list_get_nth_list(iotcon_list_h src, int index, iotcon_list_h *de
        RETV_IF(NULL == src->list, IOTCON_ERROR_PARAM);
        RETV_IF(NULL == dest, IOTCON_ERROR_PARAM);
 
-       value = g_list_nth_data(src->list, index);
+       value = g_list_nth_data(src->list, pos);
        if (NULL == value) {
                ERR("g_list_nth_data() Fail");
                return IOTCON_ERROR_NO_DATA;
@@ -330,7 +330,7 @@ API int iotcon_list_get_nth_list(iotcon_list_h src, int index, iotcon_list_h *de
 }
 
 
-API int iotcon_list_get_nth_repr(iotcon_list_h list, int index, iotcon_repr_h *repr)
+API int iotcon_list_get_nth_repr(iotcon_list_h list, int pos, iotcon_repr_h *repr)
 {
        int ret;
        iotcon_value_h value;
@@ -340,7 +340,7 @@ API int iotcon_list_get_nth_repr(iotcon_list_h list, int index, iotcon_repr_h *r
        RETV_IF(NULL == list->list, IOTCON_ERROR_PARAM);
        RETV_IF(NULL == repr, IOTCON_ERROR_PARAM);
 
-       value = g_list_nth_data(list->list, index);
+       value = g_list_nth_data(list->list, pos);
        if (NULL == value) {
                ERR("g_list_nth_data() Fail");
                return IOTCON_ERROR_NO_DATA;
@@ -652,12 +652,12 @@ API int iotcon_list_foreach_repr(iotcon_list_h list, iotcon_list_repr_fn fn, voi
 }
 
 
-static iotcon_value_h _ic_list_get_nth_value(iotcon_list_h list, int index)
+static iotcon_value_h _ic_list_get_nth_value(iotcon_list_h list, int pos)
 {
        RETV_IF(NULL == list, NULL);
        RETV_IF(NULL == list->list, NULL);
 
-       return g_list_nth_data(list->list, index);
+       return g_list_nth_data(list->list, pos);
 }
 
 
index 577e562..729e17b 100644 (file)
@@ -150,7 +150,7 @@ API int iotcon_repr_append_child(iotcon_repr_h parent, iotcon_repr_h child)
        return IOTCON_ERROR_NONE;
 }
 
-API int iotcon_repr_get_children(iotcon_repr_h parent, iotcon_children_fn fn,
+API int iotcon_repr_foreach_children(iotcon_repr_h parent, iotcon_children_fn fn,
                void *user_data)
 {
        GList *list, *next;
@@ -177,13 +177,13 @@ API unsigned int iotcon_repr_get_children_count(iotcon_repr_h parent)
        return g_list_length(parent->children);
 }
 
-API int iotcon_repr_get_nth_child(iotcon_repr_h parent, int index, iotcon_repr_h *child)
+API int iotcon_repr_get_nth_child(iotcon_repr_h parent, int pos, iotcon_repr_h *child)
 {
        RETV_IF(NULL == parent, IOTCON_ERROR_PARAM);
        RETV_IF(NULL == parent->children, IOTCON_ERROR_PARAM);
        RETV_IF(NULL == child, IOTCON_ERROR_PARAM);
 
-       *child = g_list_nth_data(parent->children, index);
+       *child = g_list_nth_data(parent->children, pos);
        if (NULL == *child) {
                ERR("g_list_nth_data() Fail");
                return IOTCON_ERROR_NO_DATA;
index 7e82758..7a0c6ac 100755 (executable)
@@ -103,10 +103,10 @@ int iotcon_repr_get_type(iotcon_repr_h repr, const char *key, int *type);
 
 int iotcon_repr_append_child(iotcon_repr_h parent, iotcon_repr_h child);
 typedef bool (*iotcon_children_fn)(iotcon_repr_h child, void *user_data);
-int iotcon_repr_get_children(iotcon_repr_h parent, iotcon_children_fn fn,
+int iotcon_repr_foreach_children(iotcon_repr_h parent, iotcon_children_fn fn,
                void *user_data);
 unsigned int iotcon_repr_get_children_count(iotcon_repr_h parent);
-int iotcon_repr_get_nth_child(iotcon_repr_h parent, int index, iotcon_repr_h *child);
+int iotcon_repr_get_nth_child(iotcon_repr_h parent, int pos, iotcon_repr_h *child);
 
 iotcon_str_list_s* iotcon_repr_get_key_list(iotcon_repr_h repr);
 int iotcon_repr_get_keys_count(iotcon_repr_h repr);
@@ -136,12 +136,12 @@ int iotcon_list_insert_str(iotcon_list_h list, char *val, int pos);
 int iotcon_list_insert_list(iotcon_list_h list, iotcon_list_h val, int pos);
 int iotcon_list_insert_repr(iotcon_list_h list, iotcon_repr_h val, int pos);
 
-int iotcon_list_get_nth_int(iotcon_list_h list, int index, int *val);
-int iotcon_list_get_nth_bool(iotcon_list_h list, int index, bool *val);
-int iotcon_list_get_nth_double(iotcon_list_h list, int index, double *val);
-int iotcon_list_get_nth_str(iotcon_list_h list, int index, const char **val);
-int iotcon_list_get_nth_list(iotcon_list_h src, int index, iotcon_list_h *dest);
-int iotcon_list_get_nth_repr(iotcon_list_h list, int index, iotcon_repr_h *repr);
+int iotcon_list_get_nth_int(iotcon_list_h list, int pos, int *val);
+int iotcon_list_get_nth_bool(iotcon_list_h list, int pos, bool *val);
+int iotcon_list_get_nth_double(iotcon_list_h list, int pos, double *val);
+int iotcon_list_get_nth_str(iotcon_list_h list, int pos, const char **val);
+int iotcon_list_get_nth_list(iotcon_list_h src, int pos, iotcon_list_h *dest);
+int iotcon_list_get_nth_repr(iotcon_list_h list, int pos, iotcon_repr_h *repr);
 
 int iotcon_list_del_nth_int(iotcon_list_h list, int pos);
 int iotcon_list_del_nth_bool(iotcon_list_h list, int pos);
@@ -153,24 +153,18 @@ int iotcon_list_del_nth_repr(iotcon_list_h list, int pos);
 int iotcon_list_get_type(iotcon_list_h list, int *type);
 unsigned int iotcon_list_get_length(iotcon_list_h list);
 
-typedef int (*iotcon_list_int_fn)(int index, const int value,
-               void *user_data);
+typedef int (*iotcon_list_int_fn)(int pos, const int value, void *user_data);
 int iotcon_list_foreach_int(iotcon_list_h list, iotcon_list_int_fn fn, void *user_data);
-typedef int (*iotcon_list_bool_fn)(int index, const bool value,
-               void *user_data);
+typedef int (*iotcon_list_bool_fn)(int pos, const bool value, void *user_data);
 int iotcon_list_foreach_bool(iotcon_list_h list, iotcon_list_bool_fn fn, void *user_data);
-typedef int (*iotcon_list_double_fn)(int index, const double value,
-               void *user_data);
+typedef int (*iotcon_list_double_fn)(int pos, const double value, void *user_data);
 int iotcon_list_foreach_double(iotcon_list_h list, iotcon_list_double_fn fn,
                void *user_data);
-typedef int (*iotcon_list_str_fn)(int index, const char *value,
-               void *user_data);
+typedef int (*iotcon_list_str_fn)(int pos, const char *value, void *user_data);
 int iotcon_list_foreach_str(iotcon_list_h list, iotcon_list_str_fn fn, void *user_data);
-typedef int (*iotcon_list_list_fn)(int index, iotcon_list_h value,
-               void *user_data);
+typedef int (*iotcon_list_list_fn)(int pos, iotcon_list_h value, void *user_data);
 int iotcon_list_foreach_list(iotcon_list_h list, iotcon_list_list_fn fn, void *user_data);
-typedef int (*iotcon_list_repr_fn)(int index, iotcon_repr_h value,
-               void *user_data);
+typedef int (*iotcon_list_repr_fn)(int pos, iotcon_repr_h value, void *user_data);
 int iotcon_list_foreach_repr(iotcon_list_h list, iotcon_list_repr_fn fn, void *user_data);
 
 #endif /* __IOT_CONNECTIVITY_MANAGER_REPRESENTATION_H__ */
index bef1dfe..489ba3c 100644 (file)
@@ -25,7 +25,7 @@ const char* const room_uri = "/a/room";
 
 iotcon_client_h room_resource = NULL;
 
-static int _get_int_list_fn(int index, const int value, void *user_data)
+static int _get_int_list_fn(int pos, const int value, void *user_data)
 {
        DBG("%d°C", value);