![]() |
Functions for manage easydbus struct containers
Functions | |
int | easydbus_struct_add_array (EasyDbus_container *container, EasyDbus_container *array) |
Add array container to struct container. | |
int | easydbus_struct_add_boolean (EasyDbus_container *container, char boolean) |
Add boolean to struct container. | |
int | easydbus_struct_add_byte (EasyDbus_container *container, char byte) |
Add byte to struct container. | |
int | easydbus_struct_add_dict_entry (EasyDbus_container *container, EasyDbus_container *dict_entry) |
Add dict entry container to struct container. | |
int | easydbus_struct_add_double (EasyDbus_container *container, double d) |
Add double to struct container. | |
int | easydbus_struct_add_i16 (EasyDbus_container *container, short i16) |
Add int16 to struct container. | |
int | easydbus_struct_add_i32 (EasyDbus_container *container, int i32) |
Add int32 to struct container. | |
int | easydbus_struct_add_i64 (EasyDbus_container *container, long long i64) |
Add int64 to struct container. | |
int | easydbus_struct_add_obj_path (EasyDbus_container *container, char *string) |
Insert a object path on a struct container. | |
int | easydbus_struct_add_signature (EasyDbus_container *container, char *string) |
Insert a signature string on a struct. | |
int | easydbus_struct_add_string (EasyDbus_container *container, char *string) |
Insert a string on a struct container. | |
int | easydbus_struct_add_struct (EasyDbus_container *container, EasyDbus_container *struct_internal) |
Add struct container to struct container. | |
int | easydbus_struct_add_ui16 (EasyDbus_container *container, unsigned short ui16) |
Add unsigned int16 to struct container. | |
int | easydbus_struct_add_ui32 (EasyDbus_container *container, unsigned int ui32) |
Add unsigned int32 to struct container. | |
int | easydbus_struct_add_ui64 (EasyDbus_container *container, unsigned long long ui64) |
Add unsigned int64 to struct container. | |
int | easydbus_struct_add_variant (EasyDbus_container *container, EasyDbus_container *variant) |
Add variant container to struct container. | |
const EasyDbus_elem * | easydbus_struct_get_element (EasyDbus_container *container, unsigned int n) |
Get n-element of struct. |
int easydbus_struct_add_array | ( | EasyDbus_container * | container, | |
EasyDbus_container * | array | |||
) |
Add array container to struct container.
container | struct container where insert field. | |
array | array container to add. |
0 ok
Definition at line 590 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_ARRAY, EASYDBUS_ELTYPE_INVALID, 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.
00592 { 00593 struct EasyDbus_elem *el = NULL; 00594 struct EasyDbus_elem *el2 = NULL; 00595 00596 if (!container || !array || 00597 container->container_type != EASYDBUS_ELTYPE_STRUCT || 00598 array->container_type != EASYDBUS_ELTYPE_ARRAY) 00599 return -1; 00600 00601 el = easydbus_elem_create (EASYDBUS_ELTYPE_ARRAY); 00602 if (!el) 00603 return -1; 00604 00605 el->payload.p_container = array; 00606 00607 if (container->nel) { 00608 el2 = (struct EasyDbus_elem *) container->p_data; 00609 while (el2->next) 00610 el2 = el2->next; 00611 el2->next = el; 00612 } 00613 else 00614 container->p_data = (void *) el; 00615 00616 container->nel++; 00617 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00618 return 0; 00619 }
int easydbus_struct_add_boolean | ( | EasyDbus_container * | container, | |
char | boolean | |||
) |
Add boolean to struct container.
container | struct container where insert field. | |
boolean | boolean to add. |
0 ok
Definition at line 398 of file struct.c.
References EasyDbus_elem::boolean, EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_BOOLEAN, EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRUCT, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, and EasyDbus_elem::payload.
Referenced by easydbus_struct_build_elem().
00400 { 00401 struct EasyDbus_elem *el = NULL; 00402 struct EasyDbus_elem *el2 = NULL; 00403 00404 if (!container || 00405 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00406 return -1; 00407 00408 el = easydbus_elem_create (EASYDBUS_ELTYPE_BOOLEAN); 00409 if (!el) 00410 return -1; 00411 00412 el->payload.boolean = boolean; 00413 00414 if (container->nel) { 00415 el2 = (struct EasyDbus_elem *) container->p_data; 00416 while (el2->next) 00417 el2 = el2->next; 00418 el2->next = el; 00419 } 00420 else 00421 container->p_data = (void *) el; 00422 00423 container->nel++; 00424 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00425 return 0; 00426 }
int easydbus_struct_add_byte | ( | EasyDbus_container * | container, | |
char | byte | |||
) |
Add byte to struct container.
container | struct container where insert field. | |
byte | byte to add. |
0 ok
Definition at line 360 of file struct.c.
References EasyDbus_elem::byte, EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_BYTE, EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRUCT, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, and EasyDbus_elem::payload.
Referenced by easydbus_struct_build_elem().
00362 { 00363 struct EasyDbus_elem *el = NULL; 00364 struct EasyDbus_elem *el2 = NULL; 00365 00366 if (!container || 00367 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00368 return -1; 00369 00370 el = easydbus_elem_create (EASYDBUS_ELTYPE_BYTE); 00371 if (!el) 00372 return -1; 00373 00374 el->payload.byte = byte; 00375 00376 if (container->nel) { 00377 el2 = (struct EasyDbus_elem *) container->p_data; 00378 while (el2->next) 00379 el2 = el2->next; 00380 el2->next = el; 00381 } 00382 else 00383 container->p_data = (void *) el; 00384 00385 container->nel++; 00386 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00387 return 0; 00388 }
int easydbus_struct_add_dict_entry | ( | EasyDbus_container * | container, | |
EasyDbus_container * | dict_entry | |||
) |
Add dict entry container to struct container.
container | struct container where insert field. | |
dict_entry | dict entry container to add. |
0 ok
Definition at line 550 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_DICT_ENTRY, EASYDBUS_ELTYPE_INVALID, 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.
00552 { 00553 struct EasyDbus_elem *el = NULL; 00554 struct EasyDbus_elem *el2 = NULL; 00555 00556 if (!container || !dict_entry || 00557 container->container_type != EASYDBUS_ELTYPE_STRUCT || 00558 dict_entry->container_type != EASYDBUS_ELTYPE_DICT_ENTRY) 00559 return -1; 00560 00561 el = easydbus_elem_create (EASYDBUS_ELTYPE_DICT_ENTRY); 00562 if (!el) 00563 return -1;; 00564 00565 el->payload.p_container = dict_entry; 00566 00567 if (container->nel) { 00568 el2 = (struct EasyDbus_elem *) container->p_data; 00569 while (el2->next) 00570 el2 = el2->next; 00571 el2->next = el; 00572 } 00573 else 00574 container->p_data = (void *) el; 00575 00576 container->nel++; 00577 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00578 return 0; 00579 }
int easydbus_struct_add_double | ( | EasyDbus_container * | container, | |
double | d | |||
) |
Add double to struct container.
container | struct container where insert field. | |
d | double to add. |
0 ok
Definition at line 512 of file struct.c.
References EasyDbus_container::container_type, EasyDbus_elem::Double, easydbus_elem_create(), EASYDBUS_ELTYPE_DOUBLE, EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRUCT, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, and EasyDbus_elem::payload.
Referenced by easydbus_struct_build_elem().
00514 { 00515 struct EasyDbus_elem *el = NULL; 00516 struct EasyDbus_elem *el2 = NULL; 00517 00518 if (!container || 00519 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00520 return -1; 00521 00522 el = easydbus_elem_create (EASYDBUS_ELTYPE_DOUBLE); 00523 if (!el) 00524 return -1;; 00525 00526 el->payload.Double = d; 00527 00528 if (container->nel) { 00529 el2 = (struct EasyDbus_elem *) container->p_data; 00530 while (el2->next) 00531 el2 = el2->next; 00532 el2->next = el; 00533 } 00534 else 00535 container->p_data = (void *) el; 00536 00537 container->nel++; 00538 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00539 return 0; 00540 }
int easydbus_struct_add_i16 | ( | EasyDbus_container * | container, | |
short | i16 | |||
) |
Add int16 to struct container.
container | struct container where insert field. | |
i16 | int16 to add. |
0 ok
Definition at line 284 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_INT16, EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRUCT, EasyDbus_container::elem_type, EasyDbus_elem::i16, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, and EasyDbus_elem::payload.
Referenced by easydbus_struct_build_elem().
00286 { 00287 struct EasyDbus_elem *el = NULL; 00288 struct EasyDbus_elem *el2 = NULL; 00289 00290 if (!container || 00291 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00292 return -1; 00293 00294 el = easydbus_elem_create (EASYDBUS_ELTYPE_INT16); 00295 if (!el) 00296 return -1;; 00297 00298 el->payload.i16 = i16; 00299 00300 if (container->nel) { 00301 el2 = (struct EasyDbus_elem *) container->p_data; 00302 while (el2->next) 00303 el2 = el2->next; 00304 el2->next = el; 00305 } 00306 else 00307 container->p_data = (void *) el; 00308 00309 container->nel++; 00310 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00311 return 0; 00312 }
int easydbus_struct_add_i32 | ( | EasyDbus_container * | container, | |
int | i32 | |||
) |
Add int32 to struct container.
container | struct container where insert int32. | |
i32 | int32 to add. |
0 ok
Definition at line 210 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_INT32, EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRUCT, EasyDbus_container::elem_type, EasyDbus_elem::i32, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, and EasyDbus_elem::payload.
Referenced by easydbus_struct_build_elem().
00212 { 00213 struct EasyDbus_elem *el = NULL; 00214 struct EasyDbus_elem *el2 = NULL; 00215 00216 if (!container || 00217 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00218 return -1; 00219 00220 el = easydbus_elem_create (EASYDBUS_ELTYPE_INT32); 00221 if (!el) 00222 return -1; 00223 00224 el->payload.i32 = i32; 00225 00226 if (container->nel) { 00227 el2 = (struct EasyDbus_elem *) container->p_data; 00228 while (el2->next) 00229 el2 = el2->next; 00230 el2->next = el; 00231 } 00232 else 00233 container->p_data = (void *) el; 00234 container->nel++; 00235 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00236 return 0; 00237 }
int easydbus_struct_add_i64 | ( | EasyDbus_container * | container, | |
long long | i64 | |||
) |
Add int64 to struct container.
container | struct container where insert field. | |
i64 | int64 to add. |
0 ok
Definition at line 474 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_INT64, EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRUCT, EasyDbus_container::elem_type, EasyDbus_elem::i64, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, and EasyDbus_elem::payload.
Referenced by easydbus_struct_build_elem().
00476 { 00477 struct EasyDbus_elem *el = NULL; 00478 struct EasyDbus_elem *el2 = NULL; 00479 00480 if (!container || 00481 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00482 return -1; 00483 00484 el = easydbus_elem_create (EASYDBUS_ELTYPE_INT64); 00485 if (!el) 00486 return -1;; 00487 00488 el->payload.i64 = i64; 00489 00490 if (container->nel) { 00491 el2 = (struct EasyDbus_elem *) container->p_data; 00492 while (el2->next) 00493 el2 = el2->next; 00494 el2->next = el; 00495 } 00496 else 00497 container->p_data = (void *) el; 00498 00499 container->nel++; 00500 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00501 return 0; 00502 }
int easydbus_struct_add_obj_path | ( | EasyDbus_container * | container, | |
char * | string | |||
) |
Insert a object path on a struct container.
add object path element to struct container.
container | struct container where insert object path string. | |
string | object path string to add. |
0 ok
Definition at line 159 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), easydbus_elem_free(), EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_OBJECT_PATH, EASYDBUS_ELTYPE_STRUCT, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, EasyDbus_elem::payload, and EasyDbus_elem::string.
Referenced by easydbus_struct_build_elem().
00161 { 00162 int string_length = 0; 00163 char *p_string = NULL; 00164 struct EasyDbus_elem *el = NULL; 00165 struct EasyDbus_elem *el2 = NULL; 00166 00167 if (!container || !string || 00168 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00169 return -1; 00170 00171 el = easydbus_elem_create (EASYDBUS_ELTYPE_OBJECT_PATH); 00172 if (!el) 00173 return -1; 00174 00175 string_length = strlen (string) + 1; 00176 p_string = malloc (string_length); 00177 if (!p_string) 00178 goto error; 00179 00180 EASYDBUS_MEMCOPY (p_string, string, string_length); 00181 00182 el->payload.string = p_string; 00183 00184 if (container->nel) { 00185 el2 = (struct EasyDbus_elem *) container->p_data; 00186 while (el2->next) 00187 el2 = el2->next; 00188 el2->next = el; 00189 } 00190 else 00191 container->p_data = el; 00192 00193 container->nel++; 00194 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00195 return 0; 00196 00197 error: 00198 easydbus_elem_free (el); 00199 return -1; 00200 }
int easydbus_struct_add_signature | ( | EasyDbus_container * | container, | |
char * | string | |||
) |
Insert a signature string on a struct.
add signature element to struct container.
container | struct container where insert signature. | |
string | signature string to add. |
0 ok
Definition at line 106 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), easydbus_elem_free(), EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_SIGNATURE, EASYDBUS_ELTYPE_STRUCT, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, EasyDbus_elem::payload, and EasyDbus_elem::string.
Referenced by easydbus_struct_build_elem().
00108 { 00109 int string_length = 0; 00110 char *p_string = NULL; 00111 struct EasyDbus_elem *el = NULL; 00112 struct EasyDbus_elem *el2 = NULL; 00113 00114 if (!container || !string || 00115 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00116 return -1; 00117 00118 el = easydbus_elem_create (EASYDBUS_ELTYPE_SIGNATURE); 00119 if (!el) 00120 return -1; 00121 00122 string_length = strlen (string) + 1; 00123 p_string = malloc (string_length); 00124 if (!p_string) 00125 goto error; 00126 00127 EASYDBUS_MEMCOPY (p_string, string, string_length); 00128 00129 el->payload.string = p_string; 00130 00131 if (container->nel) { 00132 el2 = (struct EasyDbus_elem *) container->p_data; 00133 while (el2->next) 00134 el2 = el2->next; 00135 el2->next = el; 00136 } 00137 else 00138 container->p_data = el; 00139 00140 container->nel++; 00141 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00142 return 0; 00143 00144 error: 00145 easydbus_elem_free (el); 00146 return -1; 00147 }
int easydbus_struct_add_string | ( | EasyDbus_container * | container, | |
char * | string | |||
) |
Insert a string on a struct container.
add string element to struct container.
container | struct container where insert string. | |
string | string to add. |
0 ok
Definition at line 54 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), easydbus_elem_free(), EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRING, EASYDBUS_ELTYPE_STRUCT, EASYDBUS_MEMCOPY, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, EasyDbus_elem::payload, and EasyDbus_elem::string.
Referenced by easydbus_struct_build_elem().
00056 { 00057 int string_length = 0; 00058 char *p_string = NULL; 00059 struct EasyDbus_elem *el = NULL; 00060 struct EasyDbus_elem *el2 = NULL; 00061 00062 if (!container || !string || 00063 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00064 return -1; 00065 00066 el = easydbus_elem_create (EASYDBUS_ELTYPE_STRING); 00067 if (!el) 00068 return -1; 00069 00070 string_length = strlen (string) + 1; 00071 p_string = malloc (string_length); 00072 if (!p_string) 00073 goto error; 00074 00075 EASYDBUS_MEMCOPY (p_string, string, string_length); 00076 00077 el->payload.string = p_string; 00078 00079 if (container->nel) { 00080 el2 = (struct EasyDbus_elem *) container->p_data; 00081 while (el2->next) 00082 el2 = el2->next; 00083 el2->next = el; 00084 } 00085 else 00086 container->p_data = el; 00087 00088 container->nel++; 00089 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00090 return 0; 00091 00092 error: 00093 easydbus_elem_free (el); 00094 return -1; 00095 }
int easydbus_struct_add_struct | ( | EasyDbus_container * | container, | |
EasyDbus_container * | struct_internal | |||
) |
Add struct container to struct container.
container | struct container where insert field. | |
struct_internal | struct container to add. |
0 ok
Definition at line 668 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_INVALID, 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_struct_build_elem().
00670 { 00671 struct EasyDbus_elem *el = NULL; 00672 struct EasyDbus_elem *el2 = NULL; 00673 00674 if (!container || !struct_internal || 00675 container->container_type != EASYDBUS_ELTYPE_STRUCT || 00676 struct_internal->container_type != EASYDBUS_ELTYPE_STRUCT) 00677 return -1; 00678 00679 el = easydbus_elem_create (EASYDBUS_ELTYPE_STRUCT); 00680 if (!el) 00681 return -1;; 00682 00683 el->payload.p_container = struct_internal; 00684 00685 if (container->nel) { 00686 el2 = (struct EasyDbus_elem *) container->p_data; 00687 while (el2->next) 00688 el2 = el2->next; 00689 el2->next = el; 00690 } 00691 else 00692 container->p_data = (void *) el; 00693 00694 container->nel++; 00695 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00696 return 0; 00697 }
int easydbus_struct_add_ui16 | ( | EasyDbus_container * | container, | |
unsigned short | ui16 | |||
) |
Add unsigned int16 to struct container.
container | struct container where insert field. | |
ui16 | unsigned int16 to add. |
0 ok
Definition at line 322 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRUCT, EASYDBUS_ELTYPE_UINT16, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, EasyDbus_elem::payload, and EasyDbus_elem::ui16.
Referenced by easydbus_struct_build_elem().
00324 { 00325 struct EasyDbus_elem *el = NULL; 00326 struct EasyDbus_elem *el2 = NULL; 00327 00328 if (!container || 00329 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00330 return -1; 00331 00332 el = easydbus_elem_create (EASYDBUS_ELTYPE_UINT16); 00333 if (!el) 00334 return -1; 00335 00336 el->payload.ui16 = ui16; 00337 00338 if (container->nel) { 00339 el2 = (struct EasyDbus_elem *) container->p_data; 00340 while (el2->next) 00341 el2 = el2->next; 00342 el2->next = el; 00343 } 00344 else 00345 container->p_data = (void *) el; 00346 00347 container->nel++; 00348 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00349 return 0; 00350 }
int easydbus_struct_add_ui32 | ( | EasyDbus_container * | container, | |
unsigned int | ui32 | |||
) |
Add unsigned int32 to struct container.
container | struct container where insert uint32. | |
ui32 | unsigned int32 to add. |
0 ok
Definition at line 247 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRUCT, EASYDBUS_ELTYPE_UINT32, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, EasyDbus_elem::payload, and EasyDbus_elem::ui32.
Referenced by easydbus_struct_build_elem().
00249 { 00250 struct EasyDbus_elem *el = NULL; 00251 struct EasyDbus_elem *el2 = NULL; 00252 00253 if (!container || 00254 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00255 return -1; 00256 00257 el = easydbus_elem_create (EASYDBUS_ELTYPE_UINT32); 00258 if (!el) 00259 return -1; 00260 00261 el->payload.ui32 = ui32; 00262 00263 if (container->nel) { 00264 el2 = (struct EasyDbus_elem *) container->p_data; 00265 while (el2->next) 00266 el2 = el2->next; 00267 el2->next = el; 00268 } 00269 else 00270 container->p_data = (void *) el; 00271 00272 container->nel++; 00273 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00274 return 0; 00275 }
int easydbus_struct_add_ui64 | ( | EasyDbus_container * | container, | |
unsigned long long | ui64 | |||
) |
Add unsigned int64 to struct container.
container | struct container where insert field. | |
ui64 | unsigned int64 to add. |
0 ok
Definition at line 436 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRUCT, EASYDBUS_ELTYPE_UINT64, EasyDbus_container::elem_type, EasyDbus_container::nel, EasyDbus_elem::next, EasyDbus_container::p_data, EasyDbus_elem::payload, and EasyDbus_elem::ui64.
Referenced by easydbus_struct_build_elem().
00438 { 00439 struct EasyDbus_elem *el = NULL; 00440 struct EasyDbus_elem *el2 = NULL; 00441 00442 if (!container || 00443 container->container_type != EASYDBUS_ELTYPE_STRUCT) 00444 return -1; 00445 00446 el = easydbus_elem_create (EASYDBUS_ELTYPE_UINT64); 00447 if (!el) 00448 return -1; 00449 00450 el->payload.ui64 = ui64; 00451 00452 if (container->nel) { 00453 el2 = (struct EasyDbus_elem *) container->p_data; 00454 while (el2->next) 00455 el2 = el2->next; 00456 el2->next = el; 00457 } 00458 else 00459 container->p_data = (void *) el; 00460 00461 container->nel++; 00462 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00463 return 0; 00464 }
int easydbus_struct_add_variant | ( | EasyDbus_container * | container, | |
EasyDbus_container * | variant | |||
) |
Add variant container to struct container.
container | struct container where insert field. | |
variant | variant container to add. |
0 ok
Definition at line 629 of file struct.c.
References EasyDbus_container::container_type, easydbus_elem_create(), EASYDBUS_ELTYPE_INVALID, EASYDBUS_ELTYPE_STRUCT, 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_struct_build_elem().
00631 { 00632 struct EasyDbus_elem *el = NULL; 00633 struct EasyDbus_elem *el2 = NULL; 00634 00635 if (!container || !variant || 00636 container->container_type != EASYDBUS_ELTYPE_STRUCT || 00637 variant->container_type != EASYDBUS_ELTYPE_VARIANT) 00638 return -1; 00639 00640 el = easydbus_elem_create (EASYDBUS_ELTYPE_VARIANT); 00641 if (!el) 00642 return -1;; 00643 00644 el->payload.p_container = variant; 00645 00646 if (container->nel) { 00647 el2 = (struct EasyDbus_elem *) container->p_data; 00648 while (el2->next) 00649 el2 = el2->next; 00650 el2->next = el; 00651 } 00652 else 00653 container->p_data = (void *) el; 00654 00655 container->nel++; 00656 container->elem_type = EASYDBUS_ELTYPE_INVALID; 00657 return 0; 00658 }
const EasyDbus_elem* easydbus_struct_get_element | ( | EasyDbus_container * | container, | |
unsigned int | n | |||
) |
Get n-element of struct.
container | EasyDbus_container struct object. | |
n | what element recover. |
n-EasyDbus_elem object pointer
Definition at line 710 of file struct.c.
References EasyDbus_container::container_type, EASYDBUS_ELTYPE_STRUCT, EasyDbus_container::nel, EasyDbus_elem::next, and EasyDbus_container::p_data.
00712 { 00713 unsigned int i; 00714 EasyDbus_elem *el = NULL; 00715 00716 if (!container || 00717 container->container_type != EASYDBUS_ELTYPE_STRUCT || 00718 n > container->nel) 00719 return NULL; 00720 00721 for (i = 1, el = (EasyDbus_elem *) container->p_data; 00722 i < n; el = el->next, i++); 00723 00724 return (const EasyDbus_elem *) el; 00725 }