Add initial bits for Qt6 support
[carla.git] / source / includes / lv2 / options.h
blob70fb5b7a7ce9124c8de5f1bc49eb797fe92a4c41
1 /*
2 Copyright 2012-2016 David Robillard <http://drobilla.net>
4 Permission to use, copy, modify, and/or distribute this software for any
5 purpose with or without fee is hereby granted, provided that the above
6 copyright notice and this permission notice appear in all copies.
8 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 /**
18 @defgroup options Options
20 Instantiation time options, see <http://lv2plug.in/ns/ext/options> for
21 details.
26 #ifndef LV2_OPTIONS_H
27 #define LV2_OPTIONS_H
29 #include <stdint.h>
31 #include "urid.h"
32 #include "lv2.h"
34 #define LV2_OPTIONS_URI "http://lv2plug.in/ns/ext/options" ///< http://lv2plug.in/ns/ext/options
35 #define LV2_OPTIONS_PREFIX LV2_OPTIONS_URI "#" ///< http://lv2plug.in/ns/ext/options#
37 #define LV2_OPTIONS__Option LV2_OPTIONS_PREFIX "Option" ///< http://lv2plug.in/ns/ext/options#Option
38 #define LV2_OPTIONS__interface LV2_OPTIONS_PREFIX "interface" ///< http://lv2plug.in/ns/ext/options#interface
39 #define LV2_OPTIONS__options LV2_OPTIONS_PREFIX "options" ///< http://lv2plug.in/ns/ext/options#options
40 #define LV2_OPTIONS__requiredOption LV2_OPTIONS_PREFIX "requiredOption" ///< http://lv2plug.in/ns/ext/options#requiredOption
41 #define LV2_OPTIONS__supportedOption LV2_OPTIONS_PREFIX "supportedOption" ///< http://lv2plug.in/ns/ext/options#supportedOption
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
47 /**
48 The context of an Option, which defines the subject it applies to.
50 typedef enum {
51 /**
52 This option applies to the instance itself. The subject must be
53 ignored.
55 LV2_OPTIONS_INSTANCE,
57 /**
58 This option applies to some named resource. The subject is a URI mapped
59 to an integer (a LV2_URID, like the key)
61 LV2_OPTIONS_RESOURCE,
63 /**
64 This option applies to some blank node. The subject is a blank node
65 identifier, which is valid only within the current local scope.
67 LV2_OPTIONS_BLANK,
69 /**
70 This option applies to a port on the instance. The subject is the
71 port's index.
73 LV2_OPTIONS_PORT
74 } LV2_Options_Context;
76 /**
77 An option.
79 This is a property with a subject, also known as a triple or statement.
81 This struct is useful anywhere a statement needs to be passed where no
82 memory ownership issues are present (since the value is a const pointer).
84 Options can be passed to an instance via the feature LV2_OPTIONS__options
85 with data pointed to an array of options terminated by a zeroed option, or
86 accessed/manipulated using LV2_Options_Interface.
88 typedef struct _LV2_Options_Option {
89 LV2_Options_Context context; /**< Context (type of subject). */
90 uint32_t subject; /**< Subject. */
91 LV2_URID key; /**< Key (property). */
92 uint32_t size; /**< Size of value in bytes. */
93 LV2_URID type; /**< Type of value (datatype). */
94 const void* value; /**< Pointer to value (object). */
95 } LV2_Options_Option;
97 /** A status code for option functions. */
98 typedef enum {
99 LV2_OPTIONS_SUCCESS = 0, /**< Completed successfully. */
100 LV2_OPTIONS_ERR_UNKNOWN = 1, /**< Unknown error. */
101 LV2_OPTIONS_ERR_BAD_SUBJECT = 1 << 1, /**< Invalid/unsupported subject. */
102 LV2_OPTIONS_ERR_BAD_KEY = 1 << 2, /**< Invalid/unsupported key. */
103 LV2_OPTIONS_ERR_BAD_VALUE = 1 << 3 /**< Invalid/unsupported value. */
104 } LV2_Options_Status;
107 Interface for dynamically setting options (LV2_OPTIONS__interface).
109 typedef struct _LV2_Options_Interface {
111 Get the given options.
113 Each element of the passed options array MUST have type, subject, and
114 key set. All other fields (size, type, value) MUST be initialised to
115 zero, and are set to the option value if such an option is found.
117 This function is in the "instantiation" LV2 threading class, so no other
118 instance functions may be called concurrently.
120 @return Bitwise OR of LV2_Options_Status values.
122 uint32_t (*get)(LV2_Handle instance,
123 LV2_Options_Option* options);
126 Set the given options.
128 This function is in the "instantiation" LV2 threading class, so no other
129 instance functions may be called concurrently.
131 @return Bitwise OR of LV2_Options_Status values.
133 uint32_t (*set)(LV2_Handle instance,
134 const LV2_Options_Option* options);
135 } LV2_Options_Interface;
137 #ifdef __cplusplus
138 } /* extern "C" */
139 #endif
141 #endif /* LV2_OPTIONS_H */