Add initial bits for Qt6 support
[carla.git] / source / includes / lv2 / urid.h
blobc9ee2e0e33cffe11c871e9d81aff0f8618554c4d
1 /*
2 Copyright 2008-2016 David Robillard <http://drobilla.net>
3 Copyright 2011 Gabriel M. Beddingfield <gabrbedd@gmail.com>
5 Permission to use, copy, modify, and/or distribute this software for any
6 purpose with or without fee is hereby granted, provided that the above
7 copyright notice and this permission notice appear in all copies.
9 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 /**
19 @defgroup urid URID
21 Features for mapping URIs to and from integers, see
22 <http://lv2plug.in/ns/ext/urid> for details.
27 #ifndef LV2_URID_H
28 #define LV2_URID_H
30 #define LV2_URID_URI "http://lv2plug.in/ns/ext/urid" ///< http://lv2plug.in/ns/ext/urid
31 #define LV2_URID_PREFIX LV2_URID_URI "#" ///< http://lv2plug.in/ns/ext/urid#
33 #define LV2_URID__map LV2_URID_PREFIX "map" ///< http://lv2plug.in/ns/ext/urid#map
34 #define LV2_URID__unmap LV2_URID_PREFIX "unmap" ///< http://lv2plug.in/ns/ext/urid#unmap
36 #define LV2_URID_MAP_URI LV2_URID__map ///< Legacy
37 #define LV2_URID_UNMAP_URI LV2_URID__unmap ///< Legacy
39 #include <stdint.h>
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
45 /**
46 Opaque pointer to host data for LV2_URID_Map.
48 typedef void* LV2_URID_Map_Handle;
50 /**
51 Opaque pointer to host data for LV2_URID_Unmap.
53 typedef void* LV2_URID_Unmap_Handle;
55 /**
56 URI mapped to an integer.
58 typedef uint32_t LV2_URID;
60 /**
61 URID Map Feature (LV2_URID__map)
63 typedef struct _LV2_URID_Map {
64 /**
65 Opaque pointer to host data.
67 This MUST be passed to map_uri() whenever it is called.
68 Otherwise, it must not be interpreted in any way.
70 LV2_URID_Map_Handle handle;
72 /**
73 Get the numeric ID of a URI.
75 If the ID does not already exist, it will be created.
77 This function is referentially transparent; any number of calls with the
78 same arguments is guaranteed to return the same value over the life of a
79 plugin instance. Note, however, that several URIs MAY resolve to the
80 same ID if the host considers those URIs equivalent.
82 This function is not necessarily very fast or RT-safe: plugins SHOULD
83 cache any IDs they might need in performance 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. However, hosts SHOULD NOT
87 return 0 from this function in non-exceptional circumstances (i.e. the
88 URI map SHOULD be dynamic).
90 @param handle Must be the callback_data member of this struct.
91 @param uri The URI to be mapped to an integer ID.
93 LV2_URID (*map)(LV2_URID_Map_Handle handle,
94 const char* uri);
95 } LV2_URID_Map;
97 /**
98 URI Unmap Feature (LV2_URID__unmap)
100 typedef struct _LV2_URID_Unmap {
102 Opaque pointer to host data.
104 This MUST be passed to unmap() whenever it is called.
105 Otherwise, it must not be interpreted in any way.
107 LV2_URID_Unmap_Handle handle;
110 Get the URI for a previously mapped numeric ID.
112 Returns NULL if `urid` is not yet mapped. Otherwise, the corresponding
113 URI is returned in a canonical form. This MAY not be the exact same
114 string that was originally passed to LV2_URID_Map::map(), but it MUST be
115 an identical URI according to the URI syntax specification (RFC3986). A
116 non-NULL return for a given `urid` will always be the same for the life
117 of the plugin. Plugins that intend to perform string comparison on
118 unmapped URIs SHOULD first canonicalise URI strings with a call to
119 map_uri() followed by a call to unmap_uri().
121 @param handle Must be the callback_data member of this struct.
122 @param urid The ID to be mapped back to the URI string.
124 const char* (*unmap)(LV2_URID_Unmap_Handle handle,
125 LV2_URID urid);
126 } LV2_URID_Unmap;
128 #ifdef __cplusplus
129 } /* extern "C" */
130 #endif
132 #endif /* LV2_URID_H */