diff options
author | David Robillard <d@drobilla.net> | 2008-01-25 06:55:57 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-01-25 06:55:57 +0000 |
commit | 6f4460aee9962a49ae872eef42ba75a439ea6e59 (patch) | |
tree | dd08af14a835d0d6f77aa6a3c4c9047ceb4b307f /src/pluginclass.c | |
parent | 361f21b9e1f59bd602d0e1ed8b80f726605995be (diff) | |
download | lilv-6f4460aee9962a49ae872eef42ba75a439ea6e59.tar.gz lilv-6f4460aee9962a49ae872eef42ba75a439ea6e59.tar.bz2 lilv-6f4460aee9962a49ae872eef42ba75a439ea6e59.zip |
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
Diffstat (limited to 'src/pluginclass.c')
-rw-r--r-- | src/pluginclass.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/pluginclass.c b/src/pluginclass.c index 383e458..e2f36d4 100644 --- a/src/pluginclass.c +++ b/src/pluginclass.c @@ -22,55 +22,57 @@ #include <stdlib.h> #include <string.h> #include <slv2/pluginclass.h> +#include <slv2/value.h> #include "slv2_internal.h" +/* private */ SLV2PluginClass -slv2_plugin_class_new(SLV2World world, const char* parent_uri, const char* uri, const char* label) +slv2_plugin_class_new(SLV2World world, librdf_uri* parent_uri, librdf_uri* uri, const char* label) { SLV2PluginClass plugin_class = (SLV2PluginClass)malloc(sizeof(struct _SLV2PluginClass)); plugin_class->world = world; if (parent_uri) - plugin_class->parent_uri = librdf_new_uri(world->world, (const unsigned char*)parent_uri); + plugin_class->parent_uri = slv2_value_new_librdf_uri(world, parent_uri); else plugin_class->parent_uri = NULL; - plugin_class->uri = librdf_new_uri(world->world, (const unsigned char*)uri); - plugin_class->label = strdup(label); + plugin_class->uri = slv2_value_new_librdf_uri(world, uri); + plugin_class->label = slv2_value_new(world, SLV2_VALUE_STRING, label); return plugin_class; } +/* private */ void slv2_plugin_class_free(SLV2PluginClass plugin_class) { assert(plugin_class->uri); - librdf_free_uri(plugin_class->uri); - if (plugin_class->parent_uri) - librdf_free_uri(plugin_class->parent_uri); - free(plugin_class->label); + slv2_value_free(plugin_class->uri); + slv2_value_free(plugin_class->parent_uri); + slv2_value_free(plugin_class->label); free(plugin_class); } -const char* +SLV2Value slv2_plugin_class_get_parent_uri(SLV2PluginClass plugin_class) { if (plugin_class->parent_uri) - return (const char*)librdf_uri_as_string(plugin_class->parent_uri); + return plugin_class->parent_uri; else return NULL; } -const char* +SLV2Value slv2_plugin_class_get_uri(SLV2PluginClass plugin_class) { assert(plugin_class->uri); - return (const char*)librdf_uri_as_string(plugin_class->uri); + return plugin_class->uri; } -const char* +SLV2Value slv2_plugin_class_get_label(SLV2PluginClass plugin_class) { return plugin_class->label; @@ -85,8 +87,8 @@ slv2_plugin_class_get_children(SLV2PluginClass plugin_class) for (int i=0; i < raptor_sequence_size(plugin_class->world->plugin_classes); ++i) { SLV2PluginClass c = raptor_sequence_get_at(plugin_class->world->plugin_classes, i); - const char* parent = slv2_plugin_class_get_parent_uri(c); - if (parent && !strcmp(slv2_plugin_class_get_uri(plugin_class), parent)) + SLV2Value parent = slv2_plugin_class_get_parent_uri(c); + if (parent && slv2_value_equals(slv2_plugin_class_get_uri(plugin_class), parent)) raptor_sequence_push(result, c); } |