From 6f4460aee9962a49ae872eef42ba75a439ea6e59 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 25 Jan 2008 06:55:57 +0000 Subject: Overhaul SLV2 API to return/take SLV2Value (instead of strings or primitives) wherever possible. Make 'index' a fundemental property of ingen ports. git-svn-id: http://svn.drobilla.net/lad/slv2@1113 a436a847-0d15-0410-975c-d299462d15a1 --- src/pluginui.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'src/pluginui.c') diff --git a/src/pluginui.c b/src/pluginui.c index 5de3dcb..9835e41 100644 --- a/src/pluginui.c +++ b/src/pluginui.c @@ -38,16 +38,16 @@ slv2_ui_new(SLV2World world, struct _SLV2UI* ui = malloc(sizeof(struct _SLV2UI)); ui->world = world; - ui->uri = librdf_new_uri_from_uri(uri); - ui->binary_uri = librdf_new_uri_from_uri(binary_uri); + ui->uri = slv2_value_new_librdf_uri(world, uri); + ui->binary_uri = slv2_value_new_librdf_uri(world, binary_uri); assert(ui->binary_uri); // FIXME: kludge - char* bundle = strdup((const char*)librdf_uri_as_string(ui->binary_uri)); + char* bundle = strdup(slv2_value_as_string(ui->binary_uri)); char* last_slash = strrchr(bundle, '/') + 1; *last_slash = '\0'; - ui->bundle_uri = librdf_new_uri(world->world, (const unsigned char*)bundle); + ui->bundle_uri = slv2_value_new_uri(world, bundle); free(bundle); ui->classes = slv2_values_new(); @@ -61,13 +61,13 @@ slv2_ui_new(SLV2World world, void slv2_ui_free(SLV2UI ui) { - librdf_free_uri(ui->uri); + slv2_value_free(ui->uri); ui->uri = NULL; - librdf_free_uri(ui->bundle_uri); + slv2_value_free(ui->bundle_uri); ui->bundle_uri = NULL; - librdf_free_uri(ui->binary_uri); + slv2_value_free(ui->binary_uri); ui->binary_uri = NULL; slv2_values_free(ui->classes); @@ -76,12 +76,12 @@ slv2_ui_free(SLV2UI ui) } -const char* +SLV2Value slv2_ui_get_uri(SLV2UI ui) { assert(ui); assert(ui->uri); - return (const char*)librdf_uri_as_string(ui->uri); + return ui->uri; } @@ -93,29 +93,26 @@ slv2_ui_get_classes(SLV2UI ui) bool -slv2_ui_is_a(SLV2UI ui, const char* type_uri) +slv2_ui_is_a(SLV2UI ui, SLV2Value ui_class_uri) { - SLV2Value type = slv2_value_new(ui->world, SLV2_VALUE_URI, type_uri); - bool ret = slv2_values_contains(ui->classes, type); - slv2_value_free(type); - return ret; + return slv2_values_contains(ui->classes, ui_class_uri); } -const char* +SLV2Value slv2_ui_get_bundle_uri(SLV2UI ui) { assert(ui); assert(ui->bundle_uri); - return (const char*)librdf_uri_as_string(ui->bundle_uri); + return ui->bundle_uri; } -const char* +SLV2Value slv2_ui_get_binary_uri(SLV2UI ui) { assert(ui); assert(ui->binary_uri); - return (const char*)librdf_uri_as_string(ui->binary_uri); + return ui->binary_uri; } -- cgit v1.2.1