summaryrefslogtreecommitdiffstats
path: root/src/pluginclass.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pluginclass.c')
-rw-r--r--src/pluginclass.c32
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);
}