-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
For building a{sv} dbus message, i usally use GVariantBuilder because it have cleaning syntax and effective in preventing leak memory. Example:
GVariantBuilder builder;
g_variant_builder_add(&builder, "{sv}", "name", g_variant_new_string("gia luong"));
g_variant_builder_add(&builder, "{sv}", "birth", g_variant_new_uint32(2000));
GVariant *variant = g_variant_builder_end(&builder);For get value from an a{sv}, just use g_variant_lookup_value because the simple of syntax
std::string name;
if ((value = g_variant_lookup_value(variant, "name", G_VARIANT_TYPE_STRING)) != nullptr)
{
name = g_variant_get_uint32(value);
g_variant_unref(value);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request