![]() |
Functions for manage easydbus array containers
Functions | |
int | easydbus_array_add_array (EasyDbus_container *array_src, EasyDbus_container *array_dst) |
Add an array on array. | |
int | easydbus_array_add_boolean_array (EasyDbus_container *container, unsigned int nel, char *boolean_array) |
Add boolean array on container. | |
int | easydbus_array_add_byte_array (EasyDbus_container *container, unsigned int nel, char *bytes) |
Add byte array on array container. | |
int | easydbus_array_add_dict_entry (EasyDbus_container *dict_entry, EasyDbus_container *array) |
Add dict entry on array. | |
int | easydbus_array_add_double_array (EasyDbus_container *container, unsigned int nel, double *double_array) |
Add double array to array container. | |
int | easydbus_array_add_i16_array (EasyDbus_container *container, unsigned int nel, short *i16_array) |
Add int16 array on array container. | |
int | easydbus_array_add_i32_array (EasyDbus_container *container, unsigned int nel, int *i32_array) |
Add int32 array to array container. | |
int | easydbus_array_add_i64_array (EasyDbus_container *container, unsigned int nel, long long *i64_array) |
Add int64 array to array container. | |
int | easydbus_array_add_obj_path_array (EasyDbus_container *container, unsigned int nel, char **obj_path_array) |
Add object path string array to array container. | |
int | easydbus_array_add_signature_array (EasyDbus_container *container, unsigned int nel, char **signature_array) |
Add signature string array to array container. | |
int | easydbus_array_add_string_array (EasyDbus_container *container, unsigned int nel, char **string_array) |
Add string array to array container. | |
int | easydbus_array_add_struct (EasyDbus_container *struct_internal, EasyDbus_container *array) |
Add struct element to array. | |
int | easydbus_array_add_ui16_array (EasyDbus_container *container, unsigned int nel, unsigned short *ui16_array) |
Add unsigned int16 array to array container. | |
int | easydbus_array_add_ui32_array (EasyDbus_container *container, unsigned int nel, unsigned int *ui32_array) |
Add unsigned int32 array to array container. | |
int | easydbus_array_add_ui64_array (EasyDbus_container *container, unsigned int nel, unsigned long long *ui64_array) |
Add unsigned int64 array to array container. | |
int | easydbus_array_add_variant (EasyDbus_container *variant, EasyDbus_container *array) |
Add variant on array. | |
const EasyDbus_container * | easydbus_array_get_array (EasyDbus_container *array, unsigned int n) |
Get array container from array container. | |
const char * | easydbus_array_get_boolean_array (EasyDbus_container *array) |
Get boolean array from container. | |
const char * | easydbus_array_get_byte_array (EasyDbus_container *array) |
Get byte array from container. | |
const EasyDbus_container * | easydbus_array_get_dict_entry (EasyDbus_container *array, unsigned int n) |
Get dict_entry container from array container. | |
const double * | easydbus_array_get_double_array (EasyDbus_container *array) |
Get double array from container. | |
const short * | easydbus_array_get_i16_array (EasyDbus_container *array) |
Get int16 array from container. | |
const int * | easydbus_array_get_i32_array (EasyDbus_container *array) |
Get int32 array from container. | |
const long long * | easydbus_array_get_i64_array (EasyDbus_container *array) |
Get int64 array from container. | |
const char ** | easydbus_array_get_obj_path_array (EasyDbus_container *array) |
Get object path string array from container. | |
const char ** | easydbus_array_get_signature_array (EasyDbus_container *array) |
Get signature string array from container. | |
const char ** | easydbus_array_get_string_array (EasyDbus_container *array) |
Get string array from container. | |
const EasyDbus_container * | easydbus_array_get_struct (EasyDbus_container *array, unsigned int n) |
Get struct container from array container. | |
const unsigned short * | easydbus_array_get_ui16_array (EasyDbus_container *array) |
Get unsigned int16 array from container. | |
const unsigned int * | easydbus_array_get_ui32_array (EasyDbus_container *array) |
Get unsigned int32 array from container. | |
const unsigned long long * | easydbus_array_get_ui64_array (EasyDbus_container *array) |
Get unsigned int64 array from container. | |
const EasyDbus_container * | easydbus_array_get_variant (EasyDbus_container *array, unsigned int n) |
Get variant container from array container. |
int easydbus_array_add_array | ( | EasyDbus_container * | array_src, | |
EasyDbus_container * | array_dst | |||
) |
Add an array on array.
array_src | array to add. | |
array_dst | array where is added array_src. |
0 ok
Definition at line 54 of file array.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_ARRAY, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_elem::p_container, EasyDbus_container::p_data, and EasyDbus_elem::payload.
Referenced by easydbus_get_marshal_data_from_array().
00056 { 00057 00058 struct EasyDbus_elem *el = NULL; 00059 struct EasyDbus_elem *elms = NULL; 00060 00061 if (!array_src || !array_dst || 00062 array_src->container_type != EASYDBUS_ELTYPE_ARRAY || 00063 array_dst->container_type != EASYDBUS_ELTYPE_ARRAY) 00064 return -1; 00065 00066 /* create dict_entry element */ 00067 el = easydbus_elem_create (EASYDBUS_ELTYPE_ARRAY); 00068 if (!el) 00069 return -1; 00070 00071 el->payload.p_container = array_src; 00072 00073 if (array_dst->nel) { 00074 /* array already contains dict_entry */ 00075 elms = (struct EasyDbus_elem *) array_dst->p_data; 00076 while (elms->next) 00077 elms = elms->next; 00078 elms->next = el; 00079 } 00080 else { 00081 /* array is empty */ 00082 array_dst->elem_type = EASYDBUS_ELTYPE_ARRAY; 00083 array_dst->p_data = el; 00084 } 00085 00086 array_dst->nel++; 00087 return 0; 00088 }
int easydbus_array_add_boolean_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
char * | boolean_array | |||
) |
Add boolean array on container.
container | array container where insert boolean array. | |
nel | number of elements on boolean array. | |
boolean_array | boolean array memory pointer |
-1 there are already some data connect to container
0 ok
Definition at line 274 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_BOOLEAN, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00277 { 00278 if (nel == 0 || !boolean_array || !container || 00279 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00280 return -1; 00281 00282 if (container->nel) 00283 return -1; 00284 00285 container->p_data = malloc (nel); 00286 if (!container->p_data) 00287 return -1; 00288 00289 EASYDBUS_MEMCOPY (container->p_data, boolean_array, nel); 00290 00291 container->nel = nel; 00292 container->elem_type = EASYDBUS_ELTYPE_BOOLEAN; 00293 00294 return 0; 00295 }
int easydbus_array_add_byte_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
char * | bytes | |||
) |
Add byte array on array container.
container | container object where insert byte array. | |
nel | number of byte elements. | |
bytes | pointer to bytes array. |
-1 there are already some data connect to struct.
0 ok
Definition at line 238 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_BYTE, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00240 { 00241 if (nel == 0 || !bytes || !container) 00242 return -1; 00243 00244 if (container->container_type != EASYDBUS_ELTYPE_ARRAY) 00245 return -1; 00246 00247 if (container->nel) 00248 return -1; 00249 00250 00251 container->p_data = malloc (nel); 00252 if (!container->p_data) 00253 return -1; 00254 00255 EASYDBUS_MEMCOPY (container->p_data, bytes, nel); 00256 00257 container->nel = nel; 00258 container->elem_type = EASYDBUS_ELTYPE_BYTE; 00259 return 0; 00260 }
int easydbus_array_add_dict_entry | ( | EasyDbus_container * | dict_entry, | |
EasyDbus_container * | array | |||
) |
Add dict entry on array.
dict_entry | dict entry element to add on array | |
array | array where is added dict entry. |
0 ok
Definition at line 102 of file array.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_DICT_ENTRY, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_elem::p_container, EasyDbus_container::p_data, and EasyDbus_elem::payload.
Referenced by easydbus_get_marshal_data_from_array().
00104 { 00105 00106 struct EasyDbus_elem *el = NULL; 00107 struct EasyDbus_elem *elms = NULL; 00108 00109 if (!array || !dict_entry || 00110 dict_entry->container_type != EASYDBUS_ELTYPE_DICT_ENTRY || 00111 array->container_type != EASYDBUS_ELTYPE_ARRAY) 00112 return -1; 00113 00114 /* create dict_entry element */ 00115 el = easydbus_elem_create (EASYDBUS_ELTYPE_DICT_ENTRY); 00116 if (!el) 00117 return -1; 00118 00119 el->payload.p_container = dict_entry; 00120 00121 if (array->nel) { 00122 /* array already contains dict_entry */ 00123 elms = (struct EasyDbus_elem *) array->p_data; 00124 while (elms->next) 00125 elms = elms->next; 00126 elms->next = el; 00127 } 00128 else { 00129 /* array is empty */ 00130 array->elem_type = EASYDBUS_ELTYPE_DICT_ENTRY; 00131 array->p_data = el; 00132 } 00133 00134 array->nel++; 00135 return 0; 00136 }
int easydbus_array_add_double_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
double * | double_array | |||
) |
Add double array to array container.
container | array container where insert array | |
nel | number of element of the array. | |
double_array | pointer to double array. |
-1 there are already some data connect to container.
0 ok
Definition at line 538 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_DOUBLE, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00541 { 00542 size_t size_array = 0; 00543 00544 if (nel == 0 || !double_array || !container || 00545 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00546 return -1; 00547 00548 if (container->nel) 00549 return -1; 00550 00551 size_array = sizeof (double[nel]); 00552 00553 container->p_data = malloc (size_array); 00554 if (!container->p_data) 00555 return -1; 00556 00557 EASYDBUS_MEMCOPY (container->p_data, double_array, size_array); 00558 container->nel = nel; 00559 container->elem_type = EASYDBUS_ELTYPE_DOUBLE; 00560 00561 return 0; 00562 }
int easydbus_array_add_i16_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
short * | i16_array | |||
) |
Add int16 array on array container.
container | array container where insert int16 array | |
nel | number of element of the array. | |
i16_array | pointer to int16 array. |
-1 there are already some data connect to container.
0 ok
Definition at line 309 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_INT16, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00311 { 00312 size_t size_array = 0; 00313 00314 if (nel == 0 || !i16_array || !container || 00315 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00316 return -1; 00317 00318 if (container->nel) 00319 return -1; 00320 00321 size_array = sizeof (short[nel]); 00322 00323 container->p_data = malloc (size_array); 00324 if (!container->p_data) 00325 return -1; 00326 00327 EASYDBUS_MEMCOPY (container->p_data, i16_array, size_array); 00328 00329 container->nel = nel; 00330 container->elem_type = EASYDBUS_ELTYPE_INT16; 00331 00332 return 0; 00333 }
int easydbus_array_add_i32_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
int * | i32_array | |||
) |
Add int32 array to array container.
container | array container where insert int32 array | |
nel | number of element of the array. | |
i32_array | pointer to int32 array. |
-1 there are already some data connect to container.
0 ok
Definition at line 386 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_INT32, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00388 { 00389 size_t size_array = 0; 00390 00391 if (nel == 0 || !i32_array || !container || 00392 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00393 return -1; 00394 00395 if (container->nel) 00396 return -1; 00397 00398 size_array = sizeof (int[nel]); 00399 00400 container->p_data = malloc (size_array); 00401 if (!container->p_data) 00402 return -1; 00403 00404 EASYDBUS_MEMCOPY (container->p_data, i32_array, size_array); 00405 00406 container->nel = nel; 00407 container->elem_type = EASYDBUS_ELTYPE_INT32; 00408 00409 return 0; 00410 }
int easydbus_array_add_i64_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
long long * | i64_array | |||
) |
Add int64 array to array container.
container | array container where insert int64 array | |
nel | number of element of the array. | |
i64_array | pointer to unsgned int64 array. |
-1 there are already some data connect to container.
0 ok
Definition at line 463 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_INT64, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00465 { 00466 size_t size_array = 0; 00467 00468 if (nel == 0 || !i64_array || !container || 00469 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00470 return -1; 00471 00472 if (container->nel) 00473 return -1; 00474 00475 size_array = sizeof (long long[nel]); 00476 00477 container->p_data = malloc (size_array); 00478 if (!container->p_data) 00479 return -1; 00480 00481 EASYDBUS_MEMCOPY (container->p_data, i64_array, size_array); 00482 container->nel = nel; 00483 container->elem_type = EASYDBUS_ELTYPE_INT64; 00484 00485 return 0; 00486 }
int easydbus_array_add_obj_path_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
char ** | obj_path_array | |||
) |
Add object path string array to array container.
container | array container where insert array | |
nel | number of element of the array. | |
obj_path_array | pointer to object path string array. |
-1 there are already some data connect to container.
0 ok
Definition at line 642 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_OBJECT_PATH, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00645 { 00646 char **iterator, **iterator2 = NULL; 00647 int i = 0; 00648 00649 if (nel == 0 || !obj_path_array || !container || 00650 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00651 return -1; 00652 00653 if (container->nel) 00654 return -1; 00655 00656 container->p_data = malloc (sizeof (char *[nel])); 00657 if (!container->p_data) 00658 return -1; 00659 00660 memset (container->p_data, 0, nel); 00661 00662 iterator = obj_path_array; 00663 iterator2 = (char **) container->p_data; 00664 00665 for (i = 0; i < (int) nel; i++) { 00666 if (!iterator[i]) 00667 goto error; 00668 iterator2[i] = (char *) malloc (strlen (iterator[i]) + 1); 00669 if (!iterator2[i]) 00670 goto error; 00671 EASYDBUS_MEMCOPY (iterator2[i], iterator[i], 00672 strlen (iterator[i]) + 1); 00673 //memset (*iterator2, 0, strlen (*iterator)+1); 00674 //memcpy (iterator2[i], iterator[i], strlen (iterator[i]) + 1); 00675 } 00676 00677 container->nel = nel; 00678 container->elem_type = EASYDBUS_ELTYPE_OBJECT_PATH; 00679 00680 return 0; 00681 00682 error: 00683 i--; 00684 for (; i > 0; i--) { 00685 00686 if (iterator2[i]) 00687 free (iterator2[i]); 00688 } 00689 free (container->p_data); 00690 return -1; 00691 }
int easydbus_array_add_signature_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
char ** | signature_array | |||
) |
Add signature string array to array container.
container | array container where insert array | |
nel | number of element of the array. | |
signature_array | pointer to signature string array. |
-1 there are already some data connect to container.
0 ok
Definition at line 706 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_SIGNATURE, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00709 { 00710 char **iterator, **iterator2 = NULL; 00711 int i = 0; 00712 00713 if (nel == 0 || !signature_array || !container || 00714 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00715 return -1; 00716 00717 if (container->nel) 00718 return -1; 00719 00720 container->p_data = malloc (sizeof (char *[nel])); 00721 if (!container->p_data) 00722 return -1; 00723 00724 memset (container->p_data, 0, nel); 00725 00726 iterator = signature_array; 00727 iterator2 = (char **) container->p_data; 00728 00729 for (i = 0; i < (int) nel; i++) { 00730 if (!iterator[i]) 00731 goto error; 00732 iterator2[i] = (char *) malloc (strlen (iterator[i]) + 1); 00733 if (!iterator2[i]) 00734 goto error; 00735 EASYDBUS_MEMCOPY (iterator2[i], iterator[i], 00736 strlen (iterator[i]) + 1); 00737 //memset (*iterator2, 0, strlen (*iterator)+1); 00738 //memcpy (iterator2[i], iterator[i], strlen (iterator[i]) + 1); 00739 } 00740 00741 container->nel = nel; 00742 container->elem_type = EASYDBUS_ELTYPE_SIGNATURE; 00743 00744 return 0; 00745 00746 error: 00747 i--; 00748 for (; i > 0; i--) { 00749 00750 if (iterator2[i]) 00751 free (iterator2[i]); 00752 } 00753 free (container->p_data); 00754 return -1; 00755 }
int easydbus_array_add_string_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
char ** | string_array | |||
) |
Add string array to array container.
container | array container where insert array | |
nel | number of element of the array. | |
string_array | pointer to string array. |
-1 there are already some data connect to container.
0 ok
Definition at line 577 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_STRING, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00580 { 00581 char **iterator, **iterator2 = NULL; 00582 int i = 0; 00583 00584 if (nel == 0 || !string_array || !container || 00585 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00586 return -1; 00587 00588 if (container->nel) 00589 return -1; 00590 00591 container->p_data = malloc (sizeof (char *[nel])); 00592 if (!container->p_data) 00593 return -1; 00594 00595 memset (container->p_data, 0, nel); 00596 00597 iterator = string_array; 00598 iterator2 = (char **) container->p_data; 00599 00600 for (i = 0; i < (int) nel; i++) { 00601 if (!iterator[i]) 00602 goto error; 00603 iterator2[i] = (char *) malloc (strlen (iterator[i]) + 1); 00604 if (!iterator2[i]) 00605 goto error; 00606 00607 EASYDBUS_MEMCOPY (iterator2[i], iterator[i], 00608 strlen (iterator[i]) + 1); 00609 //memset (*iterator2, 0, strlen (*iterator)+1); 00610 //memcpy (iterator2[i], iterator[i], strlen (iterator[i]) + 1); 00611 } 00612 00613 container->nel = nel; 00614 container->elem_type = EASYDBUS_ELTYPE_STRING; 00615 00616 return 0; 00617 00618 error: 00619 i--; 00620 for (; i > 0; i--) { 00621 00622 if (iterator2[i]) 00623 free (iterator2[i]); 00624 } 00625 free (container->p_data); 00626 return -1; 00627 }
int easydbus_array_add_struct | ( | EasyDbus_container * | struct_internal, | |
EasyDbus_container * | array | |||
) |
Add struct element to array.
struct_internal | struct container to insert | |
array | array where insert struct container. |
0 ok
Definition at line 190 of file array.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_STRUCT, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_elem::p_container, EasyDbus_container::p_data, and EasyDbus_elem::payload.
Referenced by easydbus_get_marshal_data_from_array().
00192 { 00193 00194 struct EasyDbus_elem *el = NULL; 00195 struct EasyDbus_elem *elms = NULL; 00196 00197 if (!array || !struct_internal || 00198 struct_internal->container_type != EASYDBUS_ELTYPE_STRUCT || 00199 array->container_type != EASYDBUS_ELTYPE_ARRAY) 00200 return -1; 00201 00202 /* create dict_entry element */ 00203 el = easydbus_elem_create (EASYDBUS_ELTYPE_STRUCT); 00204 if (!el) 00205 return -1; 00206 00207 el->payload.p_container = struct_internal; 00208 00209 if (array->nel) { 00210 /* array already contains dict_entry */ 00211 elms = (struct EasyDbus_elem *) array->p_data; 00212 while (elms->next) 00213 elms = elms->next; 00214 elms->next = el; 00215 } 00216 else { 00217 /* array is empty */ 00218 array->elem_type = EASYDBUS_ELTYPE_STRUCT; 00219 array->p_data = el; 00220 } 00221 00222 array->nel++; 00223 return 0; 00224 }
int easydbus_array_add_ui16_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
unsigned short * | ui16_array | |||
) |
Add unsigned int16 array to array container.
container | array container where insert uint16 array | |
nel | number of element of the array. | |
ui16_array | pointer to unsingned int16 array. |
-1 there are already some data connect to container.
0 ok
Definition at line 347 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_UINT16, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00350 { 00351 size_t size_array = 0; 00352 00353 if (nel == 0 || !ui16_array || !container || 00354 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00355 return -1; 00356 00357 if (container->nel) 00358 return -1; 00359 00360 size_array = sizeof (short[nel]); 00361 00362 container->p_data = malloc (size_array); 00363 if (!container->p_data) 00364 return -1; 00365 00366 EASYDBUS_MEMCOPY (container->p_data, ui16_array, size_array); 00367 00368 container->nel = nel; 00369 container->elem_type = EASYDBUS_ELTYPE_UINT16; 00370 00371 return 0; 00372 }
int easydbus_array_add_ui32_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
unsigned int * | ui32_array | |||
) |
Add unsigned int32 array to array container.
container | array container where insert uint32 array | |
nel | number of element of the array. | |
ui32_array | pointer to unsgned int32 array. |
-1 there are already some data connect to container.
0 ok
Definition at line 424 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_UINT32, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00427 { 00428 size_t size_array = 0; 00429 00430 if (nel == 0 || !ui32_array || !container || 00431 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00432 return -1; 00433 00434 if (container->nel) 00435 return -1; 00436 00437 size_array = sizeof (int[nel]); 00438 00439 container->p_data = malloc (size_array); 00440 if (!container->p_data) 00441 return -1; 00442 00443 EASYDBUS_MEMCOPY (container->p_data, ui32_array, size_array); 00444 00445 container->nel = nel; 00446 container->elem_type = EASYDBUS_ELTYPE_UINT32; 00447 00448 return 0; 00449 }
int easydbus_array_add_ui64_array | ( | EasyDbus_container * | container, | |
unsigned int | nel, | |||
unsigned long long * | ui64_array | |||
) |
Add unsigned int64 array to array container.
container | array container where insert uint64 array | |
nel | number of element of the array. | |
ui64_array | pointer to unsigned uint64 array. |
-1 there are already some data connect to container.
0 ok
Definition at line 500 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_UINT64, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, and EasyDbus_container::p_data.
Referenced by easydbus_get_marshal_data_from_array().
00503 { 00504 size_t size_array = 0; 00505 00506 if (nel == 0 || !ui64_array || !container || 00507 container->container_type != EASYDBUS_ELTYPE_ARRAY) 00508 return -1; 00509 00510 if (container->nel) 00511 return -1; 00512 00513 size_array = sizeof (long long[nel]); 00514 00515 container->p_data = malloc (size_array); 00516 if (!container->p_data) 00517 return -1; 00518 00519 EASYDBUS_MEMCOPY (container->p_data, ui64_array, size_array); 00520 container->nel = nel; 00521 container->elem_type = EASYDBUS_ELTYPE_UINT64; 00522 00523 return 0; 00524 }
int easydbus_array_add_variant | ( | EasyDbus_container * | variant, | |
EasyDbus_container * | array | |||
) |
Add variant on array.
variant | variant element to insert | |
array | array where insert variant element. |
0 ok
Definition at line 146 of file array.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_VARIANT, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_elem::p_container, EasyDbus_container::p_data, and EasyDbus_elem::payload.
Referenced by easydbus_get_marshal_data_from_array().
00148 { 00149 00150 struct EasyDbus_elem *el = NULL; 00151 struct EasyDbus_elem *elms = NULL; 00152 00153 if (!array || !variant || 00154 variant->container_type != EASYDBUS_ELTYPE_VARIANT || 00155 array->container_type != EASYDBUS_ELTYPE_ARRAY) 00156 return -1; 00157 00158 /* create dict_entry element */ 00159 el = easydbus_elem_create (EASYDBUS_ELTYPE_VARIANT); 00160 if (!el) 00161 return -1; 00162 00163 el->payload.p_container = variant; 00164 00165 if (array->nel) { 00166 /* array already contains dict_entry */ 00167 elms = (struct EasyDbus_elem *) array->p_data; 00168 while (elms->next) 00169 elms = elms->next; 00170 elms->next = el; 00171 } 00172 else { 00173 /* array is empty */ 00174 array->elem_type = EASYDBUS_ELTYPE_VARIANT; 00175 array->p_data = el; 00176 } 00177 00178 array->nel++; 00179 return 0; 00180 }
const EasyDbus_container* easydbus_array_get_array | ( | EasyDbus_container * | array, | |
unsigned int | n | |||
) |
Get array container from array container.
array | array container | |
n | n-array to recover |
pointer to EasyDbus_container with array.
Definition at line 768 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_elem::p_container, EasyDbus_container::p_data, and EasyDbus_elem::payload.
00769 { 00770 EasyDbus_elem *el = NULL; 00771 unsigned int i; 00772 00773 if (!array || n == 0 || n > array->nel || 00774 array->container_type != EASYDBUS_ELTYPE_ARRAY || 00775 array->elem_type != EASYDBUS_ELTYPE_ARRAY) 00776 return NULL; 00777 00778 // move to correct element 00779 for (i = 1, el = (struct EasyDbus_elem *) array->p_data; 00780 i < n; i++, el = el->next); 00781 00782 return (el ? (const EasyDbus_container *) el->payload.p_container : 00783 NULL); 00784 }
const char* easydbus_array_get_boolean_array | ( | EasyDbus_container * | array | ) |
Get boolean array from container.
array | array container |
pointer to array of boolean
Definition at line 905 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_BOOLEAN, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
00906 { 00907 if (!array || 00908 array->container_type != EASYDBUS_ELTYPE_ARRAY || 00909 array->elem_type != EASYDBUS_ELTYPE_BOOLEAN) 00910 return NULL; 00911 00912 return (const char *) array->p_data; 00913 }
const char* easydbus_array_get_byte_array | ( | EasyDbus_container * | array | ) |
Get byte array from container.
array | array container |
pointer to array of byte
Definition at line 886 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_BYTE, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
00887 { 00888 if (!array || 00889 array->container_type != EASYDBUS_ELTYPE_ARRAY || 00890 array->elem_type != EASYDBUS_ELTYPE_BYTE) 00891 return NULL; 00892 00893 return (const char *) array->p_data; 00894 }
const EasyDbus_container* easydbus_array_get_dict_entry | ( | EasyDbus_container * | array, | |
unsigned int | n | |||
) |
Get dict_entry container from array container.
array | array container | |
n | n-dict entry container to recover |
pointer to EasyDbus_container with dict entry.
Definition at line 797 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_DICT_ENTRY, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_elem::p_container, EasyDbus_container::p_data, and EasyDbus_elem::payload.
00799 { 00800 EasyDbus_elem *el = NULL; 00801 unsigned int i; 00802 00803 if (!array || n == 0 || n > array->nel || 00804 array->container_type != EASYDBUS_ELTYPE_ARRAY || 00805 array->elem_type != EASYDBUS_ELTYPE_DICT_ENTRY) 00806 return NULL; 00807 00808 // move to correct element 00809 for (i = 1, el = (struct EasyDbus_elem *) array->p_data; 00810 i < n; i++, el = el->next); 00811 00812 return (el ? (const EasyDbus_container *) el->payload.p_container : 00813 NULL); 00814 }
const double* easydbus_array_get_double_array | ( | EasyDbus_container * | array | ) |
Get double array from container.
array | array container |
pointer to array of data
Definition at line 1039 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_DOUBLE, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
01040 { 01041 if (!array || 01042 array->container_type != EASYDBUS_ELTYPE_ARRAY || 01043 array->elem_type != EASYDBUS_ELTYPE_DOUBLE) 01044 return NULL; 01045 01046 return (const double *) array->p_data; 01047 }
const short* easydbus_array_get_i16_array | ( | EasyDbus_container * | array | ) |
Get int16 array from container.
array | array container |
pointer to array of data
Definition at line 924 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_INT16, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
00925 { 00926 if (!array || 00927 array->container_type != EASYDBUS_ELTYPE_ARRAY || 00928 array->elem_type != EASYDBUS_ELTYPE_INT16) 00929 return NULL; 00930 00931 return (const short *) array->p_data; 00932 }
const int* easydbus_array_get_i32_array | ( | EasyDbus_container * | array | ) |
Get int32 array from container.
array | array container |
pointer to array of data
Definition at line 963 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_INT32, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
00964 { 00965 if (!array || 00966 array->container_type != EASYDBUS_ELTYPE_ARRAY || 00967 array->elem_type != EASYDBUS_ELTYPE_INT32) 00968 return NULL; 00969 00970 return (const int *) array->p_data; 00971 }
const long long* easydbus_array_get_i64_array | ( | EasyDbus_container * | array | ) |
Get int64 array from container.
array | array container |
pointer to array of data
Definition at line 1001 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_INT64, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
01002 { 01003 if (!array || 01004 array->container_type != EASYDBUS_ELTYPE_ARRAY || 01005 array->elem_type != EASYDBUS_ELTYPE_INT64) 01006 return NULL; 01007 01008 return (const long long *) array->p_data; 01009 }
const char** easydbus_array_get_obj_path_array | ( | EasyDbus_container * | array | ) |
Get object path string array from container.
array | array container |
pointer to array of data
Definition at line 1077 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_OBJECT_PATH, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
01078 { 01079 if (!array || 01080 array->container_type != EASYDBUS_ELTYPE_ARRAY || 01081 array->elem_type != EASYDBUS_ELTYPE_OBJECT_PATH) 01082 return NULL; 01083 01084 return (const char **) array->p_data; 01085 }
const char** easydbus_array_get_signature_array | ( | EasyDbus_container * | array | ) |
Get signature string array from container.
array | array container |
pointer to array of data
Definition at line 1096 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_SIGNATURE, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
01097 { 01098 if (!array || 01099 array->container_type != EASYDBUS_ELTYPE_ARRAY || 01100 array->elem_type != EASYDBUS_ELTYPE_SIGNATURE) 01101 return NULL; 01102 01103 return (const char **) array->p_data; 01104 }
const char** easydbus_array_get_string_array | ( | EasyDbus_container * | array | ) |
Get string array from container.
array | array container |
pointer to array of data
Definition at line 1058 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_STRING, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
01059 { 01060 if (!array || 01061 array->container_type != EASYDBUS_ELTYPE_ARRAY || 01062 array->elem_type != EASYDBUS_ELTYPE_STRING) 01063 return NULL; 01064 01065 return (const char **) array->p_data; 01066 }
const EasyDbus_container* easydbus_array_get_struct | ( | EasyDbus_container * | array, | |
unsigned int | n | |||
) |
Get struct container from array container.
array | array container | |
n | n-struct container to recover |
pointer to struct EasyDbus_container object.
Definition at line 858 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_STRUCT, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_elem::p_container, EasyDbus_container::p_data, and EasyDbus_elem::payload.
00859 { 00860 EasyDbus_elem *el = NULL; 00861 unsigned int i; 00862 00863 if (!array || n == 0 || n > array->nel || 00864 array->container_type != EASYDBUS_ELTYPE_ARRAY || 00865 array->elem_type != EASYDBUS_ELTYPE_STRUCT) 00866 return NULL; 00867 00868 // move to correct element 00869 for (i = 1, el = (struct EasyDbus_elem *) array->p_data; 00870 i < n; i++, el = el->next); 00871 00872 return (el ? 00873 (const EasyDbus_container *) el->payload.p_container : 00874 NULL); 00875 }
const unsigned short* easydbus_array_get_ui16_array | ( | EasyDbus_container * | array | ) |
Get unsigned int16 array from container.
array | array container |
pointer to array of data
Definition at line 943 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_UINT16, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
00944 { 00945 if (!array || 00946 array->container_type != EASYDBUS_ELTYPE_ARRAY || 00947 array->elem_type != EASYDBUS_ELTYPE_UINT16) 00948 return NULL; 00949 00950 return (const unsigned short *) array->p_data; 00951 }
const unsigned int* easydbus_array_get_ui32_array | ( | EasyDbus_container * | array | ) |
Get unsigned int32 array from container.
array | array container |
pointer to array of data
Definition at line 982 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_UINT32, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
00983 { 00984 if (!array || 00985 array->container_type != EASYDBUS_ELTYPE_ARRAY || 00986 array->elem_type != EASYDBUS_ELTYPE_UINT32) 00987 return NULL; 00988 00989 return (const unsigned int *) array->p_data; 00990 }
const unsigned long long* easydbus_array_get_ui64_array | ( | EasyDbus_container * | array | ) |
Get unsigned int64 array from container.
array | array container |
pointer to array of data
Definition at line 1020 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_UINT64, EasyDbus_container::elem_type, and EasyDbus_container::p_data.
01021 { 01022 if (!array || 01023 array->container_type != EASYDBUS_ELTYPE_ARRAY || 01024 array->elem_type != EASYDBUS_ELTYPE_UINT64) 01025 return NULL; 01026 01027 return (const unsigned long long *) array->p_data; 01028 }
const EasyDbus_container* easydbus_array_get_variant | ( | EasyDbus_container * | array, | |
unsigned int | n | |||
) |
Get variant container from array container.
array | array container | |
n | n-variant container to recover |
pointer to variant EasyDbus_container object.
Definition at line 828 of file array.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_VARIANT, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_elem::p_container, EasyDbus_container::p_data, and EasyDbus_elem::payload.
00830 { 00831 EasyDbus_elem *el = NULL; 00832 unsigned int i; 00833 00834 if (!array || n == 0 || n > array->nel || 00835 array->container_type != EASYDBUS_ELTYPE_ARRAY || 00836 array->elem_type != EASYDBUS_ELTYPE_VARIANT) 00837 return NULL; 00838 00839 // move to correct element 00840 for (i = 1, el = (struct EasyDbus_elem *) array->p_data; 00841 i < n; i++, el = el->next); 00842 00843 return (el ? (const EasyDbus_container *) el->payload.p_container : 00844 NULL); 00845 }