From 2f71e8570bcd37ad681bde7d51c433701a0028ab Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 3 Jan 2012 23:21:27 +0000 Subject: Add lilv_state_get_num_properties(). Rearrange state code. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3912 a436a847-0d15-0410-975c-d299462d15a1 --- lilv/lilv.h | 137 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 73 insertions(+), 64 deletions(-) (limited to 'lilv') diff --git a/lilv/lilv.h b/lilv/lilv.h index c664855..8509b2e 100644 --- a/lilv/lilv.h +++ b/lilv/lilv.h @@ -1099,42 +1099,6 @@ lilv_port_get_scale_points(const LilvPlugin* plugin, @{ */ -/** - Free @c state. -*/ -LILV_API -void -lilv_state_free(LilvState* state); - -/** - Return true iff @c a is equivalent to @c b. -*/ -LILV_API -bool -lilv_state_equals(const LilvState* a, const LilvState* b); - -/** - Get the URI of the plugin @c state applies to. -*/ -LILV_API -const LilvNode* -lilv_state_get_plugin_uri(const LilvState* state); - -/** - Get the label of @c state. -*/ -LILV_API -const char* -lilv_state_get_label(const LilvState* state); - -/** - Set the label of @c state. -*/ -LILV_API -void -lilv_state_set_label(LilvState* state, - const char* label); - /** Load a state snapshot from @c world's RDF model. @param subject The subject of the state description (e.g. a preset URI). @@ -1166,32 +1130,6 @@ lilv_state_new_from_file(LilvWorld* world, const LilvNode* subject, const char* path); -/** - Save state to a file. - @param unmap URID unmapper. - @param state State to save. - @param uri URI of state, may be NULL. - @param path Path of file to save state to, may be NULL. - @param manifest_path Path of manifest file to add entry to, may be NULL. - - The format of state on disk is compatible with that defined in the LV2 - preset extension, i.e. this function may be used to save presets which can - be loaded by any host. If @c path is NULL, then the default user preset - bundle (~/.lv2/presets.lv2) is used. In this case, the label of @c state - MUST be set since it is used to generate a filename. - - If @c uri is NULL, the state will be saved without an absolute URI (but - the bundle will still work correctly as a preset bundle). -*/ -LILV_API -int -lilv_state_save(LilvWorld* world, - LV2_URID_Unmap* unmap, - const LilvState* state, - const char* uri, - const char* path, - const char* manifest_path); - /** Function to get a port value. @return A node the caller (lilv) takes ownership of and must free. @@ -1228,6 +1166,49 @@ lilv_state_new_from_instance(const LilvPlugin* plugin, uint32_t flags, const LV2_Feature *const * features); +/** + Free @c state. +*/ +LILV_API +void +lilv_state_free(LilvState* state); + +/** + Return true iff @c a is equivalent to @c b. +*/ +LILV_API +bool +lilv_state_equals(const LilvState* a, const LilvState* b); + +/** + Return the number of properties in @c state. +*/ +LILV_API +unsigned +lilv_state_get_num_properties(const LilvState* state); + +/** + Get the URI of the plugin @c state applies to. +*/ +LILV_API +const LilvNode* +lilv_state_get_plugin_uri(const LilvState* state); + +/** + Get the label of @c state. +*/ +LILV_API +const char* +lilv_state_get_label(const LilvState* state); + +/** + Set the label of @c state. +*/ +LILV_API +void +lilv_state_set_label(LilvState* state, + const char* label); + /** Function to set a port value. */ @@ -1249,8 +1230,10 @@ typedef void (*LilvSetPortValueFunc)(const char* port_symbol, port values itself (using lilv_state_get_port_value) in order to completely restore @c state. - This function is in the "instantiation" threading class, i.e. it MUST NOT be - called simultaneously with any function on the same plugin instance. + If the state has properties, this function is in the "instantiation" + threading class, i.e. it MUST NOT be called simultaneously with any function + on the same plugin instance. If the state has no properties, only port + values are set via @c set_value. See state.h from the LV2 State extension for details on the @c flags and @c features parameters. @@ -1264,6 +1247,32 @@ lilv_state_restore(const LilvState* state, uint32_t flags, const LV2_Feature *const * features); +/** + Save state to a file. + @param unmap URID unmapper. + @param state State to save. + @param uri URI of state, may be NULL. + @param path Path of file to save state to, may be NULL. + @param manifest_path Path of manifest file to add entry to, may be NULL. + + The format of state on disk is compatible with that defined in the LV2 + preset extension, i.e. this function may be used to save presets which can + be loaded by any host. If @c path is NULL, then the default user preset + bundle (~/.lv2/presets.lv2) is used. In this case, the label of @c state + MUST be set since it is used to generate a filename. + + If @c uri is NULL, the state will be saved without an absolute URI (but + the bundle will still work correctly as a preset bundle). +*/ +LILV_API +int +lilv_state_save(LilvWorld* world, + LV2_URID_Unmap* unmap, + const LilvState* state, + const char* uri, + const char* path, + const char* manifest_path); + /** @} @name Scale Point -- cgit v1.2.1