Add initial bits for Qt6 support
[carla.git] / source / includes / lv2 / uri-map.h
blob12d52be139e7f7c88b4b2fe00549a25534182818
1 /*
2 Copyright 2008-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 uri-map URI Map
20 C API for the LV2 URI Map extension <http://lv2plug.in/ns/ext/uri-map>.
22 This extension defines a simple mechanism for plugins to map URIs to
23 integers, usually for performance reasons (e.g. processing events typed by
24 URIs in real time). The expected use case is for plugins to map URIs to
25 integers for things they 'understand' at instantiation time, and store those
26 values for use in the audio thread without doing any string comparison.
27 This allows the extensibility of RDF with the performance of integers (or
28 centrally defined enumerations).
33 #ifndef LV2_URI_MAP_H
34 #define LV2_URI_MAP_H
36 #define LV2_URI_MAP_URI "http://lv2plug.in/ns/ext/uri-map" ///< http://lv2plug.in/ns/ext/uri-map
37 #define LV2_URI_MAP_PREFIX LV2_URI_MAP_URI "#" ///< http://lv2plug.in/ns/ext/uri-map#
39 #include <stdint.h>
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
45 /**
46 Opaque pointer to host data.
48 typedef void* LV2_URI_Map_Callback_Data;
50 /**
51 URI Map Feature.
53 To support this feature the host must pass an LV2_Feature struct to the
54 plugin's instantiate method with URI "http://lv2plug.in/ns/ext/uri-map"
55 and data pointed to an instance of this struct.
57 typedef struct {
58 /**
59 Opaque pointer to host data.
61 The plugin MUST pass this to any call to functions in this struct.
62 Otherwise, it must not be interpreted in any way.
64 LV2_URI_Map_Callback_Data callback_data;
66 /**
67 Get the numeric ID of a URI from the host.
69 @param callback_data Must be the callback_data member of this struct.
70 @param map The 'context' of this URI. Certain extensions may define a
71 URI that must be passed here with certain restrictions on the return
72 value (e.g. limited range). This value may be NULL if the plugin needs
73 an ID for a URI in general. Extensions SHOULD NOT define a context
74 unless there is a specific need to do so, e.g. to restrict the range of
75 the returned value.
76 @param uri The URI to be mapped to an integer ID.
78 This function is referentially transparent; any number of calls with the
79 same arguments is guaranteed to return the same value over the life of a
80 plugin instance (though the same URI may return different values with a
81 different map parameter). However, this function is not necessarily very
82 fast: plugins SHOULD cache any IDs they might need in performance
83 critical situations.
85 The return value 0 is reserved and indicates that an ID for that URI
86 could not be created for whatever reason. Extensions MAY define more
87 precisely what this means in a certain context, but in general plugins
88 SHOULD handle this situation as gracefully as possible. However, hosts
89 SHOULD NOT return 0 from this function in non-exceptional circumstances
90 (e.g. the URI map SHOULD be dynamic). Hosts that statically support only
91 a fixed set of URIs should not expect plugins to function correctly.
93 uint32_t (*uri_to_id)(LV2_URI_Map_Callback_Data callback_data,
94 const char* map,
95 const char* uri);
96 } LV2_URI_Map_Feature;
98 #ifdef __cplusplus
99 } /* extern "C" */
100 #endif
102 #endif /* LV2_URI_MAP_H */