summaryrefslogtreecommitdiffstats
path: root/glib/dbus-gidl.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2005-07-09 17:52:52 +0000
committerColin Walters <walters@verbum.org>2005-07-09 17:52:52 +0000
commitb1ae5399f82a88ba397d55f224d00f437564bac5 (patch)
tree5318877a5a8dffa85d2fa9e624e80fb9e9715dc4 /glib/dbus-gidl.c
parent0ccef79d7e9d1b19cdb10b3a147b64b41686905d (diff)
2005-07-09 Colin Walters <walters@verbum.org>
* glib/dbus-binding-tool-glib.h (DBUS_GLIB_ANNOTATION_CONST): Define. * glib/dbus-binding-tool-glib.c (generate_glue): Handle Const annotation. * glib/dbus-gobject.c (arg_iterate): Update to parse constval too. (method_dir_signature_from_object_info): Handle arg_iterate change. (write_interface): Ditto. (lookup_object_info): Don't barf if format_version is > 0. (invoke_object_method): Handle arg constness. * glib/dbus-gidl.c (struct ArgInfo): Add annotations. (arg_info_new): Create. (arg_info_unref): Destroy. (arg_info_get_annotations, arg_info_get_annotation) (arg_info_add_annotation): New functions. * glib/dbus-gidl.h: Prototype them. * glib/dbus-gparser.c (parse_annotation): Allow annotations in args, disallow them in properties. (parse_annotation): Handle arg annotations. * test/glib/test-service-glib.xml: * test/glib/test-service-glib.c: Update to make some methods const.
Diffstat (limited to 'glib/dbus-gidl.c')
-rw-r--r--glib/dbus-gidl.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/glib/dbus-gidl.c b/glib/dbus-gidl.c
index 3ca0a478..e04b9f46 100644
--- a/glib/dbus-gidl.c
+++ b/glib/dbus-gidl.c
@@ -75,6 +75,7 @@ struct ArgInfo
BaseInfo base;
char *type;
ArgDirection direction;
+ GHashTable *annotations;
};
static void
@@ -699,6 +700,9 @@ arg_info_new (const char *name,
info->base.name = g_strdup (name);
info->direction = direction;
info->type = g_strdup (type);
+ info->annotations = g_hash_table_new_full (g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_free);
return info;
}
@@ -717,10 +721,12 @@ arg_info_unref (ArgInfo *info)
info->base.refcount -= 1;
if (info->base.refcount == 0)
{
+ g_hash_table_destroy (info->annotations);
base_info_free (info);
g_free (info->type);
}
}
+
const char*
arg_info_get_name (ArgInfo *info)
{
@@ -739,6 +745,30 @@ arg_info_get_direction (ArgInfo *info)
return info->direction;
}
+GSList*
+arg_info_get_annotations (ArgInfo *info)
+{
+ return get_hash_keys (info->annotations);
+}
+
+const char*
+arg_info_get_annotation (ArgInfo *info,
+ const char *annotation)
+{
+ return g_hash_table_lookup (info->annotations, annotation);
+}
+
+void
+arg_info_add_annotation (ArgInfo *info,
+ const char *name,
+ const char *value)
+{
+ g_hash_table_insert (info->annotations,
+ g_strdup (name),
+ g_strdup (value));
+}
+
+
#ifdef DBUS_BUILD_TESTS
/**