Mercurial > hg > pub > prymula > com
comparison DPF-Prymula-audioplugins/dpf/distrho/src/lv2/urid.h @ 3:84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
author | prymula <prymula76@outlook.com> |
---|---|
date | Mon, 16 Oct 2023 21:53:34 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:cf2cb71d31dd | 3:84e66ea83026 |
---|---|
1 /* | |
2 Copyright 2008-2016 David Robillard <http://drobilla.net> | |
3 Copyright 2011 Gabriel M. Beddingfield <gabrbedd@gmail.com> | |
4 | |
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. | |
8 | |
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. | |
16 */ | |
17 | |
18 /** | |
19 @defgroup urid URID | |
20 | |
21 Features for mapping URIs to and from integers, see | |
22 <http://lv2plug.in/ns/ext/urid> for details. | |
23 | |
24 @{ | |
25 */ | |
26 | |
27 #ifndef LV2_URID_H | |
28 #define LV2_URID_H | |
29 | |
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# | |
32 | |
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 | |
35 | |
36 #define LV2_URID_MAP_URI LV2_URID__map ///< Legacy | |
37 #define LV2_URID_UNMAP_URI LV2_URID__unmap ///< Legacy | |
38 | |
39 #include <stdint.h> | |
40 | |
41 #ifdef __cplusplus | |
42 extern "C" { | |
43 #endif | |
44 | |
45 /** | |
46 Opaque pointer to host data for LV2_URID_Map. | |
47 */ | |
48 typedef void* LV2_URID_Map_Handle; | |
49 | |
50 /** | |
51 Opaque pointer to host data for LV2_URID_Unmap. | |
52 */ | |
53 typedef void* LV2_URID_Unmap_Handle; | |
54 | |
55 /** | |
56 URI mapped to an integer. | |
57 */ | |
58 typedef uint32_t LV2_URID; | |
59 | |
60 /** | |
61 URID Map Feature (LV2_URID__map) | |
62 */ | |
63 typedef struct _LV2_URID_Map { | |
64 /** | |
65 Opaque pointer to host data. | |
66 | |
67 This MUST be passed to map_uri() whenever it is called. | |
68 Otherwise, it must not be interpreted in any way. | |
69 */ | |
70 LV2_URID_Map_Handle handle; | |
71 | |
72 /** | |
73 Get the numeric ID of a URI. | |
74 | |
75 If the ID does not already exist, it will be created. | |
76 | |
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. | |
81 | |
82 This function is not necessarily very fast or RT-safe: plugins SHOULD | |
83 cache any IDs they might need in performance critical situations. | |
84 | |
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). | |
89 | |
90 @param handle Must be the callback_data member of this struct. | |
91 @param uri The URI to be mapped to an integer ID. | |
92 */ | |
93 LV2_URID (*map)(LV2_URID_Map_Handle handle, | |
94 const char* uri); | |
95 } LV2_URID_Map; | |
96 | |
97 /** | |
98 URI Unmap Feature (LV2_URID__unmap) | |
99 */ | |
100 typedef struct _LV2_URID_Unmap { | |
101 /** | |
102 Opaque pointer to host data. | |
103 | |
104 This MUST be passed to unmap() whenever it is called. | |
105 Otherwise, it must not be interpreted in any way. | |
106 */ | |
107 LV2_URID_Unmap_Handle handle; | |
108 | |
109 /** | |
110 Get the URI for a previously mapped numeric ID. | |
111 | |
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(). | |
120 | |
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. | |
123 */ | |
124 const char* (*unmap)(LV2_URID_Unmap_Handle handle, | |
125 LV2_URID urid); | |
126 } LV2_URID_Unmap; | |
127 | |
128 #ifdef __cplusplus | |
129 } /* extern "C" */ | |
130 #endif | |
131 | |
132 #endif /* LV2_URID_H */ | |
133 | |
134 /** | |
135 @} | |
136 */ |