msg = edbus_proxy_method_call_new(test2_proxy, "ReceiveArrayOfStringIntWithSize");
iter = edbus_message_iter_get(msg);
- if (!edbus_message_iter_arguments_set(iter, "ia(si)", size_of_array, &array_of_string))
+ if (!edbus_message_iter_arguments_append(iter, "ia(si)", size_of_array, &array_of_string))
printf("error on edbus_massage_iterator_arguments_set()\n\n");
for (i = 0; i < size_of_array; i++)
{
EDBus_Message_Iter *struct_of_si;
- edbus_message_iter_arguments_set(array_of_string, "(si)", &struct_of_si);
- edbus_message_iter_arguments_set(struct_of_si, "si", array[i], i);
+ edbus_message_iter_arguments_append(array_of_string, "(si)", &struct_of_si);
+ edbus_message_iter_arguments_append(struct_of_si, "si", array[i], i);
edbus_message_iter_container_close(array_of_string, struct_of_si);
}
edbus_message_iter_container_close(iter, array_of_string);
* this will cause a error, we could not open another container until
* we close the first one
*/
- edbus_message_iter_arguments_set(iter, "a(ii)", &array_itr);
+ edbus_message_iter_arguments_append(iter, "a(ii)", &array_itr);
for (i = 0; i < 5; i++)
{
- edbus_message_iter_arguments_set(array_itr, "(ii)", &structure);
- edbus_message_iter_arguments_set(structure, "ii", i, i*i);
+ edbus_message_iter_arguments_append(array_itr, "(ii)", &structure);
+ edbus_message_iter_arguments_append(structure, "ii", i, i*i);
edbus_message_iter_container_close(array_itr, structure);
}
edbus_message_iter_container_close(iter, array_itr);
- edbus_message_iter_arguments_set(iter, "a(ii)", &array_itr);
+ edbus_message_iter_arguments_append(iter, "a(ii)", &array_itr);
for (i = 0; i < 7; i++)
{
- edbus_message_iter_arguments_set(array_itr, "(ii)", &structure);
- edbus_message_iter_arguments_set(structure, "ii", i, i*i*i);
+ edbus_message_iter_arguments_append(array_itr, "(ii)", &structure);
+ edbus_message_iter_arguments_append(structure, "ii", i, i*i*i);
edbus_message_iter_container_close(array_itr, structure);
}
edbus_message_iter_container_close(iter, array_itr);
main_iter = edbus_message_iter_get(reply);
var = edbus_message_iter_container_new(main_iter, 'v', "as");
- edbus_message_iter_arguments_set(var, "as", &array);
+ edbus_message_iter_arguments_append(var, "as", &array);
- edbus_message_iter_arguments_set(array, "s", "item1");
- edbus_message_iter_arguments_set(array, "s", "item2");
- edbus_message_iter_arguments_set(array, "s", "item3");
+ edbus_message_iter_arguments_append(array, "s", "item1");
+ edbus_message_iter_arguments_append(array, "s", "item2");
+ edbus_message_iter_arguments_append(array, "s", "item3");
edbus_message_iter_container_close(var, array);
edbus_message_iter_container_close(main_iter, var);
iter = edbus_message_iter_get(reply);
array = edbus_message_iter_container_new(iter, 'a', "i");
for (i = 0; i < 5; i++)
- edbus_message_iter_arguments_set(array, "i", i);
+ edbus_message_iter_arguments_append(array, "i", i);
edbus_message_iter_container_close(iter, array);
return reply;
iter = edbus_message_iter_get(reply);
array = edbus_message_iter_container_new(iter, 'a', "s");
for (i = 0; i < 5; i++)
- edbus_message_iter_arguments_set(array, "s", array_string[i]);
+ edbus_message_iter_arguments_append(array, "s", array_string[i]);
edbus_message_iter_container_close(iter, array);
return reply;
return reply;
}
num++;
- edbus_message_arguments_set(reply, "i", num);
+ edbus_message_arguments_append(reply, "i", num);
return reply;
}
edbus_message_iter_basic_append(iter, 's', "lalalala");
else if (!strcmp(propname, "int32"))
{
- edbus_message_iter_arguments_set(iter, "i", int32);
+ edbus_message_iter_arguments_append(iter, "i", int32);
int32++;
}
else if (!strcmp(propname, "st"))
{
EDBus_Message_Iter *st;
- edbus_message_iter_arguments_set(iter, "(ss)", &st);
- edbus_message_iter_arguments_set(st, "ss", "string1", "string2");
+ edbus_message_iter_arguments_append(iter, "(ss)", &st);
+ edbus_message_iter_arguments_append(st, "ss", "string1", "string2");
edbus_message_iter_container_close(iter, st);
}
return EINA_TRUE;
_hello(const EDBus_Service_Interface *iface, const EDBus_Message *message)
{
EDBus_Message *reply = edbus_message_method_return_new(message);
- edbus_message_arguments_set(reply, "s", "Hello World");
+ edbus_message_arguments_append(reply, "s", "Hello World");
printf("Hello\n");
return reply;
}
Eina_Bool bool;
if (!edbus_message_arguments_get(msg, "b", &bool))
printf("edbus_message_arguments_get() error\n");
- edbus_message_arguments_set(reply, "b", bool);
+ edbus_message_arguments_append(reply, "b", bool);
return reply;
}
unsigned char byte;
if (!edbus_message_arguments_get(msg, "y", &byte))
printf("edbus_message_arguments_get() error\n");
- edbus_message_arguments_set(reply, "y", byte);
+ edbus_message_arguments_append(reply, "y", byte);
return reply;
}
unsigned int uint32;
if (!edbus_message_arguments_get(msg, "u", &uint32))
printf("edbus_message_arguments_get() error\n");
- edbus_message_arguments_set(reply, "u", uint32);
+ edbus_message_arguments_append(reply, "u", uint32);
return reply;
}
int int32;
if (!edbus_message_arguments_get(msg, "i", &int32))
printf("edbus_message_arguments_get() error\n");
- edbus_message_arguments_set(reply, "i", int32);
+ edbus_message_arguments_append(reply, "i", int32);
return reply;
}
short int int16;
if (!edbus_message_arguments_get(msg, "n", &int16))
printf("edbus_message_arguments_get() error\n");
- edbus_message_arguments_set(reply, "n", int16);
+ edbus_message_arguments_append(reply, "n", int16);
return reply;
}
double d;
if (!edbus_message_arguments_get(msg, "d", &d))
printf("edbus_message_arguments_get() error\n");
- edbus_message_arguments_set(reply, "d", d);
+ edbus_message_arguments_append(reply, "d", d);
return reply;
}
const char *txt;
if (!edbus_message_arguments_get(msg, "s", &txt))
printf("edbus_message_arguments_get() error\n");
- edbus_message_arguments_set(reply, "s", txt);
+ edbus_message_arguments_append(reply, "s", txt);
return reply;
}
_resp_async(void *data)
{
EDBus_Message *msg = data;
- edbus_message_arguments_set(msg, "s", "Async test ok");
+ edbus_message_arguments_append(msg, "s", "Async test ok");
edbus_connection_send(conn, msg, NULL, NULL, -1);
edbus_message_unref(msg);
return ECORE_CALLBACK_CANCEL;
{
EDBus_Message_Iter *entry = edbus_message_iter_container_new(dict, 'e',
NULL);
- edbus_message_iter_arguments_set(entry, "ss", k->key, k->val);
+ edbus_message_iter_arguments_append(entry, "ss", k->key, k->val);
edbus_message_iter_container_close(dict, entry);
}
}
EAPI Eina_Bool
-edbus_message_iter_arguments_vset(EDBus_Message_Iter *iter, const char *signature, va_list ap)
+edbus_message_iter_arguments_vappend(EDBus_Message_Iter *iter, const char *signature, va_list ap)
{
DBusSignatureIter signature_iter;
Eina_Bool r = EINA_TRUE;
else if (type[1] == DBUS_TYPE_VARIANT)
{
ERR("variant not supported by \
- edbus_message_iter_arguments_set(), \
+ edbus_message_iter_arguments_append(), \
try edbus_message_iter_container_new()");
r = EINA_FALSE;
goto next;
}
EAPI Eina_Bool
-edbus_message_iter_arguments_set(EDBus_Message_Iter *iter, const char *signature, ...)
+edbus_message_iter_arguments_append(EDBus_Message_Iter *iter, const char *signature, ...)
{
Eina_Bool r;
va_list ap;
EINA_SAFETY_ON_NULL_RETURN_VAL(signature, EINA_FALSE);
va_start(ap, signature);
- r = edbus_message_iter_arguments_vset(iter, signature, ap);
+ r = edbus_message_iter_arguments_vappend(iter, signature, ap);
va_end(ap);
return r;
}
}
static Eina_Bool
-_edbus_message_arguments_vset(EDBus_Message *msg, const char *signature, va_list ap)
+_edbus_message_arguments_vappend(EDBus_Message *msg, const char *signature, va_list ap)
{
DBusSignatureIter signature_iter;
EDBus_Message_Iter *iter;
&iter->dbus_iterator);
else
{
- ERR("sig = %s | edbus_message_arguments_set() and \
- edbus_message_arguments_vset() only support basic types, \
+ ERR("sig = %s | edbus_message_arguments_append() and \
+ edbus_message_arguments_vappend() only support basic types, \
to complex types use edbus_message_iter_* functions",
signature);
r = EINA_FALSE;
}
EAPI Eina_Bool
-edbus_message_arguments_set(EDBus_Message *msg, const char *signature, ...)
+edbus_message_arguments_append(EDBus_Message *msg, const char *signature, ...)
{
Eina_Bool ret;
va_list ap;
EINA_SAFETY_ON_NULL_RETURN_VAL(signature, EINA_FALSE);
va_start(ap, signature);
- ret = _edbus_message_arguments_vset(msg, signature, ap);
+ ret = _edbus_message_arguments_vappend(msg, signature, ap);
va_end(ap);
return ret;
}
EAPI Eina_Bool
-edbus_message_arguments_vset(EDBus_Message *msg, const char *signature, va_list ap)
+edbus_message_arguments_vappend(EDBus_Message *msg, const char *signature, va_list ap)
{
EDBUS_MESSAGE_CHECK_RETVAL(msg, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(signature, EINA_FALSE);
- return _edbus_message_arguments_vset(msg, signature, ap);
+ return _edbus_message_arguments_vappend(msg, signature, ap);
}
EAPI EDBus_Message_Iter *
* This function only supports basic type, for complex types use
* edbus_message_iter_* functions.
*/
-EAPI Eina_Bool edbus_message_arguments_set(EDBus_Message *msg, const char *signature, ...) EINA_ARG_NONNULL(1, 2);
+EAPI Eina_Bool edbus_message_arguments_append(EDBus_Message *msg, const char *signature, ...) EINA_ARG_NONNULL(1, 2);
/**
* @brief Set data to EDBus_Message.
* This function only supports basic types, for complex types use
* edbus_message_iter_* functions.
*/
-EAPI Eina_Bool edbus_message_arguments_vset(EDBus_Message *msg, const char *signature, va_list ap) EINA_ARG_NONNULL(1, 2);
+EAPI Eina_Bool edbus_message_arguments_vappend(EDBus_Message *msg, const char *signature, va_list ap) EINA_ARG_NONNULL(1, 2);
/**
* @defgroup EDBus_Message_Iter Iterator
*/
/**
- * @brief Create and appends a typed iterator to another iterator.
+ * @brief Create and append a typed iterator to another iterator.
*
* After append data to returned iterator it must be closed calling
* edbus_message_iter_container_close().
EAPI EDBus_Message_Iter *edbus_message_iter_container_new(EDBus_Message_Iter *iter, int type, const char* contained_signature) EINA_ARG_NONNULL(1, 3) EINA_WARN_UNUSED_RESULT;
/**
- * @brief Append a basic type to EDBus_Iterator.
+ * @brief Append a basic type into an EDBus_Iterator.
*/
EAPI Eina_Bool edbus_message_iter_basic_append(EDBus_Message_Iter *iter, int type, ...) EINA_ARG_NONNULL(1, 3);
/**
- * @brief Set data to EDBus_Message_Iter. For each complete in signature
- * you need pass the value, in case of complex type a pointer to be allocated a
- * EDBus_Message_Iter that you need fill and close.
- *
- * It's not possible open two iterators at same Iterator. Example:
- * "aiai", to set this you need create and put the first array with
- * edbus_message_iter_container_new() fill array with data and close then
- * you could open the second array with edbus_message_iter_container_new().
- *
- * @param iter iterator
- * @param signature of data
- * @param ... values
- *
- * @note This function don't support variant, use instead
- * edbus_message_iter_container_new() to create the variant fill
- * data and close it..
+ * @brief Append an argument into an EDBus_Message_Iter. For each complete type
+ * you need to provide the correspondent value. In case of complex types you
+ * need to provide an EDBus_Message_Iter** to be allocated and then filled in.
+ *
+ * It's not possible to open two iterators at same iterator with this function.
+ * For example, to create a message with signature="aiai" you need to create the
+ * first container with edbus_message_iter_container_new(), fill the array,
+ * close it with edbus_message_iter_container_close() and then do the same for
+ * the second array.
+ *
+ * @param iter iterator in which data will be appended
+ * @param signature signature of the contained data
+ * @param ... values for each complete type
+ *
+ * @see edbus_message_iter_container_new()
+ * @see edbus_message_iter_container_close()
+ *
+ * @note This function doesn't support variant, use
+ * edbus_message_iter_container_new() instead to create the variant, fill
+ * with data and close it.
*/
-EAPI Eina_Bool edbus_message_iter_arguments_set(EDBus_Message_Iter *iter, const char *signature, ...) EINA_ARG_NONNULL(1, 2);
+EAPI Eina_Bool edbus_message_iter_arguments_append(EDBus_Message_Iter *iter, const char *signature, ...) EINA_ARG_NONNULL(1, 2);
/**
* @brief Set data to EDBus_Message_Iter. For each complete in signature
* edbus_message_iter_container_new() to create the variant fill
* data and close it.
*/
-EAPI Eina_Bool edbus_message_iter_arguments_vset(EDBus_Message_Iter *iter, const char *signature, va_list ap) EINA_ARG_NONNULL(1, 2, 3);
+EAPI Eina_Bool edbus_message_iter_arguments_vappend(EDBus_Message_Iter *iter, const char *signature, va_list ap) EINA_ARG_NONNULL(1, 2, 3);
/**
* @brief Closes a container-typed value appended to the message.
EDBus_Message_Iter *array;
EINA_SAFETY_ON_FALSE_RETURN_VAL(
- edbus_message_iter_arguments_set(iter, type, &array), EINA_FALSE);
+ edbus_message_iter_arguments_append(iter, type, &array), EINA_FALSE);
DBG("array of type %c", type[1]);
switch (type[1])
{
Eina_Value st;
EDBus_Message_Iter *entry;
eina_value_array_value_get(value_array, i, &st);
- edbus_message_iter_arguments_set(array, type+1, &entry);
+ edbus_message_iter_arguments_append(array, type+1, &entry);
_message_iter_from_eina_value_struct(entry_sig, entry, &st);
edbus_message_iter_container_close(array, entry);
eina_value_flush(&st);
Eina_Value inner_array;
EDBus_Message_Iter *sub_array;
eina_value_array_value_get(value_array, i, &inner_array);
- edbus_message_iter_arguments_set(array, type+1, &sub_array);
+ edbus_message_iter_arguments_append(array, type+1, &sub_array);
_array_append(type+1, &inner_array, sub_array);
edbus_message_iter_container_close(array, sub_array);
eina_value_flush(&inner_array);
_compatible_type(type[0], st.desc->members[i].type),
EINA_FALSE);
eina_value_struct_value_get(value, st.desc->members[i].name, &inner_st);
- edbus_message_iter_arguments_set(iter, type, &sub_iter);
+ edbus_message_iter_arguments_append(iter, type, &sub_iter);
r = _message_iter_from_eina_value_struct(sub_sig, sub_iter,
&inner_st);
edbus_message_iter_container_close(iter, sub_iter);
EDBus_Message *msg = edbus_proxy_method_call_new(proxy, member);
EINA_SAFETY_ON_NULL_RETURN_VAL(msg, NULL);
- if (!edbus_message_arguments_vset(msg, signature, ap))
+ if (!edbus_message_arguments_vappend(msg, signature, ap))
{
edbus_message_unref(msg);
ERR("Error setting arguments");
if (!getter || prop->is_invalidate)
continue;
- if (!edbus_message_iter_arguments_set(dict, "{sv}", &entry))
+ if (!edbus_message_iter_arguments_append(dict, "{sv}", &entry))
continue;
edbus_message_iter_basic_append(entry, 's', prop->property->name);
reply = edbus_message_method_return_new(msg);
EINA_SAFETY_ON_NULL_RETURN_VAL(reply, NULL);
main_iter = edbus_message_iter_get(reply);
- if (!edbus_message_iter_arguments_set(main_iter, "a{sv}", &dict))
+ if (!edbus_message_iter_arguments_append(main_iter, "a{sv}", &dict))
{
edbus_message_unref(reply);
return NULL;
obj->introspection_dirty = EINA_FALSE;
}
- edbus_message_arguments_set(reply, "s", eina_strbuf_string_get(obj->introspection_data));
+ edbus_message_arguments_append(reply, "s", eina_strbuf_string_get(obj->introspection_data));
return reply;
}
Eina_Iterator *iterator;
EDBus_Message *error_msg;
- edbus_message_iter_arguments_set(array, "{sa{sv}}", &iface_entry);
+ edbus_message_iter_arguments_append(array, "{sa{sv}}", &iface_entry);
- edbus_message_iter_arguments_set(iface_entry, "sa{sv}", iface->name, &props_array);
+ edbus_message_iter_arguments_append(iface_entry, "sa{sv}", iface->name, &props_array);
iterator = eina_hash_iterator_data_new(iface->properties);
if (!_props_getall(iface, iterator, props_array, NULL, &error_msg))
{
if (first) goto foreach;
if (obj->has_objectmanager) return EINA_TRUE;
- edbus_message_iter_arguments_set(array, "{oa{sa{sv}}}", &obj_entry);
- edbus_message_iter_arguments_set(obj_entry, "oa{sa{sv}}", obj->path,
+ edbus_message_iter_arguments_append(array, "{oa{sa{sv}}}", &obj_entry);
+ edbus_message_iter_arguments_append(obj_entry, "oa{sa{sv}}", obj->path,
&array_interface);
iface_iter = eina_hash_iterator_data_new(obj->interfaces);
EINA_ITERATOR_FOREACH(iface_iter, children_iface)
EINA_SAFETY_ON_NULL_RETURN_VAL(reply, NULL);
main_iter = edbus_message_iter_get(reply);
- edbus_message_iter_arguments_set(main_iter, "a{oa{sa{sv}}}", &array_path);
+ edbus_message_iter_arguments_append(main_iter, "a{oa{sa{sv}}}", &array_path);
ret = _managed_obj_append(iface->obj, array_path, EINA_TRUE);
if (!ret)
continue;
}
main_iter = edbus_message_iter_get(msg);
- edbus_message_iter_arguments_set(main_iter, "oa{sa{sv}}",
+ edbus_message_iter_arguments_append(main_iter, "oa{sa{sv}}",
iface->obj->path, &array_iface);
if (!_propmgr_iface_props_append(iface, array_iface))
goto error;
EINA_SAFETY_ON_NULL_GOTO(msg, error2);
main_iter = edbus_message_iter_get(msg);
- edbus_message_iter_arguments_set(main_iter, "oas", iface_data->obj_path,
+ edbus_message_iter_arguments_append(main_iter, "oas", iface_data->obj_path,
&array_iface);
edbus_message_iter_basic_append(array_iface, 's', iface_data->iface);
signature = eina_array_data_get(iface->sign_of_signals, signal_id);
va_start(ap, signal_id);
- r = edbus_message_arguments_vset(sig, signature, ap);
+ r = edbus_message_arguments_vappend(sig, signature, ap);
va_end(ap);
EINA_SAFETY_ON_FALSE_RETURN_VAL(r, EINA_FALSE);
EINA_SAFETY_ON_NULL_GOTO(msg, error);
main_iter = edbus_message_iter_get(msg);
- if (!edbus_message_iter_arguments_set(main_iter, "sa{sv}", iface->name, &dict))
+ if (!edbus_message_iter_arguments_append(main_iter, "sa{sv}", iface->name, &dict))
{
edbus_message_unref(msg);
goto error;
continue;
EINA_SAFETY_ON_FALSE_GOTO(
- edbus_message_iter_arguments_set(dict, "{sv}", &entry), error);
+ edbus_message_iter_arguments_append(dict, "{sv}", &entry), error);
edbus_message_iter_basic_append(entry, 's', prop->property->name);
var = edbus_message_iter_container_new(entry, 'v',
invalidate:
edbus_message_iter_container_close(main_iter, dict);
- edbus_message_iter_arguments_set(main_iter, "as", &array_invalidate);
+ edbus_message_iter_arguments_append(main_iter, "as", &array_invalidate);
if (!iface->prop_invalidated)
goto end;