From 1b420b15b3c88ebbcd6789f78b69bd284e0a98f7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 7 Mar 2015 08:42:56 +0000 Subject: Add support for state deletion. Add lilv_node_get_path(). Add lilv_state_get_uri(). Add lilv_state_delete(). Fix creation of duplicate manifest entries when saving state. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5617 a436a847-0d15-0410-975c-d299462d15a1 --- lilv/lilv.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'lilv') diff --git a/lilv/lilv.h b/lilv/lilv.h index 2248df2..e907789 100644 --- a/lilv/lilv.h +++ b/lilv/lilv.h @@ -258,6 +258,14 @@ lilv_node_is_string(const LilvNode* value); LILV_API const char* lilv_node_as_string(const LilvNode* value); +/** + Return the path of a file URI node. + Returns NULL if `value` is not a file URI. + Returned value must be freed by caller. +*/ +LILV_API char* +lilv_node_get_path(const LilvNode* value, char** hostname); + /** Return whether this value is a decimal literal. */ @@ -1341,6 +1349,14 @@ lilv_state_get_num_properties(const LilvState* state); LILV_API const LilvNode* lilv_state_get_plugin_uri(const LilvState* state); +/** + Get the URI of `state`. + + This may return NULL if the state has not been saved and has no URI. +*/ +LILV_API const LilvNode* +lilv_state_get_uri(const LilvState* state); + /** Get the label of `state`. */ @@ -1461,6 +1477,24 @@ lilv_state_to_string(LilvWorld* world, const char* uri, const char* base_uri); +/** + Unload a state from the world and delete all associated files. + @param world The world. + @param state State to remove from the system. + + This function DELETES FILES/DIRECTORIES FROM THE FILESYSTEM! It is intended + for removing user-saved presets, but can delete any state the user has + permission to delete, including presets shipped with plugins. + + The rdfs:seeAlso file for the state will be removed. The entry in the + bundle's manifest.ttl is removed, and if this results in an empty manifest, + then the manifest file is removed. If this results in an empty bundle, then + the bundle directory is removed as well. +*/ +LILV_API int +lilv_state_delete(LilvWorld* world, + const LilvState* state); + /** @} @name Scale Point -- cgit v1.2.1