diff options
author | David Robillard <d@drobilla.net> | 2012-03-04 06:06:51 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-03-04 06:06:51 +0000 |
commit | f4744afff6c6975b57a50255c1c388c77cccd414 (patch) | |
tree | 6527c8dea87e6ce2088c0ca832eddf4a023b68b1 /lv2/lv2plug.in/ns/ext | |
parent | c768da6fb7c299d66ef1af0f9423ceba525c1b3c (diff) | |
download | lv2-f4744afff6c6975b57a50255c1c388c77cccd414.tar.xz |
Add status flags so plugins can tell why storing a property failed.
Diffstat (limited to 'lv2/lv2plug.in/ns/ext')
-rw-r--r-- | lv2/lv2plug.in/ns/ext/state/state.h | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/lv2/lv2plug.in/ns/ext/state/state.h b/lv2/lv2plug.in/ns/ext/state/state.h index cb00925..3bd6697 100644 --- a/lv2/lv2plug.in/ns/ext/state/state.h +++ b/lv2/lv2plug.in/ns/ext/state/state.h @@ -90,6 +90,14 @@ typedef enum { } LV2_State_Flags; +/** A status code for state functions. */ +typedef enum { + LV2_STATE_SUCCESS = 0, /**< Completed successfully. */ + LV2_STATE_ERR_UNKNOWN = 1, /**< Unknown error. */ + LV2_STATE_ERR_BAD_TYPE = 2, /**< Failed due to unsupported type. */ + LV2_STATE_ERR_BAD_FLAGS = 3 /**< Failed due to unsupported flags. */ +} LV2_State_Status; + /** A host-provided function to store a property. @param handle Must be the handle passed to LV2_State_Interface.save(). @@ -113,7 +121,8 @@ typedef enum { The host MAY fail to store a property for whatever reason, but SHOULD store any property that is LV2_STATE_IS_POD and LV2_STATE_IS_PORTABLE. Implementations SHOULD use the types from the LV2 Atom extension - (http://lv2plug.in/ns/ext/atom) wherever possible. + (http://lv2plug.in/ns/ext/atom) wherever possible. The plugin SHOULD + attempt to fall-back and avoid the error if possible. Note that @p size MUST be > 0, and @p value MUST point to a valid region of memory @p size bytes long (this is required to make restore unambiguous). @@ -121,12 +130,13 @@ typedef enum { The plugin MUST NOT attempt to use this function outside of the LV2_State_Interface.restore() context. */ -typedef int (*LV2_State_Store_Function)(LV2_State_Handle handle, - uint32_t key, - const void* value, - size_t size, - uint32_t type, - uint32_t flags); +typedef LV2_State_Status (*LV2_State_Store_Function)( + LV2_State_Handle handle, + uint32_t key, + const void* value, + size_t size, + uint32_t type, + uint32_t flags); /** A host-provided function to retrieve a property. @@ -146,11 +156,12 @@ typedef int (*LV2_State_Store_Function)(LV2_State_Handle handle, returns. The plugin MUST NOT attempt to use this function, or any value returned from it, outside of the LV2_State_Interface.restore() context. */ -typedef const void* (*LV2_State_Retrieve_Function)(LV2_State_Handle handle, - uint32_t key, - size_t* size, - uint32_t* type, - uint32_t* flags); +typedef const void* (*LV2_State_Retrieve_Function)( + LV2_State_Handle handle, + uint32_t key, + size_t* size, + uint32_t* type, + uint32_t* flags); /** State Interface (Extension Data). |